Nevermind, I found my own error for rescue just put command: 
ansible-playbook ###.yml

Not sure what I was thinking.

On Monday, March 20, 2017 at 6:43:36 AM UTC-5, Mike C wrote:
>
> Hi all,
>
> im having trouble with the block/rescue functionality.
>
> Here is my code:
>
> ```
>     - block:
>       - name: wget consul from artifactory
>         get_url:
>           url: '{{ consul_url }}'
>           checksum: 'sha256:{{ consul_sha256 }}'
>           dest: '{{ consul_home }}'
>           timeout: 5
>         register: downloaded_consul
>       rescue:
>         - name: wget consul to localhost
>           get_url:
>             url: '{{ consul_url }}'
>             checksum: 'sha256:{{ consul_sha256 }}'
>             dest: ./
>           register: wget_local
>           run_once: true
>           delegate_to: localhost
>           become: false
>
>         - name: copy zip file over
>           copy:
>             src: '{{ wget_local.dest }}'
>             dest: '{{ consul_home }}/'
>           register: copied_consul
>       tags:
>         - upgrade
>
>     - name: Extract consul executable files
>       unarchive:
>         src:  '{{ item.src }}'
>         dest: '{{ item.dest }}'
>         copy: false
>       with_items:
>         - src: '{{ consul_home }}/consul_{{ consul_version 
> }}_linux_amd64.zip'
>           dest: '{{ consul_home }}'
>       when: (downloaded_consul|default({}))|changed or 
> (copied_consul|default({}))|changed
>       register: consul_unarchive
>       tags:
>         - upgrade
> ```
>
> so what i expect to happen is that if for some reason `wget consul from 
> artifactory` does not complete for some hosts, it will execute the rescue 
> block and download it locally and then upload it to the server.
> If i run that playbook, im getting:
>
> ```
> TASK [consul : wget consul from artifactory] 
> ***********************************
> fatal: [server2]: FAILED! => {"changed": false, "failed": true, "msg": 
> "failed to create temporary content file: timed out"}
> fatal: [client1]: FAILED! => {"changed": false, "failed": true, "msg": 
> "failed to create temporary content file: timed out"}
> changed: [server1]
> changed: [server3]
>
> TASK [consul : Extract consul executable files] 
> ********************************
> changed: [server1] => (item={u'dest': u'/var/lib/consul', u'src': 
> u'/var/lib/consul/consul_0.7.3_linux_amd64.zip'})
> ok: [server2 -> localhost]
> ```
>
> which completely skips the rescue block after `wget consul from 
> artifactory` fails.
>
> Any ideas on whats happening here ? Am i using block/rescue wrong ?
>
> Cheers
>
> ```
> ansible --version
> ansible 2.2.0.0
>   configured module search path = Default w/o overrides
> ```
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f370e2e9-3408-4f21-a33e-87cb24a4a8c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to