Created
November 28, 2021 20:35
-
-
Save nicenemo/d596f113e431d4a459ee50dae602dc1a to your computer and use it in GitHub Desktop.
Customize a Raspberry pi image for K3S use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ansible-playbook | |
--- | |
- name: Configure Raspberry Pi image. | |
hosts: localhost | |
become: false | |
connection: local | |
vars: | |
mount_point: /mnt/d | |
cmd_line_path: "{{ mount_point }}/cmdline.txt" | |
ssh_txt: "{{ mount_point }}/ssh.txt" | |
cmd_line_parameters: 'cgroup_memory=1 cgroup_enable=memory ' | |
tasks: | |
- name: Configure cgroup boot parameters in cmdline.txt for k3s usage. | |
# ensure that the changed line no longer matches so that multiple runs have no effect | |
replace: | |
path: "{{ cmd_line_path }}" | |
regexp: 'quiet init=' | |
replace: "quiet {{ cmd_line_parameters }} init=" | |
backup: yes | |
- name: Enable ssh service. | |
# use copy module because file with touch will also touch the file if it is already present | |
copy: | |
content: '' | |
dest: "{{ ssh_txt }}" | |
force: no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment