ansible-playbooks/README.md
2023-03-08 09:41:56 -06:00

45 lines
1.1 KiB
Markdown

# ansible-playbooks
For setting up Debian or RHEL-compatible virtual private servers (e.g., on Linode, Digital Ocean, etc).
I have a `hosts.ini` file that looks something like this:
```ini
[servers]
server0_hostname_or_ip_address
server1_hostname_or_ip_address
server2_hostname_or_ip_address
[new-debian-servers]
server3_hostname_or_ip_address
server4_hostname_or_ip_address
[new-rhel-servers]
server5_hostname_or_ip_address
server6_hostname_or_ip_address
```
### Debian VPS setup
From the current directory:
```shell
ansible-playbook -i hosts.ini debian-setup.yml -u root
```
### RHEL-compatible VPS
RHEL-compatible = Rocky Linux, AlmaLinux, CentOS Stream, RHEL, or Fedora.
From the current directory:
```shell
ansible-playbook -i hosts.ini rhel-setup.yml -u root
```
### Reboot check on existing servers
I have my servers configured to install updates automatically. This requires a reboot if the updates included the kernel, core libraries, or systemd. The `reboot_check.yml` playbook checks if any server needs a reboot, and then initiates the reboot.
```shell
ansible-playbook -i hosts.ini reboot_check.yml
```