ansible/set-up-vm-debian.yaml

65 lines
1.5 KiB
YAML
Raw Normal View History

2025-03-16 23:34:04 -06:00
# for rocky vms
---
- name: Provision a new Rocky VM
hosts: all
gather_facts: false
become: true
strategy: linear
tasks:
- name: Update system
apt:
name: "*"
update_cache: true
state: latest
- name: Install essential packages
apt:
name:
- vim
- git
- nfs-common
- wget
- curl
state: latest
- name: Reboot to apply updates
reboot:
- name: Download docker repo
shell: |
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- name: Install docker
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
update_cache: true
- name: Start docker
systemd_service:
name: docker
state: started
enabled: true
- name: Set multi-user default
shell: "systemctl set-default multi-user"
- name: Add bryson to docker group
shell: "sudo gpasswd -a bryson docker"
- name: Final reboot
reboot: