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/99b22d26-bf87-4cd8-9821-c694549f6a8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to