I have permission problem when I try do deploy something using Ansible, here is the log:
host001:svc_test_prod02~/ansible$ ansible-playbook -i inventory/prod/ acc.yml -v --vault-password-file=~/.ansible-vault-pw --private-key ~/.ssh/svc_test_prod02
PLAY [impact02] ***************************************************************
GATHERING FACTS ***************************************************************
ok: [impact02]
TASK: [ac_connect | debug environment] ****************************************
ok: [impact02] => {
“msg”: “we are in PROD02 environment, temp dir /opt/refdata/PROD02/.acconnect_impact_temp”
}
TASK: [ac_connect | create directories] ***************************************
failed: [impact02] => {“failed”: true, “parsed”: false}
/home/svc_test_prod02/.bashrc: line 24: /opt/refdata/PROD02/test/bin/acenv.sh: No such file or directory
Traceback (most recent call last):
File “/home/svc_test_prod02/.ansible/tmp/ansible-tmp-1441058033.64-235558047812754/file”, line 1999, in
main()
File “/home/svc_test_prod02/.ansible/tmp/ansible-tmp-1441058033.64-235558047812754/file”, line 279, in main
os.mkdir(curpath)
OSError: [Errno 13] Permission denied: ‘/opt/refdata/PROD02’
FATAL: all hosts have already failed – aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/svc_test_prod02/acc.retry
impact02 : ok=2 changed=0 unreachable=0 failed=1
the runbook tries to create a directory.
What I did is I added the svc_test_prod02 public key to authorized_keys2. The user is defined in the inventory like this:
ansible_ssh_user: svc_test_prod02
Is there anything else I need to do? To add to this - this problem only happens when I perform this task as svc_test_prod02 user. If I login as my personal user I don’t have permission issues.