ansible-alpine-host/tasks/post_install.yml

67 lines
1.7 KiB
YAML
Raw Normal View History

2022-04-10 00:29:22 +00:00
---
- name: "Set a password for the root user."
shell: "PATH=/usr/bin:/usr/sbin:/bin:/sbin chroot /mnt /bin/sh -c 'echo root:{{ root }} | chpasswd -'"
- name: "Enable default services."
shell: "PATH=/usr/bin:/usr/sbin:/bin:/sbin chroot /mnt rc-update add {{ item.service }} {{ item.runlevel }}"
args:
creates: "/mnt/etc/runlevels/{{ item.runlevel }}/{{ item.service }}"
loop:
- runlevel: "sysinit"
service: "devfs"
- runlevel: "sysinit"
service: "dmesg"
- runlevel: "sysinit"
service: "mdev"
- runlevel: "sysinit"
service: "hwdrivers"
- runlevel: "sysinit"
service: "modloop"
- runlevel: "boot"
service: "modules"
- runlevel: "boot"
service: "sysctl"
- runlevel: "boot"
service: "hostname"
- runlevel: "boot"
service: "bootmisc"
- runlevel: "boot"
service: "syslog"
- runlevel: "shutdown"
service: "mount-ro"
- runlevel: "shutdown"
service: "killprocs"
- runlevel: "shutdown"
service: "savecache"
- runlevel: "default"
service: "networking"
2022-06-19 01:43:03 +00:00
- runlevel: "default"
service: "ipset"
2022-04-10 00:29:22 +00:00
- runlevel: "default"
service: "iptables"
- runlevel: "default"
service: "ip6tables"
- runlevel: "default"
service: "node-exporter"
- runlevel: "default"
service: "sshd"
- runlevel: "boot"
service: "hwclock"
- runlevel: "boot"
service: "swclock"
- name: "Install firewall rules."
template:
2022-06-19 02:48:22 +00:00
src: "templates/etc/iptables/{{ item }}.j2"
2022-04-10 00:29:22 +00:00
dest: "/mnt/etc/iptables/{{ item }}"
loop:
- rules-save
- rules6-save
- name: "And blocklists."
template:
2022-06-19 02:48:22 +00:00
src: "templates/etc/ipset.d/{{ item }}.j2"
2022-04-10 00:29:22 +00:00
dest: "/mnt/etc/ipset.d/{{ item }}"
loop:
- blocklist4
- blocklist6
- name: "Reboot!"
reboot: