diff --git a/inventory.yml b/inventory.yml index 7ffa243..f153170 100644 --- a/inventory.yml +++ b/inventory.yml @@ -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 diff --git a/playbooks/example.yml b/playbooks/example.yml deleted file mode 100644 index 7107ad7..0000000 --- a/playbooks/example.yml +++ /dev/null @@ -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 diff --git a/playbooks/roles/arch/tasks/main.yml b/playbooks/roles/arch/tasks/main.yml index ed693a0..da766cf 100644 --- a/playbooks/roles/arch/tasks/main.yml +++ b/playbooks/roles/arch/tasks/main.yml @@ -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 + diff --git a/playbooks/roles/backup/files/backup_script.sh b/playbooks/roles/backup/files/backup_script.sh index cd93265..fedda97 100644 --- a/playbooks/roles/backup/files/backup_script.sh +++ b/playbooks/roles/backup/files/backup_script.sh @@ -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." diff --git a/playbooks/roles/firewall/tasks/main.yml b/playbooks/roles/firewall/tasks/main.yml index cf651ec..7eba2a7 100644 --- a/playbooks/roles/firewall/tasks/main.yml +++ b/playbooks/roles/firewall/tasks/main.yml @@ -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 diff --git a/playbooks/setup_backup_node.yml b/playbooks/setup_backup_node.yml new file mode 100644 index 0000000..51c84f7 --- /dev/null +++ b/playbooks/setup_backup_node.yml @@ -0,0 +1,7 @@ +--- +- name: Setup + hosts: on_prem + become: yes + gather_facts: yes + roles: + - role: backup diff --git a/playbooks/setup_on_prem.yml b/playbooks/setup_on_prem.yml new file mode 100644 index 0000000..250a14c --- /dev/null +++ b/playbooks/setup_on_prem.yml @@ -0,0 +1,9 @@ +--- +- name: Setup servers running on premise + hosts: on_prem + become: yes + gather_facts: yes + roles: + - role: firewall + - role: arch +