Update freebsd-update.yml; add rsyslog-setup.yml

+20
freebsd-update.yml
···
state: latest
jail: "{{ item }}"
with_items: "{{ jails }}"
+
+
- name: Fetch and install updates
+
ansible.builtin.shell: freebsd-update fetch install
+
register: updated
+
changed_when: '"No updates are available to install." not in updated.stdout'
+
+
- name: Fetch and install updates in aa-torrenting jail
+
ansible.builtin.shell: freebsd-update -j aa-torrenting fetch install
+
register: updated_aa_torrenting
+
changed_when: '"No updates are available to install." not in updated_aa_torrenting.stdout'
+
+
- name: Fetch and install updates in blocky jail
+
ansible.builtin.shell: freebsd-update -j blocky fetch install
+
register: updated_blocky
+
changed_when: '"No updates are available to install." not in updated_blocky.stdout'
+
+
- name: Fetch and install updates in unbound jail
+
ansible.builtin.shell: freebsd-update -j unbound fetch install
+
register: updated_unbound
+
changed_when: '"No updates are available to install." not in updated_unbound.stdout'
+3 -13
inventory.yml
···
ansible_python_interpreter: /usr/bin/python3
promclients:
-
hosts:
-
hyperreal.coffee:
-
ansible_user: jas
-
ansible_host: hyperreal.headscale.moonshadow.dev
-
ansible_python_interpreter: /usr/bin/python3
-
headscale:
-
ansible_user: jas
-
ansible_host: headscale.headscale.moonshadow.dev
-
ansible_python_interpreter: /usr/bin/python3
-
archive-warrior:
-
ansible_user: jas
-
ansible_host: archive-warrior.headscale.moonshadow.dev
-
ansible_python_interpreter: /usr/bin/python3
+
children:
+
debianservers:
+
almaservers:
+45
rsyslog-setup.yml
···
+
---
+
- hosts: promclients
+
gather_facts: true
+
become: true
+
+
tasks:
+
- name: Ensure rsyslog is installed
+
ansible.builtin.package:
+
name: rsyslog
+
state: latest
+
+
- name: Ensure rsyslog is enabled
+
ansible.builtin.systemd_service:
+
name: rsyslog
+
enabled: true
+
state: started
+
+
- name: Remove any forwarding file if exists
+
ansible.builtin.file:
+
path: /etc/rsyslog.d/forward.conf
+
state: absent
+
+
- name: Get control node headnet IP address
+
ansible.builtin.shell: tailscale status | head -1 | awk '{print $1}'
+
register: ctrl_headnet_ip_addr
+
delegate_to: 127.0.0.1
+
+
- name: Configure log forwarding
+
ansible.builtin.blockinfile:
+
path: /etc/rsyslog.d/forward.conf
+
create: true
+
owner: root
+
group: root
+
mode: 0644
+
block: |
+
# Forward to desktop.headscale.moonshadow.dev ({{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")
+
+
- name: Restart rsyslog
+
ansible.builtin.systemd_service:
+
name: rsyslog
+
enabled: true
+
state: restarted