review local tasks

This commit is contained in:
Smaine Kahlouch 2015-12-31 10:28:47 +01:00
parent 92c2a9457e
commit 98fe2c02b2
3 changed files with 3 additions and 10 deletions

View file

@ -1,5 +1,5 @@
[downloader] [downloader]
node1 ansible_ssh_host=10.99.0.26 node1 ansible_ssh_host=10.99.0.26 ansible_connection=local
[kube-master] [kube-master]
node1 ansible_ssh_host=10.99.0.26 node1 ansible_ssh_host=10.99.0.26

View file

@ -4,13 +4,11 @@
path={{ local_release_dir }}/calico/bin path={{ local_release_dir }}/calico/bin
recurse=yes recurse=yes
state=directory state=directory
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Check if calicoctl has been downloaded - name: Check if calicoctl has been downloaded
local_action: stat local_action: stat
path={{ local_release_dir }}/calico/bin/calicoctl path={{ local_release_dir }}/calico/bin/calicoctl
register: c_tar register: c_tar
delegate_to: "{{ groups['kube-master'][0] }}"
# issues with get_url module and redirects, to be tested again in the near future # issues with get_url module and redirects, to be tested again in the near future
- name: Download calico - name: Download calico
@ -18,7 +16,6 @@
curl -o {{ local_release_dir }}/calico/bin/calicoctl -Ls {{ calico_download_url }}/{{ calico_version }}/calicoctl curl -o {{ local_release_dir }}/calico/bin/calicoctl -Ls {{ calico_download_url }}/{{ calico_version }}/calicoctl
when: not c_tar.stat.exists when: not c_tar.stat.exists
register: dl_calico register: dl_calico
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Download calico-kubernetes-plugin - name: Download calico-kubernetes-plugin
@ -31,13 +28,11 @@
path={{ local_release_dir }}/flannel path={{ local_release_dir }}/flannel
recurse=yes recurse=yes
state=directory state=directory
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Check if flannel release archive has been downloaded - name: Check if flannel release archive has been downloaded
local_action: stat local_action: stat
path={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz path={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz
register: f_tar register: f_tar
delegate_to: "{{ groups['kube-master'][0] }}"
# issues with get_url module and redirects, to be tested again in the near future # issues with get_url module and redirects, to be tested again in the near future
- name: Download flannel - name: Download flannel
@ -45,14 +40,12 @@
curl -o {{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz -Ls {{ flannel_download_url }}/v{{ flannel_version }}/flannel-{{ flannel_version }}-linux-amd64.tar.gz curl -o {{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz -Ls {{ flannel_download_url }}/v{{ flannel_version }}/flannel-{{ flannel_version }}-linux-amd64.tar.gz
when: not f_tar.stat.exists when: not f_tar.stat.exists
register: dl_flannel register: dl_flannel
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Extract flannel archive - name: Extract flannel archive
local_action: unarchive local_action: unarchive
src={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz src={{ local_release_dir }}/flannel/flannel-{{ flannel_version }}-linux-amd64.tar.gz
dest={{ local_release_dir }}/flannel copy=no dest={{ local_release_dir }}/flannel copy=no
when: dl_flannel|changed when: dl_flannel|changed
delegate_to: "{{ groups['kube-master'][0] }}"
- name: Pick up only flannel binaries - name: Pick up only flannel binaries
local_action: copy local_action: copy

View file

@ -1,7 +1,7 @@
--- ---
- include: download.yml - include: download.yml
delegate_to: localhost run_once: true
when: inventory_hostname == "{{ groups['kube-master'][0] }}" delegate_to: "{{ groups['downloader'][0] }}"
- name: "Identify init system" - name: "Identify init system"
shell: > shell: >