Skip to content

Ansible, "copy" module and "become"

For testing I did spin up a couple of new virtual (Ubuntu 20.04 LTS) instances, installed PostgreSQL, and wanted to copy over a .sql file to install in the database:

- name: copy files to PostgreSQL data directory
  copy:
    src: "files/{{ item }}"
    dest: "{{ item }}"
    mode: 0700
  become: yes
  become_user: postgres
  loop:
    - file1.sql
    - file2.sql

And ran into a meaningless error message:

TASK [copy files to PostgreSQL data directory] ***********
fatal: [xxx.xxx.xxx.xxx]: FAILED! => {"msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: chown: changing ownership of '/var/tmp/ansible-tmp-1618521951.848439-176484068031965/': Operation not permitted\nchown: changing ownership of '/var/tmp/ansible-tmp-1618521951.848439-176484068031965/source': Operation not permitted\n}). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}

 

 

Continue reading "Ansible, "copy" module and "become""
  • Twitter
  • Bookmark Ansible, "copy" module and "become" at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Ansible, "copy" module and "become"
  • Bloglines Ansible, "copy" module and "become"
  • Technorati Ansible, "copy" module and "become"
  • Fark this: Ansible, "copy" module and "become"
  • Bookmark Ansible, "copy" module and "become" at YahooMyWeb
  • Bookmark Ansible, "copy" module and "become" at Furl.net
  • Bookmark Ansible, "copy" module and "become" at reddit.com
  • Bookmark Ansible, "copy" module and "become" at blinklist.com
  • Bookmark Ansible, "copy" module and "become" at Spurl.net
  • Bookmark Ansible, "copy" module and "become" at Simpy.com
  • Bookmark Ansible, "copy" module and "become" at blogmarks
  • Bookmark Ansible, "copy" module and "become" with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca