2017-08-24 17:09:52 +08:00
|
|
|
---
|
2017-09-10 04:38:38 +08:00
|
|
|
|
|
|
|
- name: Kubernetes Apps | Check if netchecker-server manifest already exists
|
|
|
|
stat:
|
2018-08-09 17:29:45 +08:00
|
|
|
path: "{{ kube_config_dir }}/netchecker-server-deployment.yml"
|
2017-09-10 04:38:38 +08:00
|
|
|
register: netchecker_server_manifest
|
2017-10-05 15:43:04 +08:00
|
|
|
tags:
|
|
|
|
- facts
|
|
|
|
- upgrade
|
2017-09-10 04:38:38 +08:00
|
|
|
|
|
|
|
- name: Kubernetes Apps | Apply netchecker-server manifest to update annotations
|
|
|
|
kube:
|
|
|
|
name: "netchecker-server"
|
|
|
|
namespace: "{{ netcheck_namespace }}"
|
2017-09-15 20:19:37 +08:00
|
|
|
filename: "{{ netchecker_server_manifest.stat.path }}"
|
2017-09-10 04:38:38 +08:00
|
|
|
kubectl: "{{bin_dir}}/kubectl"
|
|
|
|
resource: "deploy"
|
|
|
|
state: latest
|
|
|
|
when: inventory_hostname == groups['kube-master'][0] and netchecker_server_manifest.stat.exists
|
2017-10-05 15:43:04 +08:00
|
|
|
tags:
|
|
|
|
- upgrade
|
2017-09-10 04:38:38 +08:00
|
|
|
|
2018-08-23 00:16:13 +08:00
|
|
|
- name: Kubernetes Apps | Netchecker Templates list
|
|
|
|
set_fact:
|
|
|
|
netchecker_templates:
|
2018-11-15 01:27:45 +08:00
|
|
|
- {file: netchecker-ns.yml, type: ns, name: netchecker-namespace}
|
2018-08-23 00:16:13 +08:00
|
|
|
- {file: netchecker-agent-sa.yml, type: sa, name: netchecker-agent}
|
|
|
|
- {file: netchecker-agent-ds.yml, type: ds, name: netchecker-agent}
|
|
|
|
- {file: netchecker-agent-hostnet-ds.yml, type: ds, name: netchecker-agent-hostnet}
|
|
|
|
- {file: netchecker-server-sa.yml, type: sa, name: netchecker-server}
|
|
|
|
- {file: netchecker-server-clusterrole.yml, type: clusterrole, name: netchecker-server}
|
|
|
|
- {file: netchecker-server-clusterrolebinding.yml, type: clusterrolebinding, name: netchecker-server}
|
|
|
|
- {file: netchecker-server-deployment.yml, type: deployment, name: netchecker-server}
|
|
|
|
- {file: netchecker-server-svc.yml, type: svc, name: netchecker-service}
|
|
|
|
netchecker_templates_for_psp:
|
|
|
|
- {file: netchecker-agent-hostnet-psp.yml, type: podsecuritypolicy, name: netchecker-agent-hostnet-policy}
|
|
|
|
- {file: netchecker-agent-hostnet-clusterrole.yml, type: clusterrole, name: netchecker-agent}
|
|
|
|
- {file: netchecker-agent-hostnet-clusterrolebinding.yml, type: clusterrolebinding, name: netchecker-agent}
|
|
|
|
|
|
|
|
- name: Kubernetes Apps | Append extra templates to Netchecker Templates list for PodSecurityPolicy
|
|
|
|
set_fact:
|
|
|
|
netchecker_templates: "{{ netchecker_templates_for_psp + netchecker_templates}}"
|
|
|
|
when: podsecuritypolicy_enabled
|
|
|
|
|
2016-09-30 23:23:47 +08:00
|
|
|
- name: Kubernetes Apps | Lay Down Netchecker Template
|
2017-02-18 05:22:34 +08:00
|
|
|
template:
|
2018-08-09 17:29:45 +08:00
|
|
|
src: "{{item.file}}.j2"
|
2017-02-18 05:22:34 +08:00
|
|
|
dest: "{{kube_config_dir}}/{{item.file}}"
|
2018-08-23 00:16:13 +08:00
|
|
|
with_items: "{{ netchecker_templates }}"
|
2016-09-30 23:23:47 +08:00
|
|
|
register: manifests
|
2017-07-17 19:28:09 +08:00
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
2016-09-30 23:23:47 +08:00
|
|
|
|
2017-08-18 20:46:22 +08:00
|
|
|
- name: Kubernetes Apps | Purge old Netchecker server
|
|
|
|
kube:
|
|
|
|
name: "netchecker-server"
|
|
|
|
namespace: "{{ netcheck_namespace }}"
|
|
|
|
kubectl: "{{bin_dir}}/kubectl"
|
|
|
|
resource: "po"
|
|
|
|
state: absent
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
2016-09-30 23:23:47 +08:00
|
|
|
- name: Kubernetes Apps | Start Netchecker Resources
|
|
|
|
kube:
|
|
|
|
namespace: "{{netcheck_namespace}}"
|
|
|
|
kubectl: "{{bin_dir}}/kubectl"
|
2019-04-23 14:34:10 +08:00
|
|
|
filename: "{{ manifests.results | selectattr('skipped', 'undefined') | map(attribute='item') | map(attribute='file') | map('regex_replace', '^(.*)$', kube_config_dir+'/\\1') | list }}"
|
2017-09-05 13:23:12 +08:00
|
|
|
state: "latest"
|
2019-04-23 14:34:10 +08:00
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|