0

I am trying to understand something between SSH and ansible set on inventory. I am running a playbook deployment and whenever I set the inventory like that :

[status]
qastatus ansible_ssh_user=ansible ansible_ssh_host=172.16.19.34 ansible_ssh_private_key_file=~/credentials/ansible_id_rsa 
I am having permission denied but when I set like that 

[status]
172.16.19.34 ansible_connection=local 

it start running the deployment process find and stop here:

TASK: [nodejs_app | Pull down code] ******************************************* 
failed: [172.16.19.34] => {"changed": true, "cmd": ["s3cmd", "-c", "/root/.s3cfg", "get", "s3://snapav-code/cs-system-status/cs-system-status-7ab76c7ec22af26fa3605d55750b6050e5ca17d5-2015-11-02_03-23-46--75.tar.gz", "/var/cs-apps/cs-system-status/7ab76c7ec22af26fa3605d55750b6050e5ca17d5-2015-11-02_03-23-46--75"], "delta": "0:00:00.148056", "end": "2015-11-02 22:45:36.958560", "item": "", "rc": 1, "start": "2015-11-02 22:45:36.810504"}
stderr: ERROR: /root/.s3cfg: Permission denied
ERROR: Configuration file not available.
ERROR: Consider using --configure parameter to create one.

I don't know why ??? what should I do to fix it ?

  • Are you using become_user=sudo or become=true in your site.yml file If you are not using kindly add them. – Bidyut Aug 22 '17 at 8:29
0

Make sure you can ssh to the remote host with the correct user name without using ansible cmd

ssh uname@host 

once you've done it, edit your /etc/ansible/hosts file for example this is how I connect to my vagrant box with ssh

# Ex 1: Ungrouped hosts, specify before any group headers.
[all:vars]
ansible_ssh_user=vagrant


#green.example.com
#blue.example.com
#192.168.100.1
#192.168.100.10
[slave]
{{some_ip_here}}
...

Now just run the command you want or quickly test with:

ansible slave -m ping
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.