3.2 KiB
3.2 KiB
title, author, theme, colortheme
title | author | theme | colortheme |
---|---|---|---|
Ansible | Malin | Warsaw | orchid |
First: Idempotence
My Setup Script
# Place locale info
echo 'LANG=en_GB.UTF-8' >> /etc/locale.conf
/etc/default/libc-locales
xbps-reconfigure -fy glibc-locales
# Start cron service
xbps-install -y crontab
ln -s /etc/sv/cronie /var/service
sv start crontab
# Add default dot files
git clone https://gitlab.com/andonome/mkdots.git /etc/skel/.dots
useradd -m ghost
usermod -aG wheel
Error: no package 'cron tab'
# Place locale info
echo 'LANG=en_GB.UTF-8' >> /etc/locale.conf
/etc/default/libc-locales
xbps-reconfigure -fy glibc-locales
# Start cron service
xbps-install -y cronie
ln -s /etc/sv/cronie /var/service
sv start cronie
# Add default dot files
git clone https://gitlab.com/andonome/mkdots.git /etc/skel/.dots
useradd -m ghost
usermod -aG wheel
...loading locales
Error: No command 'git' Error: user already exists
# Place locale info
echo 'LANG=en_GB.UTF-8' >> /etc/locale.conf
/etc/default/libc-locales
xbps-reconfigure -fy glibc-locales
# Start cron service
xbps-install -y cronie git
ln -s /etc/sv/cronie /var/service
sv start cronie
# Add default dot files
git clone https://gitlab.com/andonome/mkdots.git /etc/skel/.dots
useradd -m ghost
usermod -G wheel
$ cat /etc/locale.conf
LC_COLLATE=C
LANG=en_GB.UTF-8
LANG=en_GB.UTF-8
LANG=en_GB.UTF-8
LANG=en_GB.UTF-8
LANG=en_GB.UTF-8
LANG=en_GB.UTF-8
$ ???
grep en_GB /etc/locale.conf || \
echo 'LANG=en_GB.UTF-8' >> /etc/locale.conf
So Ansible...
ansible --module-name=ping localhost
ansible -m package -a 'upgrade=yes' localhost
Lines in Files
ansible -m lineinfile -a 'line=test create=yes path=/tmp/x' localhost
ansible -m say -a 'voice=en_GB msg="Testing"' localhost
ansible -m say -a 'voice=en_GB msg="Testing"' localhost
More Hosts!
Hark at the hosts in ~/.ssh/config
:
Host soft
HostName soft.dmz.rs
Port 2222
User ghost
IdentityFile ~/.ssh/id_rsa
Host krov
HostName krov.dmz.rs
User malin
Host kralizec
HostName dmz.rs
User root
Host laka
HostName 192.168.0.50
IdentityFile ~/.ssh/id_rsa
Hosts in toml
[webby]
nginx12
[webby:vars]
user=alice
This is easy to read, but breaks standards.
ansible-play -i hosts.toml playbooks/mmcli
Better to stick with standards, even if you can't read it!
Very yaml:
all:
vars:
ansible_python_interpreter: /usr/bin/python3.13
cow_selection: random
username: ghost
locale: Europe/Belgrade
libc_locale: en_GB.UTF-8 UTF-8
children:
arch:
children:
archyay:
hosts:
ratking:
archkube:
nimbus:
void:
hosts:
hex:
debian:
vars:
ansible_python_interpreter: /usr/bin/python3.12
hosts:
laka:
proxmox:
ansible-play -i hosts.yml playbooks/mmcli
What it Does
- Installs packages
- Copies configs to host
- Fetches files from host
- Backup ssl certs
- Backup ssh identify keys
Check the Repository Here!
[ $git_repo_address ]