Ansible Playbook running locally but unable to ssh to host via AWXHow do you manage ssh keys to add a second user?ssh_exchange_identification: Connection closed by remote hostSSH accepts publickey authetication but won't connect with an identify file?OpenSSH disable ControlMaster for given hostnameAnsible Fails to Authenticate Sudo Even When Sudo Pass is GivenAnsible with Github: Permission denied (Publickey)Ansible can't git clone from enterprise git serverAd-hoc ansible command with vaultAnsible AWX playbooks pulled from github do not show in playbook drop-down box

Why doesn't a particle exert force on itself?

Can you turn a recording upside-down?

My parents are Afghan

What are my options legally if NYC company is not paying salary?

Why does this pattern in powers happen?

Do oversize pulley wheels increase derailleur capacity?

Is there an application which does HTTP PUT?

Capturing the entire webpage with WebExecute's CaptureImage

Are there vaccine ingredients which may not be disclosed ("hidden", "trade secret", or similar)?

Why doesn't increasing the temperature of something like wood or paper set them on fire?

Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?

Opposite party turned away from voting when ballot is all opposing party

why it is 2>&1 and not 2>>&1 to append to a log file

How can it be that ssh somename works, while nslookup somename does not?

Steganography in Latex

Can the president of the United States be guilty of insider trading?

Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1

Should one save up to purchase a house/condo or maximize their 401(k) first?

My perfect evil overlord plan... or is it?

Was Mohammed the most popular first name for boys born in Berlin in 2018?

Gift for mentor after his thesis defense?

Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?

Names of the Six Tastes

Add elements inside Array conditionally in JavaScript



Ansible Playbook running locally but unable to ssh to host via AWX


How do you manage ssh keys to add a second user?ssh_exchange_identification: Connection closed by remote hostSSH accepts publickey authetication but won't connect with an identify file?OpenSSH disable ControlMaster for given hostnameAnsible Fails to Authenticate Sudo Even When Sudo Pass is GivenAnsible with Github: Permission denied (Publickey)Ansible can't git clone from enterprise git serverAd-hoc ansible command with vaultAnsible AWX playbooks pulled from github do not show in playbook drop-down box






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















SUMMARY



I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX



  • AWX inventory has just that host added along with ansible_user :
    xxxxx which is the user I want to deploy with

  • Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)

  • I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host


  • Running the ssh command AWS runs while gathering information fails




    ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''




Output:



debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
bind: No such file or directory
unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc



  • Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -




    ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname




Questions



  1. Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission

  2. Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck

  3. Why it is not working with Control Params

Additional Information



Ansible Version



ansible 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]


Configuration



ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C


OS / ENVIRONMENT



Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)



Target host OS -> CentOS Linux release 7.5.1804 (Core)



AWX Version: 2.1.0



AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose



STEPS TO REPRODUCE



1) Created Project in AWX with SCM type git.



2) Created inventory in AWX adding the host with variable ansible_user: xxxxx



3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook



PlayBook



https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml



ACTUAL RESULTS while running the job template



ansible-playbook 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
1 plays in installnodejs.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Created new build directory] *********************************************
task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
<hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
<hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
<hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
fatal: [hostname]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
PLAY RECAP *********************************************************************
hostname : ok=0 changed=0 unreachable=1 failed=0









