diff options
| author | alex <alex@pdp7.net> | 2026-05-15 14:21:40 +0200 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2026-05-15 14:21:40 +0200 |
| commit | 99755b5231da7d40b51c9f94c1743682b4a02f33 (patch) | |
| tree | 8ed7d30d0451ed5b66f28cc111e326a05c461814 | |
| parent | 2ef31ec7e0d394c8007571dc7ccf92e4b51d4c82 (diff) | |
Add Raspbian cloud-init stuffmaster
| -rw-r--r-- | personal_infra/.gitignore | 1 | ||||
| -rw-r--r-- | personal_infra/playbooks/pis.yaml | 59 |
2 files changed, 60 insertions, 0 deletions
diff --git a/personal_infra/.gitignore b/personal_infra/.gitignore new file mode 100644 index 00000000..e137d57f --- /dev/null +++ b/personal_infra/.gitignore @@ -0,0 +1 @@ +pi-data diff --git a/personal_infra/playbooks/pis.yaml b/personal_infra/playbooks/pis.yaml new file mode 100644 index 00000000..2c688772 --- /dev/null +++ b/personal_infra/playbooks/pis.yaml @@ -0,0 +1,59 @@ +--- +- hosts: pis + gather_facts: false + tasks: + - name: hash passwords + command: mkpasswd -s + register: hashed_password + delegate_to: 127.0.0.1 + args: + stdin: "{{ ansible_password }}" + - name: create pi-data + file: + path: "../pi-data/{{ inventory_hostname }}/" + state: directory + delegate_to: 127.0.0.1 + - name: create file + copy: + content: | + #cloud-config + + hostname: {{ inventory_hostname }} + manage_etc_hosts: true + + timezone: Europe/Madrid + + keyboard: + layout: es + + users: + - name: root + lock_passwd: false + hashed_passwd: {{ hashed_password.stdout }} + + enable_ssh: true + disable_root: false + ssh_pwauth: true + + write_files: + - content: | + PermitRootLogin yes + path: /etc/ssh/sshd_config.d/permit-root-login.conf + dest: "../pi-data/{{ inventory_hostname }}/user-data" + delegate_to: 127.0.0.1 + - name: create network-config + copy: + content: | + network: + version: 2 + ethernets: + eth0: + dhcp4: no + addresses: + - {{ network.self_internal_ip_with_prefixlen }} + gateway4: {{ network.router }} + nameservers: + # only for bootstrapping + addresses: [8.8.8.8] + dest: "../pi-data/{{ inventory_hostname }}/network-config" + delegate_to: 127.0.0.1 |
