"Unable to open shell" when not running playbook as sudo

18 views
Skip to first unread message

Bryan Bartik

unread,
Feb 28, 2018, 6:33:18 PM2/28/18
to Ansible Project
I have a playbook that backups router configs using the ios_config module. When I run the command as sudo it works but the files it creates are owned by root. I want them owned by me. However when I run the ansible-playbook command without sudo it fails and gives the errors below. Any ideas what I need to change to get this to work?

bryan@ubuntu:~/mine/cfg-backup$ ansible-playbook -vvv cfg-backup.yml
...
<192.168.9.201> using connection plugin network_cli
<192.168.9.202> using connection plugin network_cli
<192.168.9.203> using connection plugin network_cli
fatal: [192.168.9.202]: FAILED! => {
    "changed": false,
}
fatal: [192.168.9.201]: FAILED! => {
    "changed": false,
}
fatal: [192.168.9.203]: FAILED! => {
    "changed": false,
}

Thanks,

Bryan

Bryan Bartik

unread,
Mar 1, 2018, 8:31:03 AM3/1/18
to Ansible Project
I think I figured it out. There are directories in ~/.ansible that were owned by root that need to be writeable by the user running ansible. They were owned by root probably because I ran the playbook as sudo the first time. I chowned these and now everything is fine.
Reply all
Reply to author
Forward
0 new messages