Skip to content

Instantly share code, notes, and snippets.

@danehans
Last active February 24, 2016 23:34
Show Gist options
  • Save danehans/e9b3012cb54be72162de to your computer and use it in GitHub Desktop.
Save danehans/e9b3012cb54be72162de to your computer and use it in GitHub Desktop.
ansible kube conditional download
TASK: [flannel | Determine if Flannel extracted tar binaries exist] ***********
ok: [172.22.111.163] => (item=flanneld)
ok: [172.22.111.163] => (item=mk-docker-opts.sh)
TASK: [flannel | Extract tar file] ********************************************
skipping: [172.22.111.163] => (item=flanneld)
skipping: [172.22.111.163] => (item=mk-docker-opts.sh)
TASK: [flannel | debug var=fb] ************************************************
ok: [172.22.111.163] => {
"var": {
"fb": {
"changed": false,
"msg": "All items completed",
"results": [
{
"changed": false,
"invocation": {
"module_args": "path=/opt/flannel-0.5.5/flanneld",
"module_complex_args": {},
"module_name": "stat"
},
"item": "flanneld",
"stat": {
"exists": false
}
},
{
"changed": false,
"invocation": {
"module_args": "path=/opt/flannel-0.5.5/mk-docker-opts.sh",
"module_complex_args": {},
"module_name": "stat"
},
"item": "mk-docker-opts.sh",
"stat": {
"exists": false
}
}
]
}
}
}
....
TASK: [flannel | Start flannel] ***********************************************
failed: [172.22.111.163] => {"failed": true}
msg: Job for flanneld.service failed because the control process exited with error code. See "systemctl status flanneld.service" and "journalctl -xe" for details.
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/cluster.retry
172.22.111.163 : ok=76 changed=1 unreachable=0 failed=1
- name: Determine if Flannel extracted tar binaries exist
stat: path={{ bin_path }}/flannel-{{ flannel_version }}/{{ item }}
register: fb
changed_when: false
always_run: yes
with_items:
- flanneld
- mk-docker-opts.sh
- name: Extract tar file
unarchive:
src: "{{ ansible_temp_dir }}/flannel-{{ flannel_version }}-linux-amd64.tar.gz"
dest: "{{ bin_path }}"
copy: no
when: not "fb.{{ item }}.stat.exists"
with_items:
- flanneld
- mk-docker-opts.sh
- debug: var=fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment