mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2024-09-29 04:07:30 +02:00
8484c015d6
- K3s has some absolute paths set in various places which cannot be changed. Using a symbolic link was the easiest fix. This is nice for running K3S on SBC that must boot to SD but K3S data should be stored on a faster drive. - Other changes are for making the site playbook replayable without resetting the cluster. Ideally you can rerun it to check existing nodes or to add new ones. Signed-off-by: Derek Nola <derek.nola@suse.com>
69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
---
|
|
- name: Set SELinux to disabled state
|
|
ansible.posix.selinux:
|
|
state: disabled
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
|
|
|
- name: Enable IPv4 forwarding
|
|
ansible.posix.sysctl:
|
|
name: net.ipv4.ip_forward
|
|
value: "1"
|
|
state: present
|
|
reload: true
|
|
|
|
- name: Enable IPv6 forwarding
|
|
ansible.posix.sysctl:
|
|
name: net.ipv6.conf.all.forwarding
|
|
value: "1"
|
|
state: present
|
|
reload: true
|
|
when: ansible_all_ipv6_addresses
|
|
|
|
- name: Add br_netfilter to /etc/modules-load.d/
|
|
ansible.builtin.copy:
|
|
content: "br_netfilter"
|
|
dest: /etc/modules-load.d/br_netfilter.conf
|
|
mode: "u=rw,g=,o="
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
|
|
|
- name: Load br_netfilter
|
|
community.general.modprobe:
|
|
name: br_netfilter
|
|
state: present
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
|
|
|
- name: Set bridge-nf-call-iptables (just to be sure)
|
|
ansible.posix.sysctl:
|
|
name: "{{ item }}"
|
|
value: "1"
|
|
state: present
|
|
reload: true
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
|
loop:
|
|
- net.bridge.bridge-nf-call-iptables
|
|
- net.bridge.bridge-nf-call-ip6tables
|
|
|
|
- name: Add /usr/local/bin to sudo secure_path
|
|
ansible.builtin.lineinfile:
|
|
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'
|
|
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
|
|
|
- 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"
|