|
|
@ -49,41 +49,21 @@
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
notify: restart_containerd
|
|
|
|
notify: restart_containerd
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set control-plane-dns-endpoint towards local-ip
|
|
|
|
# todo: Move to netmaker-role as handler?
|
|
|
|
lineinfile:
|
|
|
|
- name: Gather facts to get changes
|
|
|
|
dest: /etc/hosts
|
|
|
|
ansible.builtin.gather_facts:
|
|
|
|
line: "{{ ansible_facts.default_ipv6.address }} k8s-control-plane.system.ruekov.eu"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Setting network facts..
|
|
|
|
- name: Getting nodeIp-data from interface
|
|
|
|
set_fact:
|
|
|
|
|
|
|
|
inventory_group_index: "{{ groups['kubernetes'].index(inventory_hostname) }}"
|
|
|
|
|
|
|
|
ipPool_ipv6_nodeip_cidr_only_prefix: '{{ kubernetes.ipPool.ipv6.nodeip_cidr | regex_replace ("(?<=:)[0-9a-f]{0,4}(\/[0-9]+)?$","") }}'
|
|
|
|
|
|
|
|
ipPool_ipv6_nodeip_cidr_cidr: '{{ kubernetes.ipPool.ipv6.nodeip_cidr | regex_replace ("^.*?\/","") }}'
|
|
|
|
|
|
|
|
ipPool_ipv4_nodeip_cidr_only_prefix: '{{ kubernetes.ipPool.ipv4.nodeip_cidr | regex_replace ("(?<=.)[0-9]{0,3}(\/[0-9]+)?$","") }}'
|
|
|
|
|
|
|
|
ipPool_ipv4_nodeip_cidr_cidr: '{{ kubernetes.ipPool.ipv4.nodeip_cidr | regex_replace ("^.*?\/","") }}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Setting more network_facts..
|
|
|
|
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
ipPool_ipv6_nodeip: "{{ ipPool_ipv6_nodeip_cidr_only_prefix }}{{ inventory_group_index|int +1 }}"
|
|
|
|
nodeip_ipv4: "{{ ansible_facts[ kubernetes.ipPool.nodeIp_interface ].ipv4.address }}"
|
|
|
|
ipPool_ipv4_nodeip: "{{ ipPool_ipv4_nodeip_cidr_only_prefix }}{{ inventory_group_index|int +1 }}"
|
|
|
|
nodeip_ipv6: "{{ ansible_facts[ kubernetes.ipPool.nodeIp_interface ].ipv6[0].address }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Setup IPv4-Network
|
|
|
|
- name: Set control-plane-dns-endpoint towards local-ip
|
|
|
|
lineinfile:
|
|
|
|
blockinfile:
|
|
|
|
insertafter: "iface {{ ansible_facts.default_ipv4.interface }} inet .+"
|
|
|
|
path: /etc/hosts
|
|
|
|
dest: "/etc/network/interfaces"
|
|
|
|
marker: "# {mark} ANSIBLE MANAGED BLOCK | k8s"
|
|
|
|
line: " up /usr/sbin/ip addr add {{ ipPool_ipv4_nodeip }} dev {{ ansible_facts.default_ipv4.interface }}"
|
|
|
|
block: |
|
|
|
|
register: setup_network_ipv4
|
|
|
|
{{ nodeip_ipv4 }} {{ kubernetes.control_plane.dns_name }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Setup IPv6-Network
|
|
|
|
|
|
|
|
lineinfile:
|
|
|
|
|
|
|
|
insertafter: "iface {{ ansible_facts.default_ipv4.interface }} inet6 .+"
|
|
|
|
|
|
|
|
dest: "/etc/network/interfaces"
|
|
|
|
|
|
|
|
line: " up /usr/sbin/ip -6 addr add {{ ipPool_ipv6_nodeip }} dev {{ ansible_facts.default_ipv4.interface }}"
|
|
|
|
|
|
|
|
register: setup_network_ipv6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Force-Reload network-interface
|
|
|
|
|
|
|
|
command: "ifup --force {{ ansible_facts.default_ipv4.interface }}"
|
|
|
|
|
|
|
|
when: setup_network_ipv4.changed or setup_network_ipv6.changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Run handlers to reload configurations
|
|
|
|
- name: Run handlers to reload configurations
|
|
|
|
meta: flush_handlers
|
|
|
|
meta: flush_handlers
|
|
|
|