copy files to remote machine's /etc/systemd/ directory using ansible -
i new ansible. may saying wrong.
i created vm using kvm, both remote , local running on ubuntu 16.0.4
now configured ansible creating key ssh-keygen -t rsa -b 4096 -c "d...@192.168.111.113" created key , copied remote machine ssh-copy-id d...@192.168.111.113 tested ssh working, working fine.
i added remote machine's address in /etc/ansible/hosts under [ddas] group.
now can ping remote machine using ansible. wrote playbook copy file. working fine copy files /home/das1/ only. mean, can copy files location not need root permission.
i want copy these files /etc/systemd/ directory instead of /home/das1/. changed dest in playbook gives permission related errors.
any highly appreciated.
thank das
by default playbook tasks execute under context of user use connect remote system. ansible allows change user use run playbook or individual tasks. can create new user , give privileges directory mention or can use built-in root user.
to run entire playbook root example put @ top adjusting whatever actual hosts value is:
- hosts: 192.168.111.113 become: true become_user: root tasks: ...
Comments
Post a Comment