Hi all, 

I'm able to add the host dynamically however I'm not able to run  yum 
install commands on it because of user issues: 


Error: 

command scp -v -t 'Please login as the user:



----

<10.133.180.62> SSH: EXEC sshpass -d14 scp -vvv -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=root -o ConnectTimeout=10 -o 
ControlPath=/home/jbrewster/.ansible/cp/ansible-ssh-%h-%p-%r /tmp/tmpZYJT7h 
'[10.133.180.62]:'"'"*'Please login as the user "centos" rather than the 
user *"root"./setup.py'"'"''
 [WARNING]: scp transfer mechanism failed on [10.133.180.62]. Use 
ANSIBLE_DEBUG=1 to see detailed information

-----



Host creation successful: 
 

------------------------------------------



   - name: Add CentOS Instance to Inventory
      add_host: name=myserver7 groups=webservers
             ansible_ssh_host={{ myserver7.server.public_v4 }}
 
 - hosts: myserver7 
   remote_user: centos   
   sudo: yes   
   #become: 
   tasks:
    - debug:
         var: vars
    - name: ensure apache is at the latest version
      yum: name=httpd state=latest
    - name: make sure apache is running
      service: name=httpd state=running
-----------------------------------------------


The above is  what generates the failures. 



-----

full play book: 


---
 - name: Test
   hosts: localhost
   tasks:
    - os_server:
        cloud: testing
        name: myserver7
        state: present
        image: centos7
        nics:
          - net-name: vlan1180-dmz-ops
        flavor: m1.small
        key_name: jeff-desktop
        meta: 
         hostname: mysever7.localdomain
      register: myserver7
    - debug:
        var: myserver7

    - command: >
        ssh -o BatchMode=yes
        centos@{{myserver7.server.public_v4}} true
      register: result
      until: result|success
      retries: 300
      delay: 5 


    - name: Add CentOS Instance to Inventory
      add_host: name=myserver7 groups=webservers
             ansible_ssh_host={{ myserver7.server.public_v4 }}


  
 - hosts: myserver7 
   remote_user: centos   
   sudo: yes   
   #become: 
   tasks:
    - debug:
         var: vars
    - name: ensure apache is at the latest version
      yum: name=httpd state=latest
    - name: make sure apache is running
      service: name=httpd state=running


full error: 


TASK [setup] 
*******************************************************************
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<10.133.180.62> ESTABLISH SSH CONNECTION FOR USER: root
<10.133.180.62> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=root -o ConnectTimeout=10 -o 
ControlPath=/home/jbrewster/.ansible/cp/ansible-ssh-%h-%p-%r 10.133.180.62 
'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo 
~/.ansible/tmp/ansible-tmp-1487709168.28-100153560564195 `" && echo 
ansible-tmp-1487709168.28-100153560564195="` echo 
~/.ansible/tmp/ansible-tmp-1487709168.28-100153560564195 `" ) && sleep 
0'"'"''
*<10.133.180.62> PUT /tmp/tmpqeBJEA TO Please login as the user "centos" 
rather than the user "root"./setup.py*
<10.133.180.62> SSH: EXEC sshpass -d14 sftp -o BatchMode=no -b - -vvv -C -o 
ControlMaster=auto -o ControlPersist=60s -o User=root -o ConnectTimeout=10 
-o ControlPath=/home/jbrewster/.ansible/cp/ansible-ssh-%h-%p-%r 
'[10.133.180.62]'
 [WARNING]: sftp transfer mechanism failed on [10.133.180.62]. Use 
ANSIBLE_DEBUG=1 to see detailed information

<10.133.180.62> SSH: EXEC sshpass -d14 scp -vvv -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=root -o ConnectTimeout=10 -o 
ControlPath=/home/jbrewster/.ansible/cp/ansible-ssh-%h-%p-%r /tmp/tmpqeBJEA 
'[10.133.180.62]:'"'"'Please login as the user "centos" rather than the 
user "root"./setup.py'"'"''
 [WARNING]: scp transfer mechanism failed on [10.133.180.62]. Use 
ANSIBLE_DEBUG=1 to see detailed information

fatal: [myserver7]: FAILED! => {
    "failed": true, 
   * "msg": "failed to transfer file to Please login as the user \"centos\" 
rather than the user \"root\"./setup.py:\n\nExecuting: program /usr/bin/ssh 
host 10.133.180.62, user (unspecified), command scp -v -t 'Please login as 
the user \"centos\" rather than the user 
\"root\"./setup.py'\nOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb *2013\r\ndebug1: 
Reading configuration data /etc/ssh/ssh_config\r\ndebug1: 
/etc/ssh/ssh_config line 56: Applying options for *\r\ndebug1: auto-mux: 
Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: 
mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: 
request forwardings: 0 local, 0 remote\r\ndebug3: 
mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: 
entering\r\ndebug3: mux_client_request_alive: done pid = 9101\r\ndebug3: 
mux_client_request_session: session request sent\r\ndebug1: 
mux_client_request_session: master session id: 3\r\nPlease login as the 
user \"centos\" rather than the user \"root\".\ndebug2: Exiting on signal 
1\r\n"
}
to retry, use: --limit @/home/jbrewster/dev/ansible/anslaunch.retry

PLAY RECAP 
*********************************************************************
localhost                  : ok=5    changed=3    unreachable=0    failed=0 
  
myserver7                  : ok=0    changed=0    unreachable=0    failed=1 
  

[jbrewster@mojojojo ansible]$ 


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0d8a7612-2d2d-4ef8-9b9c-701262ec53fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to