share|improve this question






























    2















    SUMMARY



    I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX



    • AWX inventory has just that host added along with ansible_user :
      xxxxx which is the user I want to deploy with

    • Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)

    • I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host


    • Running the ssh command AWS runs while gathering information fails




      ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''




    Output:



    debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
    bind: No such file or directory
    unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc



    • Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -




      ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname




    Questions



    1. Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission

    2. Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck

    3. Why it is not working with Control Params

    Additional Information



    Ansible Version



    ansible 2.7.1
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /bin/ansible
    python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]


    Configuration



    ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C


    OS / ENVIRONMENT



    Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)



    Target host OS -> CentOS Linux release 7.5.1804 (Core)



    AWX Version: 2.1.0



    AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose



    STEPS TO REPRODUCE



    1) Created Project in AWX with SCM type git.



    2) Created inventory in AWX adding the host with variable ansible_user: xxxxx



    3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook



    PlayBook



    https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml



    ACTUAL RESULTS while running the job template



    ansible-playbook 2.7.1
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /usr/bin/ansible-playbook
    python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
    Using /etc/ansible/ansible.cfg as config file
    setting up inventory plugins
    Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
    Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
    1 plays in installnodejs.yml
    PLAY [all] *********************************************************************
    META: ran handlers
    TASK [Created new build directory] *********************************************
    task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
    <hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
    <hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
    <hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
    fatal: [hostname]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
    PLAY RECAP *********************************************************************
    hostname : ok=0 changed=0 unreachable=1 failed=0









    share|improve this question


























      2












      2








      2








      SUMMARY



      I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX



      • AWX inventory has just that host added along with ansible_user :
        xxxxx which is the user I want to deploy with

      • Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)

      • I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host


      • Running the ssh command AWS runs while gathering information fails




        ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''




      Output:



      debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
      bind: No such file or directory
      unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc



      • Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -




        ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname




      Questions



      1. Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission

      2. Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck

      3. Why it is not working with Control Params

      Additional Information



      Ansible Version



      ansible 2.7.1
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /bin/ansible
      python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]


      Configuration



      ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C


      OS / ENVIRONMENT



      Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)



      Target host OS -> CentOS Linux release 7.5.1804 (Core)



      AWX Version: 2.1.0



      AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose



      STEPS TO REPRODUCE



      1) Created Project in AWX with SCM type git.



      2) Created inventory in AWX adding the host with variable ansible_user: xxxxx



      3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook



      PlayBook



      https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml



      ACTUAL RESULTS while running the job template



      ansible-playbook 2.7.1
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /usr/bin/ansible-playbook
      python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
      Using /etc/ansible/ansible.cfg as config file
      setting up inventory plugins
      Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
      Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
      1 plays in installnodejs.yml
      PLAY [all] *********************************************************************
      META: ran handlers
      TASK [Created new build directory] *********************************************
      task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
      <hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
      <hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
      <hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
      fatal: [hostname]: UNREACHABLE! => {
      "changed": false,
      "msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
      PLAY RECAP *********************************************************************
      hostname : ok=0 changed=0 unreachable=1 failed=0









      share|improve this question
















      SUMMARY



      I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX



      • AWX inventory has just that host added along with ansible_user :
        xxxxx which is the user I want to deploy with

      • Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)

      • I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host


      • Running the ssh command AWS runs while gathering information fails




        ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''




      Output:



      debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
      bind: No such file or directory
      unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc



      • Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -




        ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname




      Questions



      1. Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission

      2. Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck

      3. Why it is not working with Control Params

      Additional Information



      Ansible Version



      ansible 2.7.1
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /bin/ansible
      python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]


      Configuration



      ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C


      OS / ENVIRONMENT



      Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)



      Target host OS -> CentOS Linux release 7.5.1804 (Core)



      AWX Version: 2.1.0



      AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose



      STEPS TO REPRODUCE



      1) Created Project in AWX with SCM type git.



      2) Created inventory in AWX adding the host with variable ansible_user: xxxxx



      3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook



      PlayBook



      https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml



      ACTUAL RESULTS while running the job template



      ansible-playbook 2.7.1
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /usr/bin/ansible-playbook
      python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
      Using /etc/ansible/ansible.cfg as config file
      setting up inventory plugins
      Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
      Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
      1 plays in installnodejs.yml
      PLAY [all] *********************************************************************
      META: ran handlers
      TASK [Created new build directory] *********************************************
      task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
      <hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
      <hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
      <hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
      fatal: [hostname]: UNREACHABLE! => {
      "changed": false,
      "msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
      PLAY RECAP *********************************************************************
      hostname : ok=0 changed=0 unreachable=1 failed=0






      ssh ansible ansible-tower






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 '18 at 6:13







      Sandeep Dharembra

















      asked Nov 29 '18 at 3:36









      Sandeep DharembraSandeep Dharembra

      365




      365




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I was finally able to find a solution to this issue -



          The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
          Job was now able to run (ssh on the remote host)






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "2"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f942092%2fansible-playbook-running-locally-but-unable-to-ssh-to-host-via-awx%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I was finally able to find a solution to this issue -



            The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
            Job was now able to run (ssh on the remote host)






            share|improve this answer



























              0














              I was finally able to find a solution to this issue -



              The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
              Job was now able to run (ssh on the remote host)






              share|improve this answer

























                0












                0








                0







                I was finally able to find a solution to this issue -



                The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
                Job was now able to run (ssh on the remote host)






                share|improve this answer













                I was finally able to find a solution to this issue -



                The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
                Job was now able to run (ssh on the remote host)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 30 '18 at 6:50









                Sandeep DharembraSandeep Dharembra

                365




                365



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Server Fault!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f942092%2fansible-playbook-running-locally-but-unable-to-ssh-to-host-via-awx%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                    Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                    What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company