Well you could use ansible blocks to retry if the first attemp fails

http://docs.ansible.com/ansible/playbooks_blocks.html

I would be tempted to change things around somewhat and spin up an ansible 
instance 'near' the other machines you want to manage (i.e. same 
datacenter/cloud/network - you get the idea), then you reduce likelihood of 
timeouts in the first place.

Hope this helps,

Jon

On Friday, January 27, 2017 at 7:37:51 PM UTC, Robert F wrote:
>
> I have a task in my Ansible playbook that uses the git module to clone my 
> Git repository which is hosted on bitbucket.com to my Linode-hosted web 
> server.  The playbook is run from my local laptop.  My problem is that this 
> task seems to timeout quit frequently.  When it does, I'll get the 
> following error:
>
>     fatal: [web02.example.com]: FAILED! => {... "msg": "Cloning into 
> '/srv/http/example.com/repo'...\nHost key verification failed.\r\nfatal: 
> Could not read from remote repository.\\n\nPlease make sure you have the 
> correct access rights\nand the repository exists", "rc" 128,...}
>
> I'm pretty certain this is a timeout error because I haven't changed my 
> SSH keys, the access rights are correct, and the repository does exist. 
>  Furthermore, if I run the entire playbook again it will sometimes succeed 
> and other times I'll have to re-run it a couple of times before it succeeds.
>
> Here's the task:
>     # webservers.yml
>     - name: check out dev version of django project repo
>       git: >
>         repo={{ repo_url }}
>         version=dev
>         dest={{ repo_path }}
>         accept_hostkey=yes
>       become: true
>       become_user: "{{ me }}"
>
> Here's my config file:
>     # ansible.cfg
>     [defaults]
>     inventory = inventories/development
>     remote_user = smith
>     roles_path = $HOME/playbooks/roles:$HOME/playbooks/community/roles
>     vault_password_file = vault_pass
>     retry_files_enabled = False
>     retry_files_save_path = "/tmp"
>     host_key_checking = False
>
>     # Try to prevent git clone from timing out
>     ssh_args = -o ControlPersist=360s
>
>     [ssh_connection]
>     pipelining = True
>
> I read that setting ssh_args as shown above might prevent this problem but 
> it doesn't seem to help.  Is there something else I can do to prevent these 
> timeouts so that I don't have to keep re-running my playbook to get my repo 
> cloned?  Thanks.
>
>

-- 
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/e85a0016-db1a-4587-b8b4-2293837039e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to