2017-08-24 09:09:52 +00:00
|
|
|
---
|
2022-05-19 17:49:21 +00:00
|
|
|
- name: Kubernetes Apps | Check AppArmor status
|
|
|
|
command: which apparmor_parser
|
|
|
|
register: apparmor_status
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- name: Kubernetes Apps | Set apparmor_enabled
|
|
|
|
set_fact:
|
|
|
|
apparmor_enabled: "{{ apparmor_status.rc == 0 }}"
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
|
|
|
|
2018-08-22 16:16:13 +00:00
|
|
|
- name: Kubernetes Apps | Netchecker Templates list
|
|
|
|
set_fact:
|
|
|
|
netchecker_templates:
|
2018-11-14 17:27:45 +00:00
|
|
|
- {file: netchecker-ns.yml, type: ns, name: netchecker-namespace}
|
2018-08-22 16:16:13 +00: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:
|
2019-05-02 21:24:21 +00:00
|
|
|
netchecker_templates: "{{ netchecker_templates_for_psp + netchecker_templates }}"
|
2018-08-22 16:16:13 +00:00
|
|
|
when: podsecuritypolicy_enabled
|
|
|
|
|
2016-09-30 15:23:47 +00:00
|
|
|
- name: Kubernetes Apps | Lay Down Netchecker Template
|
2017-02-17 21:22:34 +00:00
|
|
|
template:
|
2019-05-02 21:24:21 +00:00
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
2022-01-09 09:51:12 +00:00
|
|
|
mode: 0644
|
2018-08-22 16:16:13 +00:00
|
|
|
with_items: "{{ netchecker_templates }}"
|
2016-09-30 15:23:47 +00:00
|
|
|
register: manifests
|
2017-07-17 11:28:09 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2016-09-30 15:23:47 +00:00
|
|
|
|
|
|
|
- name: Kubernetes Apps | Start Netchecker Resources
|
|
|
|
kube:
|
2019-05-02 21:24:21 +00:00
|
|
|
name: "{{ item.item.name }}"
|
|
|
|
namespace: "{{ netcheck_namespace }}"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
|
2017-09-05 05:23:12 +00:00
|
|
|
state: "latest"
|
2019-04-23 17:37:23 +00:00
|
|
|
with_items: "{{ manifests.results }}"
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0] and not item is skipped
|