61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
#- name: Load br_netfilter kernel-module
|
|
# modprobe:
|
|
# name: br_netfilter
|
|
# state: present
|
|
|
|
- name: Set sysctl settings for iptables bridged traffic
|
|
copy:
|
|
dest: "/etc/sysctl.d/kubernetes.conf"
|
|
content: |
|
|
net.bridge.bridge-nf-call-ip6tables = 1
|
|
net.bridge.bridge-nf-call-iptables = 1
|
|
|
|
net.ipv4.conf.all.forwarding=1
|
|
net.ipv6.conf.all.forwarding=1
|
|
notify: reload_sysctl
|
|
|
|
#- name: Disable swap
|
|
# command: swapoff -a
|
|
|
|
- name: Install required packages
|
|
package:
|
|
name:
|
|
#- containerd
|
|
#- iptables
|
|
# For Longhorn:
|
|
- nfs-common
|
|
- open-iscsi
|
|
state: present
|
|
|
|
- import_tasks: ./prerequisites/containerd.yml
|
|
|
|
- name: Gather interface-name
|
|
set_fact:
|
|
interface: "{{ kubernetes.ipPool.nodeIp_interface | replace('-', '_') }}"
|
|
|
|
- name: Getting nodeIp-data from interface
|
|
set_fact:
|
|
nodeip_ipv4: >-
|
|
{{ (ansible_facts[interface].ipv4.address)
|
|
if (ansible_facts is defined and ansible_facts.get(interface) is defined and ansible_facts[interface].ipv4 is defined)
|
|
else (ansible_default_ipv4.address | default('')) }}
|
|
nodeip_ipv6: >-
|
|
{{ (ansible_facts[interface].ipv6[0].address)
|
|
if (ansible_facts is defined and ansible_facts.get(interface) is defined and ansible_facts[interface].ipv6 is defined and (ansible_facts[interface].ipv6 | length) > 0)
|
|
else (ansible_default_ipv6.address | default('')) }}
|
|
|
|
- block:
|
|
- name: Read resolv.conf
|
|
shell: "grep '^nameserver' /etc/resolv.conf"
|
|
register: nameserver_line
|
|
changed_when: false
|
|
|
|
- name: Write /etc/resolv-k3s.conf with only nameservers
|
|
copy:
|
|
content: "{{ nameserver_line.stdout }}"
|
|
dest: /etc/resolv-k3s.conf
|
|
when: kubernetes.network.clean_resolv_conf is true
|
|
|
|
- name: Run handlers to reload configurations
|
|
meta: flush_handlers
|