Hi Mark,

No, when I run the ansible ping command, I get "No hosts matched." 
 However, if I just use the normal ping command on that IP, I get a 
response.

On Wednesday, April 5, 2017 at 2:02:08 PM UTC-7, Mark Phillips wrote:
>
> Hello Robert,
>
> Does 'ansible -m ping 45.56.89.116' from that same backup server work just 
> fine?
>
>
> On Wednesday, 5 April 2017 17:55:03 UTC+1, Robert F wrote:
>>
>> Here is the output when I run the playbook with the "-vvvv" argument:
>>
>>
>> PLAY [restore database server] 
>> ************************************************ 
>>
>> TASK: [fail msg='Please specify a database (db), -e "db=db03"'] 
>> *************** 
>> skipping: [db02.example.com]
>>
>> TASK: [set_fact db={{ db }}] 
>> ************************************************** 
>> <45.56.89.116> ESTABLISH CONNECTION FOR USER: smith
>> ok: [db02.example.com] => {"ansible_facts": {"db": "db02"}}
>>
>> TASK: [fail msg='Please specify a tier (tier), -e "tier=production"'] 
>> ********* 
>> skipping: [db02.example.com]
>>
>> TASK: [set_fact tier={{ tier }}] 
>> ********************************************** 
>> <45.56.89.116> ESTABLISH CONNECTION FOR USER: smith
>> ok: [db02.example.com] => {"ansible_facts": {"tier": "staging"}}
>>
>> TASK: [rsync database backup file to database server] 
>> ************************* 
>> <45.56.89.116> ESTABLISH CONNECTION FOR USER: smith
>> <45.56.89.116> REMOTE_MODULE command rsync -vz /srv/rsync/
>> example.com/staging/last/database/example_schema_and_data.dump 
>> <45.56.89.116> EXEC ssh -C -vvv -o ControlMaster=auto -o 
>> ControlPersist=60s -o 
>> ControlPath="/home/smith/.ansible/cp/ansible-ssh-%h-%p-%r" -o 
>> StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
>> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
>> -o PasswordAuthentication=no -o ConnectTimeout=10 45.56.89.116 /bin/sh -c 
>> 'sudo -k && sudo -H -S -p "[sudo via ansible, 
>> key=asekrsupszbkgzikdiyqxqwvjazevzmq] password: " -u smith /bin/sh -c 
>> '"'"'echo BECOME-SUCCESS-asekrsupszbkgzikdiyqxqwvjazevzmq; LANG=en_US.UTF-8 
>> LC_CTYPE=en_US.UTF-8 /usr/bin/python'"'"''
>> fatal: [db02.example.com] => SSH Error: data could not be sent to the 
>> remote host. Make sure this host can be reached over ssh
>>
>> FATAL: all hosts have already failed -- aborting
>>
>> PLAY RECAP 
>> ******************************************************************** 
>>            to retry, use: --limit @/home/smith/restore_dbserver.retry
>>
>> db02.example.com     : ok=2    changed=0    unreachable=1    failed=0   
>>
>>
>> On Monday, April 3, 2017 at 1:06:08 PM UTC-7, Robert F wrote:
>>>
>>> When I run the following Ansible playbook on my backup server, 
>>> backups.example.com, I get the error shown below:
>>>
>>>     # main.yml
>>>     ---
>>>     - name: restore database
>>>       hosts: dbserver.example.com
>>>       gather_facts: false
>>>
>>>       vars:
>>>         me: smith
>>>
>>>       tasks:
>>>       - command: rsync -vz /path/to/db.dump {{ me 
>>> }}@dbserver.example.com:/tmp
>>>         become: true
>>>         become_user: "{{ me }}"
>>>
>>> Error:
>>>
>>>       fatal: [dbserver.example.com] => SSH Error: data could not be 
>>> sent to the remote host.  Make sure this host can be reached over ssh.
>>>
>>> Yet I can run the command manually from my backup server, it succeeds:
>>>
>>>     rsync -vz /path/to/db.dump [email protected]:/tmp
>>>
>>> Here are the pertinent files:
>>>
>>>     # ansible.cfg
>>>     [defaults]
>>>     inventory = inventory.ini
>>>     host_key_checking = False
>>>     ssh_args = -o UserKnownHostsFile=/dev/null
>>>     [ssh_connection]
>>>     pipelining = True
>>>
>>>     # inventory.ini
>>>     [dbservers]
>>>     dbserver.example.com ansible_ssh_host=<dbserver_ip_address> 
>>> ip_addr=<dbserver_ip_address>
>>>     [local]
>>>     localhost ansible_connection=local
>>>
>>>     # ~/.ssh/config
>>>     Host dbserver.example.com
>>>       # I know this creates a security risk but I don't know how else to 
>>> handle the "authenticity of host..." prompt when running an Ansible playbook
>>>       StrictHostKeyChecking no
>>>       User smith
>>>
>>> I've checked and there is an entry for dbserver.example.com in the 
>>> ~/.ssh/known_hosts file.  My public key is installed in the authorized_keys 
>>> file on the remote dbserver.
>>>
>>> I've researched this online and read the Ansible documents but I don't 
>>> see what I'm doing wrong.  Initially I tried using the Ansible synchronize 
>>> module but it produced the same error.  I also tried using the "-vvvv" 
>>> option with my ansible-playbook command but the output didn't yield any 
>>> useful information.  All I say was the command stop at a certain point. 
>>>  What am I missing here?
>>>
>>>

-- 
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/9b79f0ca-725a-400d-b218-e3d0a22cfc02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to