ansible-alpine-host/tasks/post_install.yml

86 lines
2.1 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"
2022-06-19 05:56:50 +00:00
service: "syslog-ng"
2022-04-10 00:29:22 +00:00
- 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"
2022-06-19 05:48:44 +00:00
- runlevel: "default"
service: "ntpd"
- name: "Install configuration files."
2022-04-10 00:29:22 +00:00
template:
2022-07-02 22:27:26 +00:00
src: "templates{{ item }}.j2"
dest: "/mnt{{ item }}"
mode: "640"
2022-04-10 00:29:22 +00:00
loop:
2022-06-19 05:52:54 +00:00
- /etc/conf.d/iptables
- /etc/conf.d/ip6tables
- /etc/conf.d/tinc.networks
- /etc/conf.d/node-exporter
- /etc/iptables/rules6-save
- /etc/iptables/rules-save
- /etc/ipset.d/blocklist4
- /etc/ipset.d/blocklist6
2022-06-19 05:56:50 +00:00
- /etc/syslog-ng/syslog-ng.conf
2022-06-19 17:22:28 +00:00
- /etc/sysctl.d/congestion.conf
2022-06-19 05:48:44 +00:00
- name: "And services."
template:
2022-07-02 22:27:26 +00:00
src: "templates{{ item }}.j2"
dest: "/mnt{{ item }}"
2022-06-19 05:48:44 +00:00
mode: "750"
loop:
- /etc/init.d/ntpd
- /etc/init.d/tincd
2022-06-19 17:22:28 +00:00
- name: "Create NTP directories."
file:
state: "directory"
2022-07-02 22:27:26 +00:00
path: "/mnt{{ item }}"
2022-06-19 17:22:28 +00:00
loop:
- "/var/NTP"
- "/var/lib/ntp"
2022-04-10 00:29:22 +00:00
- name: "Reboot!"
reboot: