2018-10-16 14:15:05 +00:00
|
|
|
---
|
2018-10-21 07:35:52 +00:00
|
|
|
- name: kube-router | Create annotations
|
|
|
|
include: annotate.yml
|
|
|
|
tags: annotate
|
2018-10-16 14:15:05 +00:00
|
|
|
|
2020-03-04 10:11:47 +00:00
|
|
|
- name: kube-router | Create config directory
|
|
|
|
file:
|
|
|
|
path: /var/lib/kube-router
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
recurse: true
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: kube-router | Create kubeconfig
|
|
|
|
template:
|
|
|
|
src: kubeconfig.yml.j2
|
|
|
|
dest: /var/lib/kube-router/kubeconfig
|
2022-01-09 09:51:12 +00:00
|
|
|
mode: 0644
|
2020-03-04 10:11:47 +00:00
|
|
|
owner: kube
|
|
|
|
notify:
|
|
|
|
- reset_kube_router
|
|
|
|
|
|
|
|
- name: kube-router | Slurp cni config
|
|
|
|
slurp:
|
2020-03-17 09:40:21 +00:00
|
|
|
src: /etc/cni/net.d/10-kuberouter.conflist
|
2020-03-04 10:11:47 +00:00
|
|
|
register: cni_config_slurp
|
2021-07-12 07:00:47 +00:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2020-03-04 10:11:47 +00:00
|
|
|
|
|
|
|
- name: kube-router | Set cni_config variable
|
|
|
|
set_fact:
|
|
|
|
cni_config: "{{ cni_config_slurp.content | b64decode | from_json }}"
|
|
|
|
when:
|
|
|
|
- not cni_config_slurp.failed
|
|
|
|
|
|
|
|
- name: kube-router | Set host_subnet variable
|
|
|
|
set_fact:
|
2020-03-17 09:40:21 +00:00
|
|
|
host_subnet: "{{ cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | first }}"
|
2020-03-04 10:11:47 +00:00
|
|
|
when:
|
|
|
|
- cni_config is defined
|
2020-03-17 09:40:21 +00:00
|
|
|
- cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | length > 0
|
2020-03-04 10:11:47 +00:00
|
|
|
|
|
|
|
- name: kube-router | Create cni config
|
2020-03-17 09:40:21 +00:00
|
|
|
template:
|
|
|
|
src: cni-conf.json.j2
|
|
|
|
dest: /etc/cni/net.d/10-kuberouter.conflist
|
2022-01-09 09:51:12 +00:00
|
|
|
mode: 0644
|
2020-03-04 10:11:47 +00:00
|
|
|
owner: kube
|
|
|
|
notify:
|
|
|
|
- reset_kube_router
|
|
|
|
|
2020-03-17 09:40:21 +00:00
|
|
|
- name: kube-router | Delete old configuration
|
|
|
|
file:
|
|
|
|
path: /etc/cni/net.d/10-kuberouter.conf
|
|
|
|
state: absent
|
|
|
|
|
2018-10-16 14:15:05 +00:00
|
|
|
- name: kube-router | Create manifest
|
|
|
|
template:
|
|
|
|
src: kube-router.yml.j2
|
2018-12-03 10:22:17 +00:00
|
|
|
dest: "{{ kube_config_dir }}/kube-router.yml"
|
2022-01-09 09:51:12 +00:00
|
|
|
mode: 0644
|
2021-03-24 00:26:05 +00:00
|
|
|
delegate_to: "{{ groups['kube_control_plane'] | first }}"
|
2020-03-04 10:11:47 +00:00
|
|
|
run_once: true
|