Compare changes

Choose any two refs to compare.

+12
check-borgmatic.yml
···
+
---
+
- name: Check the date of the last borgmatic archive
+
hosts: borgmatic_hosts
+
gather_facts: true
+
become: true
+
tasks:
+
- name: Get last borgmatic archive date
+
ansible.builtin.shell: borgmatic list | tail -n 1 | awk '{print $2,$3,$4}'
+
register: borgmatic_list
+
+
- ansible.builtin.debug:
+
msg: "{{ borgmatic_list.stdout }}"
-286
debian-local-install.yml
···
-
---
-
- hosts: local
-
gather_facts: true
-
become: true
-
-
tasks:
-
- name: Configure /etc/apt/sources.list
-
ansible.builtin.blockinfile:
-
path: /etc/apt/sources.list
-
owner: root
-
group: root
-
block: |
-
deb http://debian.uchicago.edu/debian/ {{ansible_distribution_release}} main contrib non-free non-free-firmware
-
deb http://debian.uchicago.edu/debian/ {{ansible_distribution_release}}-updates main contrib non-free non-free-firmware
-
deb http://debian.uchicago.edu/debian/ {{ansible_distribution_release}}-backports main contrib non-free non-free-firmware
-
deb http://security.debian.org/debian-security {{ansible_distribution_release}}-security main contrib non-free non-free-firmware
-
-
- name: Disable APT language translations
-
ansible.builtin.lineinfile:
-
path: /etc/apt/apt.conf.d/99translations
-
line: 'Acquire::Languages "none";'
-
owner: root
-
group: root
-
create: true
-
-
- name: Update APT repository cache
-
ansible.builtin.apt:
-
update_cache: true
-
default_release: "{{ansible_distribution_release}}-backports"
-
-
- name: Run dist-upgrade if needed
-
ansible.builtin.apt:
-
upgrade: dist
-
update_cache: true
-
default_release: "{{ansible_distribution_release}}-backports"
-
-
- name: Add third-party repositories
-
block:
-
- name: Ensure /etc/apt/keyrings exists
-
ansible.builtin.file:
-
path: /etc/apt/keyrings
-
state: directory
-
mode: 0755
-
-
- name: Add charm repo key
-
ansible.builtin.get_url:
-
url: https://repo.charm.sh/apt/gpg.key
-
dest: /etc/apt/keyrings/charm.gpg
-
-
- name: Add charm repo
-
ansible.builtin.apt_repository:
-
repo: "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *"
-
state: present
-
-
- name: Ensure /usr/share/keyrings exists
-
ansible.builtin.file:
-
path: /usr/share/keyrings
-
state: directory
-
mode: 0755
-
-
- name: Add Tailscale repo key
-
ansible.builtin.get_url:
-
url: "https://pkgs.tailscale.com/stable/debian/{{ansible_distribution_release}}.noarmor.gpg"
-
dest: /usr/share/keyrings/tailscale-archive-keyring.gpg
-
-
- name: Add Tailscale repo
-
ansible.builtin.get_url:
-
url: https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list
-
dest: /etc/apt/sources.list.d/tailscale.list
-
-
- name: Install APT packages
-
ansible.builtin.apt:
-
update_cache: true
-
default_release: "{{ansible_distribution_release}}-backports"
-
state: present
-
pkg:
-
- apt-file
-
- apt-listbugs
-
- apt-listchanges
-
- apt-transport-https
-
- atop
-
- autoconf
-
- automake
-
- autossh
-
- borgbackup
-
- borgmatic
-
- breeze-gtk-theme
-
- breeze-icon-theme
-
- btop
-
- build-essential
-
- curl
-
- devilspie2
-
- dnsutils
-
- emacs
-
- firewalld
-
- flatpak
-
- fonts-noto-color-emoji
-
- fonts-noto-mono
-
- galculator
-
- git
-
- git-core
-
- golang
-
- gum
-
- htop
-
- hugo
-
- jc
-
- jq
-
- lynx
-
- maim
-
- ncat
-
- ndiff
-
- nextcloud-desktop
-
- nodejs
-
- npm
-
- optipng
-
- papirus-icon-theme
-
- pass
-
- pipx
-
- podman
-
- python3-dev
-
- python3-pip
-
- rofi
-
- rsync
-
- systemd-resolved
-
- tailscale
-
- tuptime
-
- w3m
-
- w3m-img
-
- wget
-
- wireshark
-
- xclip
-
- xdotool
-
- xfce4-genmon-plugin
-
- xfce4-weather-plugin
-
- zip
-
- zsh
-
-
- name: Configure XDG user dirs defaults
-
ansible.builtin.blockinfile:
-
path: /etc/xdg/user-dirs.defaults
-
owner: root
-
group: root
-
mode: 0644
-
block: |
-
DESKTOP=desktop
-
DOWNLOAD=downloads
-
TEMPLATES=
-
PUBLICSHARE=sync
-
DOCUMENTS=sync/documents
-
MUSIC=
-
PICTURES=sync/pictures
-
VIDEOS=sync/videos
-
-
- name: Remove old ~/.config/user-dirs.dirs
-
ansible.builtin.file:
-
path: /home/jas/.config/user-dirs.dirs
-
state: absent
-
-
- name: Remove unneeded XDG user dirs
-
ansible.builtin.file:
-
path: "/home/jas/{{ item }}"
-
state: absent
-
with_items:
-
- Desktop
-
- Documents
-
- Downloads
-
- Music
-
- Pictures
-
- Public
-
- Templates
-
- Videos
-
-
- name: Run xdg-user-dirs-update
-
ansible.builtin.command: xdg-user-dirs-update
-
become_user: jas
-
-
- name: Reconfigure fontconfig-config - hinting_type
-
ansible.builtin.debconf:
-
name: fontconfig-config
-
question: fontconfig/hinting_type
-
value: Autohinter
-
vtype: select
-
-
- name: Reconfigure fontconfig-config - enable_bitmaps
-
ansible.builtin.debconf:
-
name: fontconfig-config
-
question: fontconfig/enable_bitmaps
-
value: false
-
vtype: boolean
-
-
- name: Reconfigure fontconfig-config - hinting_style
-
ansible.builtin.debconf:
-
name: fontconfig-config
-
question: fontconfig/hinting_style
-
value: hintslight
-
vtype: select
-
-
- name: Reconfigure fontconfig-config - subpixel_rendering
-
ansible.builtin.debconf:
-
name: fontconfig-config
-
question: fontconfig/subpixel_rendering
-
value: Always
-
vtype: select
-
-
- name: Disable unneeded services
-
ansible.builtin.systemd_service:
-
name: "{{ item }}"
-
enabled: false
-
with_items:
-
- avahi-daemon.service
-
- avahi-daemon.socket
-
- cups-browsed.service
-
- cups.service
-
-
- name: Configure systemd-networkd (desktop)
-
ansible.builtin.blockinfile:
-
path: /etc/systemd/network/eno1.network
-
owner: root
-
group: root
-
mode: 0644
-
block: |
-
[Match]
-
Name=eno1
-
-
[Network]
-
Address=10.0.0.2/24
-
Gateway=10.0.0.1
-
Broadcast=10.0.0.255
-
DNS=9.9.9.9
-
#DNS=100.100.100.100
-
DNSSEC=true
-
when:
-
- ansible_hostname == "desktop"
-
-
- name: Configure systemd-networkd (laptop)
-
ansible.builtin.blockinfile:
-
path: /etc/systemd/network/wlp0s20f3.network
-
owner: root
-
group: root
-
mode: 0644
-
block: |
-
[Match]
-
Name=wlp0s20f3
-
-
[Link]
-
RequiredForOnline=routable
-
-
[Network]
-
DHCP=yes
-
IgnoreCarrierLoss=3s
-
when:
-
- ansible_hostname == "laptop"
-
-
- name: Enable systemd-networkd on startup
-
ansible.builtin.systemd_service:
-
name: systemd-networkd.service
-
enabled: true
-
-
- name: Disable NetworkManager and networking.service
-
ansible.builtin.systemd_service:
-
name: "{{ item }}"
-
enabled: false
-
with_items:
-
- NetworkManager.service
-
- networking.service
-
-
- name: Disable wpa_supplicant on desktop
-
ansible.builtin.systemd_service:
-
name: wpa_supplicant.service
-
enabled: false
-
when:
-
- ansible_hostname == "desktop"
-
-
- name: Disable ipv6 in GRUB config
-
ansible.builtin.lineinfile:
-
path: /etc/default/grub
-
search_string: "GRUB_CMDLINE_LINUX_DEFAULT"
-
line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet ipv6.disable=1"'
-
owner: root
-
group: root
-
mode: 0644
-
-
- name: Change jas user shell to zsh
-
ansible.builtin.user:
-
name: jas
-
shell: /usr/bin/zsh
+1 -19
debian-update.yml
···
---
-
- hosts: servers
+
- hosts: debian_servers
gather_facts: true
become: true
···
- name: Perform a dist-upgrade
ansible.builtin.apt:
upgrade: dist
-
-
- name: Check if backports are enabled in sources.list
-
ansible.builtin.lineinfile:
-
path: /etc/apt/sources.list
-
regex: "backports"
-
state: absent
-
changed_when: false
-
check_mode: true
-
register: backports
-
-
- name: Perform a dist-upgrade from Debian backports
-
ansible.builtin.apt:
-
default_release: bookworm-backports
-
update_cache: true
-
upgrade: dist
-
when:
-
- ansible_distribution == 'Debian'
-
- backports.found == 1
- name: Check if reboot is required
ansible.builtin.stat:
+26
freebsd-update.yml
···
+
- hosts: freebsd_servers
+
gather_facts: true
+
become: true
+
tasks:
+
- name: Update all installed packages
+
community.general.pkgng:
+
name: "*"
+
state: latest
+
- name: Update the base system
+
ansible.builtin.shell: freebsd-update fetch install --not-running-from-cron
+
- name: Get currently running FreeBSD kernel version in memory
+
ansible.builtin.shell: freebsd-version -r
+
register: running_kv
+
- name: Get newly installed kernel version
+
ansible.builtin.shell: freebsd-version -k
+
register: installed_kv
+
- name: Check for kernel version mismatch
+
set_fact:
+
reboot_required: "{{ running_kv.stdout != installed_kv.stdout }}"
+
- name: Display reboot status
+
ansible.builtin.debug:
+
msg: "Reboot required: {{ reboot_required }}"
+
- name: Reboot the FreeBSD server if needed
+
ansible.builtin.reboot:
+
reboot_timeout: 3600
+
when: reboot_required
+18 -40
inventory.yml
···
-
servers:
+
borgmatic_hosts:
hosts:
-
hyperreal.coffee:
+
desktop:
ansible_user: jas
-
ansible_host: hyperreal.lyrebird-marlin.ts.net
+
ansible_host: desktop.carp-wyvern.ts.net
ansible_python_interpreter: /usr/bin/python3
-
auxnc-8g:
+
nas:
ansible_user: jas
-
ansible_host: 152.53.39.153
-
ansible_python_interpreter: /usr/bin/python3
-
nas-local:
-
ansible_user: jas
-
ansible_host: nas-local.lyrebird-marlin.ts.net
-
ansible_python_interpreter: /usr/bin/python3
-
auxnode:
-
ansible_user: jas
-
ansible_host: auxnode.lyrebird-marlin.ts.net
-
ansible_python_interpreter: /usr/bin/python3
-
auxnode2:
-
ansible_user: jas
-
ansible_host: 10.0.0.5
-
ansible_python_interpreter: /usr/bin/python3
-
-
promservers:
+
ansible_host: nas.carp-wyvern.ts.net
+
ansible_python_interpreter: /usr/local/bin/python3.11
+
debian_servers:
hosts:
-
desktop:
+
moonshadow:
ansible_user: jas
-
ansible_host: localhost
+
ansible_host: moonshadow.carp-wyvern.ts.net
ansible_python_interpreter: /usr/bin/python3
-
-
promclients:
+
freebsd_servers:
hosts:
-
hyperreal.coffee:
-
ansible_user: jas
-
ansible_host: hyperreal.lyrebird-marlin.ts.net
-
ansible_python_interpreter: /usr/bin/python3
-
nas-local:
-
ansible_user: jas
-
ansible_host: nas-local.lyrebird-marlin.ts.net
-
ansible_python_interpreter: /usr/bin/python3
-
auxnode:
-
ansible_user: jas
-
ansible_host: auxnode.lyrebird-marlin.ts.net
-
ansible_python_interpreter: /usr/bin/python3
-
auxnode2:
-
ansible_user: jas
-
ansible_host: 10.0.0.5
-
ansible_python_interpreter: /usr/bin/python3
+
nas:
+
ansible_user: root
+
ansible_host: nas.carp-wyvern.ts.net
+
ansible_python_interpreter: /usr/local/bin/python3.11
+
tornode:
+
ansible_user: root
+
ansible_host: tornode
+
ansible_python_interpreter: /usr/local/bin/python3.11
+17 -1
prometheus-clients.yml
···
---
-
- hosts: promclients
+
- hosts: prom_clients
tasks:
- name: Import Node Exporter role
import_role:
name: prometheus.prometheus.node_exporter
+
when: ansible_service_mgr == "systemd"
+
+
- name: Install Node Exporter on FreeBSD
+
community.general.pkgng:
+
name: "node_exporter"
+
state: latest
+
when: ansible_service_mgr == "bsdinit"
+
become: true
+
+
- name: Enable node_exporter service on FreeBSD
+
ansible.builtin.service:
+
name: node_exporter
+
enabled: true
+
state: started
+
when: ansible_service_mgr == "bsdinit"
+
become: true
+1 -5
prometheus-servers.yml
···
---
-
- hosts: promservers
+
- hosts: prom_servers
tasks:
- name: Import Node Exporter role
import_role:
···
- name: Import Prometheus role
import_role:
name: prometheus.prometheus.prometheus
-
-
- name: Import Systemd Exporter role
-
import_role:
-
name: prometheus.prometheus.systemd_exporter
+63
remote-logging-setup.yml
···
+
- hosts: remote_logging_clients
+
gather_facts: true
+
become: true
+
tasks:
+
- name: Ensure rsyslog is installed
+
ansible.builtin.package:
+
name: rsyslog
+
state: latest
+
when: ansible_system == "Linux"
+
- name: Ensure rsyslog is enabled
+
ansible.builtin.systemd_service:
+
name: rsyslog
+
enabled: true
+
state: started
+
when: ansible_service_mgr == "systemd"
+
- name: Remove any forwarding file if exists
+
ansible.builtin.file:
+
path: /etc/rsyslog.d/forward.conf
+
state: absent
+
when: ansible_system == "Linux"
+
- name: Get remote logging server headnet IP address
+
ansible.builtin.shell: tailscale status | grep "aux" | awk '{print $1}'
+
register: ctrl_headnet_ip_addr
+
changed_when: false
+
failed_when: ctrl_headnet_ip_addr.rc != 0
+
- name: Configure log forwarding
+
ansible.builtin.blockinfile:
+
path: /etc/rsyslog.d/forward.conf
+
create: true
+
owner: root
+
group: root
+
mode: 0644
+
block: |
+
# Forward to aux.carp-wyvern.ts.net ({{ctrl_headnet_ip_addr.stdout}})
+
*.* action(type="omfwd" target="{{ctrl_headnet_ip_addr.stdout}}" port="514" protocol="tcp"
+
action.resumeRetryCount="100"
+
queue.type="linkedList" queue.size="10000")
+
when: ansible_system == "Linux"
+
- name: Restart rsyslog
+
ansible.builtin.systemd_service:
+
name: rsyslog
+
enabled: true
+
state: restarted
+
when: ansible_service_mgr == "systemd"
+
- name: Set syslog flags for remote logging on FreeBSD
+
ansible.builtin.shell: sysrc syslog_flags="-s -v -v"
+
register: set_syslog_flags
+
changed_when: '"syslog_flags: -> YES" in set_syslog_flags.stdout'
+
when: ansible_service_mgr == "bsdinit"
+
- name: Set log forwarding on FreeBSD
+
ansible.builtin.lineinfile:
+
path: /etc/syslog.conf
+
regexp: '^\*\.\*'
+
line: "*.* @{{ctrl_headnet_ip_addr.stdout}}"
+
owner: root
+
group: wheel
+
mode: 0644
+
when: ansible_system == "FreeBSD"
+
- name: Restart syslogd
+
ansible.builtin.service:
+
name: syslogd
+
state: restarted
+
when: ansible_service_mgr == "bsdinit"
+10
uptime.yml
···
+
---
+
- name: Get server uptimes
+
hosts: all
+
tasks:
+
- name: Get uptime
+
ansible.builtin.shell: uptime
+
register: uptime
+
+
- ansible.builtin.debug:
+
msg: "{{ uptime.stdout }}"
+38
zfs-log-compress.yml
···
+
# Based on https://github.com/FreeBSDFoundation/blog/blob/main/zfs-log-compression-on-freebsd/zfs_log_compress.yml
+
---
+
- name: Remove log compression on FreeBSD host, add timestamps to rotated logs
+
hosts: freebsd_servers
+
gather_facts: true
+
become: true
+
tasks:
+
- name: Set compression of /var/log dataset to zstd
+
community.general.zfs:
+
name: zroot/var/log
+
state: present
+
extra_zfs_properties:
+
compression: zstd
+
+
- name: Remove 'J' from the newsyslog.conf file
+
ansible.builtin.replace:
+
path: /etc/newsyslog.conf
+
regexp: "^J|J"
+
replace: ""
+
notify: "Restart newsyslog service"
+
+
- name: Use timestamps instead of numbers for log rotations
+
ansible.builtin.replace:
+
path: /etc/crontab
+
regexp: "newsyslog$"
+
replace: "newsyslog -t DEFAULT"
+
notify: "Restart syslogd service"
+
+
handlers:
+
- name: Restart newsyslog service
+
ansible.builtin.service:
+
name: newsyslog
+
state: restarted
+
+
- name: Restart syslogd service
+
ansible.builtin.service:
+
name: syslogd
+
state: restarted