Files
Kapisi/roles/Geth/tasks/general.yml
T

41 lines
1.1 KiB
YAML

---
- name: Copy install script
become: yes
ansible.builtin.copy:
src: get-k3s.sh
dest: /usr/local/sbin/get-k3s.sh
owner: root
group: root
mode: 0750
- name: Ensure cgroup
become: yes
register: cgroup_changed
ignore_errors: true
ansible.builtin.command:
cmd: /bin/bash -c "grep 'cgroup_memory=1 cgroup_enable=memory' /boot/firmware/cmdline.txt || (sed -i 's/$/ cgroup_memory=1 cgroup_enable=memory/' /boot/firmware/cmdline.txt && /bin/false)"
- name: Disable swap
become: yes
register: swap_changed
ansible.builtin.lineinfile:
path: /etc/rpi/swap.conf
regex: 'Mechanism='
line: 'Mechanism=none'
- name: Reboot if there was a change.
become: yes
ansible.builtin.command: "/usr/sbin/reboot"
async: 1
poll: 0
when: cgroup_changed is failed or swap_changed is changed
- name: Wait for the reboot to complete if there was a change.
wait_for_connection:
connect_timeout: 20
sleep: 5
delay: 5
timeout: 300
when: cgroup_changed is failed or swap_changed is changed