fix inventory, roles and playbook

This commit is contained in:
2026-03-27 21:14:37 +01:00
parent bf1f284780
commit d875bd4efb
7 changed files with 49 additions and 21 deletions

View File

@@ -33,7 +33,7 @@ all:
ansible_host: 192.168.178.58
ansible_user: ansible
ansible_ssh_private_key_file: ~/.ssh/ansible
ansible_python_interpreter: /usr/local/bin/python3.11
ansible_python_interpreter: /usr/bin/python
pi2:
ansible_host: 192.168.178.89
ansible_user: ansible

View File

@@ -1,9 +0,0 @@
- name: My first play
hosts: all
tasks:
- name: Ping my hosts
ansible.builtin.ping:
- name: Print message
ansible.builtin.debug:
msg: Hello World

View File

@@ -2,6 +2,11 @@
---
# tasks to setup arch hosts
# Base setup
- name: Install cronie
community.general.pacman:
name: cronie
state: present
# Pacman
- name: Run full system upgrade
@@ -16,10 +21,19 @@
special_time: daily
job: "pacman -Syu --noconfirm"
- name: Add pacman animation
- name: Enable Color in pacman.conf
ansible.builtin.lineinfile:
path: /etc/pacman.conf
regexp: '^#?Color'
line: Color
insertafter: '^\[options\]'
- name: Enable ILoveCandy in pacman.conf
ansible.builtin.lineinfile:
path: /etc/pacman.conf
regexp: '^#?ILoveCandy'
line: ILoveCandy
insertafter: '^\[options\]'
# Fastfetch prompt
- name: Install fastfetch
@@ -72,6 +86,12 @@
minute: "*/5"
job: "/usr/local/bin/checkmk_push.sh"
# general tasks
- name: Install rsync
community.general.pacman:
name: rsync
state: present

View File

@@ -42,19 +42,19 @@ HOME_TARGETS=(
)
for i in "${HOME_TARGETS[@]}"; do
rsync -avP "machine:/home/vashqlf/${i}" "${HOME_PATH}${i}"
rsync -avP "machine:/home/vashqlf/${i}" "${HOME_PATH}"
done
echo "[INFO] $(date --rfc-3339 s) - Done!"
## Backup cloud hosts
# Strato1: vaultwarden
echo "[INFO] $(date --rfc-3339 s) - Syncing strato1:/home/pw-manager/vaultwarden..."
rsync -avP "strato1:/home/pw-manager/vaultwarden" "${BKP_PATH}vaultwarden"
rsync -avP "strato1:/home/pw-manager/vaultwarden" "${BKP_PATH}"
echo "[INFO] $(date --rfc-3339 s) - Done!"
# Strato3: Checkmk
echo "[INFO] $(date --rfc-3339 s) - Syncing strato3:/usr/local/share/cmk-bkp..."
rsync -avP "strato3:/usr/local/share/cmk-bkp" "${BKP_PATH}cmk-bkp"
rsync -avP "strato3:/usr/local/share/cmk-bkp" "${BKP_PATH}"
echo "[INFO] $(date --rfc-3339 s) - Done!"
echo "[INFO] $(date --rfc-3339 s) - Syncing completed, nothing more to do."

View File

@@ -16,11 +16,7 @@
state: present
update_cache: true
become: true
- name: Enable ufw
community.general.ufw:
state: enabled
become: true
when: ansible_facts['os_family'] == "Archlinux"
- name: Allow SSH
community.general.ufw:
@@ -36,7 +32,7 @@
port: 161
proto: udp
become: true
when: ansible_facts["os_family"]
when: ansible_facts["os_family"] == "Debian"
- name: Allow port 6556 for check_mk
community.general.ufw:
@@ -44,4 +40,9 @@
port: 6556
proto: tcp
become: true
when: ansible_facts["os_family"]
when: ansible_facts["os_family"] == "Debian"
- name: Enable ufw
community.general.ufw:
state: enabled
become: true

View File

@@ -0,0 +1,7 @@
---
- name: Setup
hosts: on_prem
become: yes
gather_facts: yes
roles:
- role: backup

View File

@@ -0,0 +1,9 @@
---
- name: Setup servers running on premise
hosts: on_prem
become: yes
gather_facts: yes
roles:
- role: firewall
- role: arch