fix inventory, roles and playbook
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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
|
||||
|
||||
7
playbooks/setup_backup_node.yml
Normal file
7
playbooks/setup_backup_node.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Setup
|
||||
hosts: on_prem
|
||||
become: yes
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- role: backup
|
||||
9
playbooks/setup_on_prem.yml
Normal file
9
playbooks/setup_on_prem.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Setup servers running on premise
|
||||
hosts: on_prem
|
||||
become: yes
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- role: firewall
|
||||
- role: arch
|
||||
|
||||
Reference in New Issue
Block a user