Add Vagrantfile for local testing

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2023-11-08 13:42:11 -08:00
parent 0cd9ffc17f
commit 9ecdc933ca
10 changed files with 88 additions and 7 deletions

View File

@@ -0,0 +1,3 @@
---
k3s_server_location: "/var/lib/rancher/k3s"
systemd_dir: "/etc/systemd/system"

View File

@@ -1,4 +1,5 @@
---
- name: Copy K3s service file
ansible.builtin.template:
src: "k3s-agent.service.j2"

View File

@@ -0,0 +1,3 @@
---
k3s_server_location: "/var/lib/rancher/k3s"
systemd_dir: "/etc/systemd/system"

View File

@@ -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}"

View File

@@ -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"

View File

@@ -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")

View File

@@ -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