Add tags to allow more granular tasks filtering.
Add generator script for MD formatted tags found.
Add docs for tags how-to.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya
2016-12-08 14:36:00 +01:00
parent 710d5ae48e
commit 8cc84e132a
35 changed files with 205 additions and 10 deletions

View File

@@ -2,9 +2,13 @@
dependencies:
- role: download
file: "{{ downloads.calico_cni }}"
tags: download
- role: download
file: "{{ downloads.calico_node }}"
tags: download
- role: download
file: "{{ downloads.calicoctl }}"
tags: download
- role: download
file: "{{ downloads.hyperkube }}"
tags: download

View File

@@ -3,6 +3,7 @@
run_once: true
set_fact:
legacy_calicoctl: "{{ calicoctl_image_tag | version_compare('v1.0.0', '<') }}"
tags: facts
- name: Calico | Write Calico cni config
template:
@@ -46,6 +47,7 @@
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
tags: [hyperkube, upgrade]
- name: Calico | Copy cni plugins from calico/cni container
command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp -a /opt/cni/bin/* /cnibindir/'"
@@ -55,6 +57,7 @@
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
when: "{{ overwrite_hyperkube_cni|bool }}"
tags: [hyperkube, upgrade]
- name: Calico | wait for etcd
uri: url=https://localhost:2379/health validate_certs=no
@@ -75,6 +78,7 @@
register: calico_conf
delegate_to: "{{groups['etcd'][0]}}"
run_once: true
tags: facts
- name: Calico | Configure calico network pool
shell: >
@@ -98,6 +102,7 @@
ipip_arg: "--ipip"
when: (legacy_calicoctl and
cloud_provider is defined or ipip)
tags: facts
- name: Calico (old) | Define nat-outgoing pool argument
run_once: true
@@ -105,12 +110,14 @@
nat_arg: "--nat-outgoing"
when: (legacy_calicoctl and
nat_outgoing|default(false) and not peer_with_router|default(false))
tags: facts
- name: Calico (old) | Define calico pool task name
run_once: true
set_fact:
pool_task_name: "with options {{ ipip_arg|default('') }} {{ nat_arg|default('') }}"
when: (legacy_calicoctl and ipip_arg|default(false) or nat_arg|default(false))
tags: facts
- name: Calico (old) | Configure calico network pool {{ pool_task_name|default('') }}
command: "{{ bin_dir}}/calicoctl pool add {{ kube_pods_subnet }} {{ ipip_arg|default('') }} {{ nat_arg|default('') }}"
@@ -134,6 +141,7 @@
- set_fact:
calico_pools: "{{ calico_pools_raw.stdout | from_json }}"
run_once: true
tags: facts
- name: Calico | Check if calico pool is properly configured
fail:
@@ -142,6 +150,7 @@
when: ( calico_pools['node']['nodes'] | length > 1 ) or
( not calico_pools['node']['nodes'][0]['key'] | search(".*{{ kube_pods_subnet | ipaddr('network') }}.*") )
run_once: true
tags: facts
- name: Calico | Write /etc/network-environment
template: src=network-environment.j2 dest=/etc/network-environment

View File

@@ -2,11 +2,16 @@
dependencies:
- role: download
file: "{{ downloads.flannel }}"
tags: download
- role: download
file: "{{ downloads.calico_node }}"
tags: download
- role: download
file: "{{ downloads.calicoctl }}"
tags: download
- role: download
file: "{{ downloads.calico_cni }}"
tags: download
- role: download
file: "{{ downloads.calico_policy }}"
tags: download

View File

@@ -49,6 +49,7 @@
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
tags: [hyperkube, upgrade]
- name: Canal | Copy cni plugins from calico/cni
command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp -a /opt/cni/bin/* /cnibindir/'"
@@ -57,3 +58,4 @@
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
tags: [hyperkube, upgrade]

View File

@@ -2,3 +2,4 @@
dependencies:
- role: download
file: "{{ downloads.flannel }}"
tags: download

View File

@@ -26,6 +26,7 @@
- set_fact:
flannel_subnet: "{{ flannel_subnet_output.stdout }}"
tags: facts
- name: Flannel | Get flannel_mtu from subnet.env
shell: cat /run/flannel/subnet.env | awk -F'=' '$1 == "FLANNEL_MTU" {print $2}'
@@ -34,17 +35,21 @@
- set_fact:
flannel_mtu: "{{ flannel_mtu_output.stdout }}"
tags: facts
- set_fact:
docker_options_file: >-
{%- if ansible_os_family == "Debian" -%}/etc/default/docker{%- elif ansible_os_family == "RedHat" -%}/etc/sysconfig/docker{%- endif -%}
tags: facts
- set_fact:
docker_options_name: >-
{%- if ansible_os_family == "Debian" -%}DOCKER_OPTS{%- elif ansible_os_family == "RedHat" -%}other_args{%- endif -%}
tags: facts
- set_fact:
docker_network_options: '"--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"'
tags: facts
- name: Flannel | Remove non-systemd docker daemon network options that don't match desired line
lineinfile:
@@ -73,4 +78,4 @@
- restart docker
when: ansible_service_mgr == "systemd"
- meta: flush_handlers
- meta: flush_handlers

View File

@@ -2,9 +2,13 @@
dependencies:
- role: network_plugin/calico
when: kube_network_plugin == 'calico'
tags: calico
- role: network_plugin/flannel
when: kube_network_plugin == 'flannel'
tags: flannel
- role: network_plugin/weave
when: kube_network_plugin == 'weave'
tags: weave
- role: network_plugin/canal
when: kube_network_plugin == 'canal'
tags: canal

View File

@@ -2,3 +2,4 @@
dependencies:
- role: download
file: "{{ downloads.weave }}"
tags: download

View File

@@ -6,6 +6,7 @@
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
tags: [hyperkube, upgrade]
- name: Weave | Install weave
command: rsync -piu "{{ local_release_dir }}/weave/bin/weave" "{{ bin_dir }}/weave"