2019-09-29 00:19:18 +02:00
|
|
|
---
|
|
|
|
- name: Set SELinux to disabled state
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.posix.selinux:
|
2019-09-29 00:19:18 +02:00
|
|
|
state: disabled
|
2023-11-07 18:54:32 +01:00
|
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
2019-09-29 00:19:18 +02:00
|
|
|
|
2019-10-28 04:34:34 +01:00
|
|
|
- name: Enable IPv4 forwarding
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.posix.sysctl:
|
2019-09-29 00:19:18 +02:00
|
|
|
name: net.ipv4.ip_forward
|
|
|
|
value: "1"
|
|
|
|
state: present
|
2023-01-30 19:46:09 +01:00
|
|
|
reload: true
|
2019-09-29 00:19:18 +02:00
|
|
|
|
2019-10-28 04:34:34 +01:00
|
|
|
- name: Enable IPv6 forwarding
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.posix.sysctl:
|
2019-09-29 00:19:18 +02:00
|
|
|
name: net.ipv6.conf.all.forwarding
|
|
|
|
value: "1"
|
|
|
|
state: present
|
2023-01-30 19:46:09 +01:00
|
|
|
reload: true
|
2021-07-10 14:49:21 +02:00
|
|
|
when: ansible_all_ipv6_addresses
|
2019-09-29 00:19:18 +02:00
|
|
|
|
2020-04-29 22:28:36 +02:00
|
|
|
- name: Add br_netfilter to /etc/modules-load.d/
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.builtin.copy:
|
2020-04-29 22:28:36 +02:00
|
|
|
content: "br_netfilter"
|
|
|
|
dest: /etc/modules-load.d/br_netfilter.conf
|
2020-09-22 20:08:35 +02:00
|
|
|
mode: "u=rw,g=,o="
|
2023-11-08 19:31:51 +01:00
|
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux', 'RedHat', 'Archlinux']
|
2020-04-29 22:28:36 +02:00
|
|
|
|
|
|
|
- name: Load br_netfilter
|
2023-11-07 22:35:08 +01:00
|
|
|
community.general.modprobe:
|
2020-04-29 22:28:36 +02:00
|
|
|
name: br_netfilter
|
|
|
|
state: present
|
2023-11-08 19:31:51 +01:00
|
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux', 'RedHat', 'Archlinux']
|
2020-04-29 22:28:36 +02:00
|
|
|
|
2019-10-28 04:34:34 +01:00
|
|
|
- name: Set bridge-nf-call-iptables (just to be sure)
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.posix.sysctl:
|
2020-07-14 17:14:20 +02:00
|
|
|
name: "{{ item }}"
|
2019-09-29 00:19:18 +02:00
|
|
|
value: "1"
|
|
|
|
state: present
|
2023-01-30 19:46:09 +01:00
|
|
|
reload: true
|
2023-11-08 19:31:51 +01:00
|
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux', 'RedHat', 'Archlinux']
|
2020-05-12 22:25:01 +02:00
|
|
|
loop:
|
|
|
|
- net.bridge.bridge-nf-call-iptables
|
|
|
|
- net.bridge.bridge-nf-call-ip6tables
|
2020-04-29 22:28:36 +02:00
|
|
|
|
|
|
|
- name: Add /usr/local/bin to sudo secure_path
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2020-04-29 22:28:36 +02:00
|
|
|
line: 'Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin'
|
|
|
|
regexp: "Defaults(\\s)*secure_path(\\s)*="
|
|
|
|
state: present
|
|
|
|
insertafter: EOF
|
|
|
|
path: /etc/sudoers
|
|
|
|
validate: 'visudo -cf %s'
|
2023-11-07 18:54:32 +01:00
|
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
2023-02-02 18:57:02 +01:00
|
|
|
|
|
|
|
- name: Make k3s directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "/var/lib/rancher"
|
|
|
|
mode: 0755
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Create symlink
|
|
|
|
ansible.builtin.file:
|
|
|
|
dest: /var/lib/rancher/k3s
|
|
|
|
src: "{{ k3s_server_location }}"
|
|
|
|
force: true
|
|
|
|
state: link
|
|
|
|
when: k3s_server_location != "/var/lib/rancher/k3s"
|