Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6184

Ansible: Copy file into another users home directory

$
0
0

I am new to Ansible so this may be a silly question. Thank you for your patience.

I have two users on my child node: ubuntu and ansible

I have one user on my control node: ubuntu

I created the ansible user on my child node to test out multiple users/isolate ansible. Maybe this is not a good idea?

I am trying to copy a test file from my control node to my child node. I am connecting as the ansible user (because I've granted them passwordless sudo in the sudoers file, I don't want to do this for the ubuntu user). However I cannot copy the file into ubuntu user's home folder. I am able to copy into ansible user's home folder.

Is what I'm trying to do possible? I couldn't find much reading on this so I am guessing I am approaching this the wrong way... is there a better way to do this?

Here is my playbook:

---- name: script transfer practice  hosts: devdebugs  remote_user: ansible  tasks:  - name: Copy file with owner and permissions    ansible.builtin.copy:      src: /home/ubuntu/files/test.txt      dest: /home/ubuntu/test.txt      owner: ubuntu      group: ubuntu      mode: '0600'...

Note: It works with dest /home/ansible/test.txt. It does not work with dest /home/ubuntu/test.txt


Viewing all articles
Browse latest Browse all 6184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>