mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2026-03-09 12:02:11 +01:00
Add Vagrantfile for local testing
Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
3
roles/k3s/agent/defaults/main.yml
Normal file
3
roles/k3s/agent/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
k3s_server_location: "/var/lib/rancher/k3s"
|
||||
systemd_dir: "/etc/systemd/system"
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
|
||||
- name: Copy K3s service file
|
||||
ansible.builtin.template:
|
||||
src: "k3s-agent.service.j2"
|
||||
|
||||
3
roles/k3s/server/defaults/main.yml
Normal file
3
roles/k3s/server/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
k3s_server_location: "/var/lib/rancher/k3s"
|
||||
systemd_dir: "/etc/systemd/system"
|
||||
@@ -87,6 +87,7 @@
|
||||
when: ansible_hostname != groups['server'][0]
|
||||
|
||||
- name: Verify that all server nodes joined
|
||||
when: (groups['server'] | length) > 1
|
||||
ansible.builtin.command:
|
||||
cmd: >
|
||||
k3s kubectl get nodes -l "node-role.kubernetes.io/control-plane=true" -o=jsonpath="{.items[*].metadata.name}"
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
state: disabled
|
||||
when: ansible_distribution in ['CentOS', 'Red Hat Enterprise Linux','RedHat']
|
||||
|
||||
- name: Install Dependent Ubuntu Packages
|
||||
when: ansible_distribution in ['Ubuntu']
|
||||
ansible.builtin.apt:
|
||||
name: policycoreutils # Used by install script to restore SELinux context
|
||||
update_cache: yes
|
||||
|
||||
- name: Enable IPv4 forwarding
|
||||
ansible.posix.sysctl:
|
||||
name: net.ipv4.ip_forward
|
||||
@@ -65,4 +71,6 @@
|
||||
src: "{{ k3s_server_location }}"
|
||||
force: true
|
||||
state: link
|
||||
when: k3s_server_location != "/var/lib/rancher/k3s"
|
||||
when:
|
||||
- k3s_server_location is defined
|
||||
- k3s_server_location != "/var/lib/rancher/k3s"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
ansible_facts.lsb.description|default("") is match("Debian") )
|
||||
|
||||
- name: Set detected_distribution to ArchLinux (ARM64)
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
detected_distribution: Archlinux
|
||||
when:
|
||||
- ansible_facts.architecture is search("aarch64")
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
---
|
||||
- name: Enable cgroup via boot commandline if not already enabled for Archlinux
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /boot/boot.txt
|
||||
search_string: setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"
|
||||
line: setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}" cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
|
||||
register: kernel_cmdline_cgroup
|
||||
|
||||
- name: Create
|
||||
shell: ./mkscr
|
||||
ansible.builtin.command: ./mkscr
|
||||
args:
|
||||
chdir: /boot
|
||||
notify: reboot
|
||||
when: kernel_cmdline_cgroup.changed
|
||||
changed_when: false
|
||||
when: kernel_cmdline_cgroup.changed # noqa: no-handler
|
||||
|
||||
Reference in New Issue
Block a user