switched to new facts-syntax

This commit is contained in:
2026-01-12 12:31:24 +01:00
parent 037b998219
commit 9fd07d57a4
41 changed files with 111 additions and 109 deletions

View File

@@ -4,7 +4,7 @@
- ansible.builtin.import_tasks: global_handlers/global_handlers.yml - ansible.builtin.import_tasks: global_handlers/global_handlers.yml
connection: local connection: local
vars_files: vars_files:
- "{{ lookup('first_found', ['os_vars/' + (ansible_distribution | lower) + '.yml'], errors='ignore') }}" - "{{ lookup('first_found', ['os_vars/' + (ansible_facts['distribution'] | lower) + '.yml'], errors='ignore') }}"
become: true become: true
vars: vars:
ansible_reboot_cooldown_minutes: 15 # Cooldown in Minuten ansible_reboot_cooldown_minutes: 15 # Cooldown in Minuten
@@ -33,17 +33,17 @@
- name: pre-run | update apt repository (debian, ubuntu, etc.) # noqa no-changed-when - name: pre-run | update apt repository (debian, ubuntu, etc.) # noqa no-changed-when
ansible.builtin.apt: update_cache=yes ansible.builtin.apt: update_cache=yes
#changed_when: false #changed_when: false
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
ignore_errors: True ignore_errors: True
- name: pre-run | update pacman repository (arch) - name: pre-run | update pacman repository (arch)
community.general.pacman: update_cache=yes community.general.pacman: update_cache=yes
#changed_when: false #changed_when: false
when: ansible_distribution == 'Archlinux' when: ansible_facts['distribution'] == 'Archlinux'
ignore_errors: True ignore_errors: True
- name: pre-run |update portage repository (gentoo) - name: pre-run |update portage repository (gentoo)
portage: portage:
sync: yes sync: yes
when: ansible_distribution == 'Gentoo' when: ansible_facts['distribution'] == 'Gentoo'
ignore_errors: True ignore_errors: True
@@ -52,11 +52,11 @@
- name: pre-run | upgrade system (debian, ubuntu, etc.) - name: pre-run | upgrade system (debian, ubuntu, etc.)
ansible.builtin.apt: upgrade=dist ansible.builtin.apt: upgrade=dist
#changed_when: false #changed_when: false
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
ignore_errors: True ignore_errors: True
- name: pre-run | upgrade system (arch) - name: pre-run | upgrade system (arch)
community.general.pacman: upgrade=true community.general.pacman: upgrade=true
when: ansible_distribution == 'Archlinux' when: ansible_facts['distribution'] == 'Archlinux'
ignore_errors: True ignore_errors: True
# run roles # run roles
@@ -227,14 +227,14 @@
ansible.builtin.apt: ansible.builtin.apt:
autoclean: yes autoclean: yes
changed_when: false changed_when: false
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
- name: autoremove orphan packages (debian and ubuntu) - name: autoremove orphan packages (debian and ubuntu)
tags: always tags: always
ansible.builtin.apt: ansible.builtin.apt:
autoremove: yes autoremove: yes
purge: yes purge: yes
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
- name: post-run | update marker file timestamp on successful run - name: post-run | update marker file timestamp on successful run
file: file:

View File

@@ -0,0 +1 @@
/opt/tplink/EAPController/data/autobackup/tmp

View File

@@ -0,0 +1 @@
/opt/tplink/EAPController/data/autobackup/

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution }}.yml" - include_vars: "{{ ansible_facts['distribution'] }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True

View File

@@ -12,7 +12,7 @@
state: latest state: latest
name: name:
- mariadb-clients - mariadb-clients
when: ansible_distribution == "Archlinux" when: ansible_facts['distribution'] == "Archlinux"
- name: backup | utilities | install utilities (debian) - name: backup | utilities | install utilities (debian)
tags: packages,system,system setup tags: packages,system,system setup
@@ -20,14 +20,14 @@
state: latest state: latest
name: name:
- mariadb-client - mariadb-client
when: ansible_distribution in [ "Debian", "Ubuntu", "Linux Mint" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | install tailscale (arch) - name: backup | tailscale | install tailscale (arch)
tags: packages,system,system setup,tailscale tags: packages,system,system setup,tailscale
package: package:
name: tailscale name: tailscale
state: latest state: latest
when: ansible_distribution == "Archlinux" when: ansible_facts['distribution'] == "Archlinux"
- name: backup | tailscale | install prerequisites (debian-based) - name: backup | tailscale | install prerequisites (debian-based)
tags: packages,system,system setup,tailscale tags: packages,system,system setup,tailscale
@@ -36,23 +36,23 @@
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
state: present state: present
when: ansible_distribution in [ "Debian", "Ubuntu", "Linux Mint" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | add tailscale apt key (debian-based) - name: backup | tailscale | add tailscale apt key (debian-based)
tags: packages,system,system setup,tailscale tags: packages,system,system setup,tailscale
get_url: get_url:
url: "https://pkgs.tailscale.com/stable/{{ ansible_distribution | lower }}/{{ ansible_distribution_release }}.noarmor.gpg" url: "https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }}/{{ ansible_facts['distribution']_release }}.noarmor.gpg"
dest: /usr/share/keyrings/tailscale-archive-keyring.gpg dest: /usr/share/keyrings/tailscale-archive-keyring.gpg
mode: '0644' mode: '0644'
when: ansible_distribution in [ "Debian", "Ubuntu", "Linux Mint" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: backup | tailscale | add tailscale repository (debian-based) - name: backup | tailscale | add tailscale repository (debian-based)
tags: packages,system,system setup,tailscale tags: packages,system,system setup,tailscale
apt_repository: apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} main" repo: "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution']_release }} main"
state: present state: present
filename: tailscale filename: tailscale
when: ansible_distribution in [ "Debian", "Ubuntu", "Linux Mint" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
notify: update apt cache notify: update apt cache
- name: backup | tailscale | install tailscale (debian-based) - name: backup | tailscale | install tailscale (debian-based)
@@ -60,4 +60,4 @@
apt: apt:
name: tailscale name: tailscale
state: latest state: latest
when: ansible_distribution in [ "Debian", "Ubuntu", "Linux Mint" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]

View File

@@ -11,7 +11,7 @@
ansible.builtin.file: ansible.builtin.file:
path: "/opt/backup/bin/backup_remote.bash" path: "/opt/backup/bin/backup_remote.bash"
state: link state: link
src: "{{ ansible_user_dir }}/bin/backup_remote.bash" src: "{{ ansible_facts['user_dir'] }}/bin/backup_remote.bash"
- name: backup | system setup | copy backup config files - name: backup | system setup | copy backup config files
ansible.builtin.copy: ansible.builtin.copy:
@@ -26,11 +26,11 @@
- name: backup | system setup | add entries to ssh_config - name: backup | system setup | add entries to ssh_config
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
dest: "{{ ansible_user_dir }}/.ssh/config" dest: "{{ ansible_facts['user_dir'] }}/.ssh/config"
block: "{{ lookup('template', 'ssh_config.j2') }}" block: "{{ lookup('template', 'ssh_config.j2') }}"
marker: "## {mark} ANSIBLE MANAGED BLOCK FOR backup" marker: "## {mark} ANSIBLE MANAGED BLOCK FOR backup"
# template: # template:
# src: "ssh_config.j2" # src: "ssh_config.j2"
# dest: "{{ ansible_user_id }}/.ssh/config" # dest: "{{ ansible_facts['user_id'] }}/.ssh/config"
# backup: true # backup: true
# mode: "0644" # mode: "0644"

View File

@@ -4,13 +4,13 @@
path: "/etc/apt/sources.list" path: "/etc/apt/sources.list"
regexp: "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" regexp: "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main"
state: absent state: absent
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
- debug: - debug:
var: ansible_distribution_release var: ansible_facts['distribution']_release
- debug: - debug:
var: equivalents[ansible_distribution_release]['ubuntu'] var: equivalents[ansible_facts['distribution']_release]['ubuntu']
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
- name: ansible setup | get key - name: ansible setup | get key
@@ -18,13 +18,13 @@
get_url: get_url:
url: "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" # required. HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path url: "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" # required. HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path
dest: "/tmp/ansible-archive-keyring.asc" # Download to a temporary location dest: "/tmp/ansible-archive-keyring.asc" # Download to a temporary location
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
- name: ansible setup | dearmor GPG key and place in /usr/share/keyrings - name: ansible setup | dearmor GPG key and place in /usr/share/keyrings
ansible.builtin.command: ansible.builtin.command:
cmd: "gpg --dearmor -o /usr/share/keyrings/ansible-archive-keyring.gpg /tmp/ansible-archive-keyring.asc" cmd: "gpg --dearmor -o /usr/share/keyrings/ansible-archive-keyring.gpg /tmp/ansible-archive-keyring.asc"
creates: "/usr/share/keyrings/ansible-archive-keyring.gpg" creates: "/usr/share/keyrings/ansible-archive-keyring.gpg"
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
# Hinweis: Der 'warn: false' Parameter wurde aufgrund eines Konflikts entfernt. # Hinweis: Der 'warn: false' Parameter wurde aufgrund eines Konflikts entfernt.
# Diese Aufgabe ist entscheidend für die moderne APT-Schlüsselverwaltung. # Diese Aufgabe ist entscheidend für die moderne APT-Schlüsselverwaltung.
@@ -32,34 +32,34 @@
file: file:
path: /etc/apt/sources.list.d/ansible.list path: /etc/apt/sources.list.d/ansible.list
state: absent state: absent
when: ansible_distribution == "Debian" when: ansible_facts['distribution'] == "Debian"
- name: ansible setup | remove repository - Debian / Ubuntu - name: ansible setup | remove repository - Debian / Ubuntu
tags: ansible,ansible-setup tags: ansible,ansible-setup
apt_repository: apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ equivalents[ansible_distribution_release]['ubuntu'] }} main" repo: "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ equivalents[ansible_facts['distribution']_release]['ubuntu'] }} main"
state: absent state: absent
update_cache: no update_cache: no
filename: ansible filename: ansible
when: ansible_distribution in ["Debian", "Ubuntu"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu"]
- name: ansible setup | update repository - Debian - name: ansible setup | update repository - Debian
tags: ansible,ansible-setup tags: ansible,ansible-setup
apt_repository: apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ equivalents[ansible_distribution_release]['ubuntu'] }} main" repo: "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ equivalents[ansible_facts['distribution']_release]['ubuntu'] }} main"
state: present state: present
update_cache: yes update_cache: yes
filename: ansible filename: ansible
when: ansible_distribution == "Debian" when: ansible_facts['distribution'] == "Debian"
- name: ansible setup | update repository - Ubuntu - name: ansible setup | update repository - Ubuntu
tags: ansible,ansible-setup tags: ansible,ansible-setup
apt_repository: apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ ansible_distribution_release }} main" repo: "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ ansible_facts['distribution']_release }} main"
state: present state: present
update_cache: yes update_cache: yes
filename: ansible filename: ansible
when: ansible_distribution == "Ubuntu" when: ansible_facts['distribution'] == "Ubuntu"
- name: ansible setup | ensure ansible is the latest version - name: ansible setup | ensure ansible is the latest version
tags: ansible,ansible-setup tags: ansible,ansible-setup
@@ -79,7 +79,7 @@
# tags: ansible,ansible-setup,packages # tags: ansible,ansible-setup,packages
# package: # package:
# name: acl # name: acl
# when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] # when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
# - name: ansible:setup | create ansible log file # - name: ansible:setup | create ansible log file
# tags: ansible,ansible-setup # tags: ansible,ansible-setup

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
@@ -41,7 +41,7 @@
- import_tasks: system_setup/disable_standby.yml - import_tasks: system_setup/disable_standby.yml
when: is_proxmox is defined and is_proxmox == true when: is_proxmox is defined and is_proxmox == true
- import_tasks: software/wazuh-agent.yml - import_tasks: software/wazuh-agent.yml
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint", "Archlinux"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint", "Archlinux"]
- import_tasks: system_setup/disable_standby.yml - import_tasks: system_setup/disable_standby.yml
when: is_proxmox is defined and is_proxmox == true when: is_proxmox is defined and is_proxmox == true
- import_tasks: system_setup/import_stepca.yml - import_tasks: system_setup/import_stepca.yml

View File

@@ -8,4 +8,4 @@
- exim4-base - exim4-base
- exim4-config - exim4-config
- nano - nano
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]

View File

@@ -59,7 +59,7 @@
- lsd - lsd
- pacman-contrib - pacman-contrib
- which - which
when: ansible_distribution == "Archlinux" when: ansible_facts['distribution'] == "Archlinux"
ignore_errors: true ignore_errors: true
- name: system setup | utilities | install man-pages (arch) - name: system setup | utilities | install man-pages (arch)
@@ -71,7 +71,7 @@
- man-db - man-db
- man-pages - man-pages
- "{{ python_passlib_package }}" - "{{ python_passlib_package }}"
when: ansible_distribution == "Archlinux" when: ansible_facts['distribution'] == "Archlinux"
ignore_errors: true ignore_errors: true
- name: system setup | utilities | install utilities (debian) - name: system setup | utilities | install utilities (debian)
@@ -87,7 +87,7 @@
- dnsutils - dnsutils
- unattended-upgrades - unattended-upgrades
- "{{ python_passlib_package }}" - "{{ python_passlib_package }}"
when: ansible_distribution in [ "Debian", "Ubuntu" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu" ]
ignore_errors: true ignore_errors: true
- name: system setup | utilities | install AUR helper (arch) - name: system setup | utilities | install AUR helper (arch)

View File

@@ -3,14 +3,14 @@
package: package:
name: systemd-timesyncd name: systemd-timesyncd
state: latest state: latest
when: ansible_distribution in ["Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Pop!_OS", "Ubuntu", "Linux Mint"]
- name: system setup | clock | install systemd-timesyncd (debian) - name: system setup | clock | install systemd-timesyncd (debian)
tags: ntp, system setup tags: ntp, system setup
apt: apt:
name: systemd-timesyncd name: systemd-timesyncd
state: latest state: latest
when: ansible_distribution == "Debian" when: ansible_facts['distribution'] == "Debian"
- name: system setup | clock | start and enable systemd-timestampd - name: system setup | clock | start and enable systemd-timestampd
tags: ntp,system setup tags: ntp,system setup

View File

@@ -11,14 +11,14 @@
name: cronie name: cronie
state: started state: started
enabled: true enabled: true
when: ansible_distribution == "Archlinux" when: ansible_facts['distribution'] == "Archlinux"
- name: system setup | cron | add cronjob for ansible on reboot - name: system setup | cron | add cronjob for ansible on reboot
become: true become: true
become_user: root become_user: root
cron: cron:
name: "ansible provision" name: "ansible provision"
user: "{{ ansible_user_id }}" user: "{{ ansible_facts['user_id'] }}"
job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_pull.log || cat /var/log/ansible_pull.log' job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_pull.log || cat /var/log/ansible_pull.log'
state: present state: present
special_time: reboot special_time: reboot
@@ -28,7 +28,7 @@
become_user: root become_user: root
cron: cron:
name: "ansible provision" name: "ansible provision"
user: "{{ ansible_user_id }}" user: "{{ ansible_facts['user_id'] }}"
job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_pull.log || cat /var/log/ansible_pull.log' job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_pull.log || cat /var/log/ansible_pull.log'
state: present state: present
minute: 0 minute: 0
@@ -105,7 +105,7 @@
hour: "0" hour: "0"
minute: "0" minute: "0"
job: "apt list --upgradeable" job: "apt list --upgradeable"
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: system setup | cron | Send me a list of upgradeable packages daily (Archlinux) - name: system setup | cron | Send me a list of upgradeable packages daily (Archlinux)
tags: cron tags: cron
@@ -115,4 +115,4 @@
hour: "0" hour: "0"
minute: "0" minute: "0"
job: "{{ root_home }} + '/bin/cron_pacman'" job: "{{ root_home }} + '/bin/cron_pacman'"
when: ansible_distribution in ["Archlinux"] when: ansible_facts['distribution'] in ["Archlinux"]

View File

@@ -1,7 +1,7 @@
- name: base | system_setup | git config user.email - name: base | system_setup | git config user.email
git_config: git_config:
name: user.email # not required. The name of the setting. If no value is supplied, the value will be read from the config if it has been set. name: user.email # not required. The name of the setting. If no value is supplied, the value will be read from the config if it has been set.
value: 'root@{{ ansible_fqdn }}' value: 'root@{{ ansible_facts["fqdn"] }}'
scope: global scope: global
- name: base | system_setup | git config user.name - name: base | system_setup | git config user.name

View File

@@ -4,7 +4,7 @@
name: name:
- locales-all - locales-all
state: latest state: latest
when: ansible_distribution in [ "Debian", "Ubuntu", "Linux Mint" ] when: ansible_facts['distribution'] in [ "Debian", "Ubuntu", "Linux Mint" ]
- name: system setup | locale | add de_DE - name: system setup | locale | add de_DE
tags: locale,system,setup tags: locale,system,setup

View File

@@ -26,10 +26,10 @@
- name: users | root | install private ssh keys for backup - name: users | root | install private ssh keys for backup
copy: copy:
dest: "{{ ansible_user_dir }}/.ssh/" dest: "{{ ansible_facts['user_dir'] }}/.ssh/"
src: "{{ item }}" src: "{{ item }}"
owner: "{{ ansible_user_id }}" owner: "{{ ansible_facts['user_id'] }}"
group: "{{ ansible_user_id }}" group: "{{ ansible_facts['user_id'] }}"
mode: '0600' mode: '0600'
loop: loop:
- "private_keys/backup_ed25519" - "private_keys/backup_ed25519"
@@ -45,7 +45,7 @@
- name: users | root | copy ~/validate-rsync.sh - name: users | root | copy ~/validate-rsync.sh
copy: copy:
#dest: "{{ getent_passwd[user][4] }}/validate-rsync.sh" #dest: "{{ getent_passwd[user][4] }}/validate-rsync.sh"
dest: "{{ ansible_user_dir }}/validate-rsync.sh" dest: "{{ ansible_facts['user_dir'] }}/validate-rsync.sh"
src: "system_setup/validate-rsync.sh" src: "system_setup/validate-rsync.sh"
mode: "0744" mode: "0744"

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution|lower }}.yml" - include_vars: "{{ ansible_facts['distribution']|lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True

View File

@@ -2,7 +2,7 @@
- name: docker | install docker | get convenience script - name: docker | install docker | get convenience script
ansible.builtin.get_url: ansible.builtin.get_url:
url: "https://get.docker.com" url: "https://get.docker.com"
dest: "~/get-docker.sh" dest: "/tmp/get-docker.sh"
mode: "0777" # not required. The permissions the resulting file or directory should have. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). As of Ansible 2.6, the mode may also be the special string C(preserve). When set to C(preserve) the file will be given the same permissions as the source file. mode: "0777" # not required. The permissions the resulting file or directory should have. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). As of Ansible 2.6, the mode may also be the special string C(preserve). When set to C(preserve) the file will be given the same permissions as the source file.
use_proxy: No use_proxy: No
@@ -15,7 +15,7 @@
# file: # file:
# path: "/tmp/get-docker.sh" # required. Path to the file being managed. # path: "/tmp/get-docker.sh" # required. Path to the file being managed.
# state: absent # state: absent
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: docker | install docker | docker-compose - name: docker | install docker | docker-compose
ansible.builtin.package: ansible.builtin.package:

View File

@@ -1,9 +1,9 @@
--- ---
# Load distro specific variables # Load distro specific variables
- ansible.builtin.include_vars: "{{ ansible_distribution | lower }}.yml" - ansible.builtin.include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
- ansible.builtin.include_vars: "{{ ansible_fqdn | lower }}.yml" - ansible.builtin.include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True
- ansible.builtin.import_tasks: install_docker.yml - ansible.builtin.import_tasks: install_docker.yml

View File

@@ -7,12 +7,12 @@
- name: domaincontroller | certs | obtain certificate from step-ca via certbot - name: domaincontroller | certs | obtain certificate from step-ca via certbot
command: > command: >
certbot certonly --standalone -n certbot certonly --standalone -n
-d {{ ansible_fqdn }} -d {{ ansible_facts['fqdn'] }}
--server {{ samba_stepca_server_url }}/acme/acme/directory --server {{ samba_stepca_server_url }}/acme/acme/directory
--agree-tos --agree-tos
--email admin@{{ samba_realm | lower }} --email admin@{{ samba_realm | lower }}
args: args:
creates: /etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem creates: /etc/letsencrypt/live/{{ ansible_facts['fqdn'] }}/fullchain.pem
notify: restart samba-ad-dc notify: restart samba-ad-dc
- name: domaincontroller | certs | create certbot.service override directory - name: domaincontroller | certs | create certbot.service override directory

View File

@@ -6,8 +6,8 @@
workgroup = {{ samba_workgroup }} workgroup = {{ samba_workgroup }}
tls enabled = yes tls enabled = yes
tls keyfile = /etc/letsencrypt/live/{{ ansible_fqdn }}/privkey.pem tls keyfile = /etc/letsencrypt/live/{{ ansible_facts['fqdn'] }}/privkey.pem
tls certfile = /etc/letsencrypt/live/{{ ansible_fqdn }}/fullchain.pem tls certfile = /etc/letsencrypt/live/{{ ansible_facts['fqdn'] }}/fullchain.pem
template homedir = /home/%U template homedir = /home/%U
template shell = /bin/zsh template shell = /bin/zsh

View File

@@ -1,4 +1,4 @@
- include_vars: "{{ ansible_fqdn | lower }}.yml" - include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True
- block: - block:

View File

@@ -1,9 +1,9 @@
--- ---
# Load distro specific variables # Load distro specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
- include_vars: "{{ ansible_fqdn | lower }}.yml" - include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True
- block: - block:

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
- block: - block:

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
- block: - block:

View File

@@ -1,8 +1,8 @@
--- ---
# Load distro specific variables # Load distro specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
- include_vars: "{{ ansible_fqdn | lower }}.yml" - include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True

View File

@@ -1,5 +1,5 @@
--- ---
- stat: path=/etc/letsencrypt/live/{{ mastodon_host | default(ansible_fqdn) }}/fullchain.pem - stat: path=/etc/letsencrypt/live/{{ mastodon_host | default(ansible_facts['fqdn']) }}/fullchain.pem
register: letsencrypt_cert register: letsencrypt_cert
- name: Copy letsencrypt nginx config - name: Copy letsencrypt nginx config
@@ -19,7 +19,7 @@
- migration is not defined or migration == False - migration is not defined or migration == False
- name: Install letsencrypt cert - name: Install letsencrypt cert
command: certbot certonly -n --webroot -d {{ mastodon_host | default(ansible_fqdn) }} -w {{ mastodon_home }}/{{ mastodon_path }}/public/ --email "webmaster@{{ mastodon_host | default(ansible_fqdn) }}" --agree-tos && systemctl reload nginx command: certbot certonly -n --webroot -d {{ mastodon_host | default(ansible_facts['fqdn']) }} -w {{ mastodon_home }}/{{ mastodon_path }}/public/ --email "webmaster@{{ mastodon_host | default(ansible_facts['fqdn']) }}" --agree-tos && systemctl reload nginx
when: when:
- not letsencrypt_cert.stat.exists - not letsencrypt_cert.stat.exists
- migration == False or migration is not defined - migration == False or migration is not defined

View File

@@ -1,6 +1,6 @@
--- ---
- debug: - debug:
msg: "Hostname: {{ mastodon_host | default(ansible_fqdn) }}" msg: "Hostname: {{ mastodon_host | default(ansible_facts['fqdn']) }}"
- name: mastodon | Copy nginx config - name: mastodon | Copy nginx config
template: template:

View File

@@ -6,7 +6,7 @@ map $http_upgrade $connection_upgrade {
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name {{ mastodon_host | default(ansible_fqdn) }}; server_name {{ mastodon_host | default(ansible_facts['fqdn']) }};
# Useful for Let's Encrypt # Useful for Let's Encrypt
location /.well-known/acme-challenge/ { allow all; } location /.well-known/acme-challenge/ { allow all; }
@@ -16,7 +16,7 @@ server {
server { server {
listen 443 ssl http2; listen 443 ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
server_name {{ mastodon_host | default(ansible_fqdn) }}; server_name {{ mastodon_host | default(ansible_facts['fqdn']) }};
ssl_protocols TLSv1.2; ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA; ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
@@ -24,8 +24,8 @@ server {
ssl_session_cache shared:SSL:10m; ssl_session_cache shared:SSL:10m;
{% if disable_letsencrypt != "true" %} {% if disable_letsencrypt != "true" %}
ssl_certificate /etc/letsencrypt/live/{{ mastodon_host | default(ansible_fqdn) }}/fullchain.pem; ssl_certificate /etc/letsencrypt/live/{{ mastodon_host | default(ansible_facts['fqdn']) }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ mastodon_host | default(ansible_fqdn) }}/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/{{ mastodon_host | default(ansible_facts['fqdn']) }}/privkey.pem;
{% endif %} {% endif %}
keepalive_timeout 70; keepalive_timeout 70;

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
- block: - block:

View File

@@ -1,9 +1,9 @@
--- ---
# Load distro specific variables # Load distro specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
- include_vars: "{{ ansible_fqdn | lower }}.yml" - include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True
- include_tasks: squid.yaml - include_tasks: squid.yaml

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
@@ -9,7 +9,7 @@
# Perform remaining tasks: # Perform remaining tasks:
- ansible.builtin.import_tasks: caddy_install_debian.yml - ansible.builtin.import_tasks: caddy_install_debian.yml
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- ansible.builtin.import_tasks: caddy_config.yml - ansible.builtin.import_tasks: caddy_config.yml
- ansible.builtin.import_tasks: caddy_service.yml - ansible.builtin.import_tasks: caddy_service.yml

View File

@@ -1,8 +1,8 @@
# Load distro specific variables # Load distro specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
- include_vars: "{{ ansible_fqdn | lower }}.yml" - include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True
- include_tasks: caddy.yml - include_tasks: caddy.yml

View File

@@ -1,15 +1,15 @@
--- ---
# Load distro specific variables # Load distro specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
ignore_errors: True ignore_errors: True
- include_vars: "{{ ansible_fqdn | lower }}.yml" - include_vars: "{{ ansible_facts['fqdn'] | lower }}.yml"
ignore_errors: True ignore_errors: True
- block: - block:
- include_tasks: utilities/mail_transfer_agent.yml - include_tasks: utilities/mail_transfer_agent.yml
- include_tasks: utilities/telegraf.yml - include_tasks: utilities/telegraf.yml
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- include_tasks: utilities/netdata.yml - include_tasks: utilities/netdata.yml
when: netdata is defined and netdata == true when: netdata is defined and netdata == true
- include_tasks: utilities/snmpd.yml - include_tasks: utilities/snmpd.yml

View File

@@ -2,7 +2,7 @@
package: package:
name: "cronie" name: "cronie"
state: latest state: latest
when: ansible_distribution == "Archlinux" when: ansible_facts['distribution'] == "Archlinux"
- name: server | system_setup | cron (VM) - name: server | system_setup | cron (VM)
tags: cron tags: cron

View File

@@ -13,8 +13,8 @@
loop: loop:
- { regex: "^root=.*$", line: "root=rene@tantooine.myfirewall.org"} - { regex: "^root=.*$", line: "root=rene@tantooine.myfirewall.org"}
- { regex: "^mailhub=.*", line: "mailhub=mail.universe.local"} - { regex: "^mailhub=.*", line: "mailhub=mail.universe.local"}
- { regex: "^hostname=.*", line: "hostname={{ ansible_fqdn }}"} - { regex: "^hostname=.*", line: "hostname={{ ansible_facts['fqdn'] }}"}
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Pop!_OS", "Ubuntu", "Linux Mint"]
- name: server | utilities | remove postfix - name: server | utilities | remove postfix
package: package:
name: name:

View File

@@ -13,7 +13,7 @@
group: "root" group: "root"
mode: "0660" mode: "0660"
validate: "{{ commands.visudo }} -cf %s" validate: "{{ commands.visudo }} -cf %s"
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: server | snmpd | create /etc/snmp - name: server | snmpd | create /etc/snmp
ansible.builtin.file: ansible.builtin.file:

View File

@@ -51,12 +51,12 @@
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*hostname\s*=' regexp: '^\s*#?\s*hostname\s*='
line: ' hostname = "{{ ansible_fqdn }}"' line: ' hostname = "{{ ansible_facts['fqdn'] }}"'
owner: root owner: root
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent interval - name: Configure telegraf agent interval
tags: telegraf tags: telegraf
@@ -68,7 +68,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent flush_interval - name: Configure telegraf agent flush_interval
tags: telegraf tags: telegraf
@@ -80,7 +80,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent flush_jitter - name: Configure telegraf agent flush_jitter
tags: telegraf tags: telegraf
@@ -92,7 +92,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent collection_jitter - name: Configure telegraf agent collection_jitter
tags: telegraf tags: telegraf
@@ -104,7 +104,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent metric_batch_size - name: Configure telegraf agent metric_batch_size
tags: telegraf tags: telegraf
@@ -116,7 +116,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent metric_buffer_limit - name: Configure telegraf agent metric_buffer_limit
tags: telegraf tags: telegraf
@@ -128,7 +128,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent round_interval - name: Configure telegraf agent round_interval
tags: telegraf tags: telegraf
@@ -140,7 +140,7 @@
group: root group: root
mode: '0644' mode: '0644'
notify: restart_telegraf notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: server | telegraf | create systemd override directory for telegraf - name: server | telegraf | create systemd override directory for telegraf
ansible.builtin.file: ansible.builtin.file:

View File

@@ -7,7 +7,7 @@
- software-properties-common - software-properties-common
- lsb-release - lsb-release
- ca-certificates - ca-certificates
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_facts['distribution'] in ["Debian", "Ubuntu", "Linux Mint"]
- name: webservers | nextcloud | prereq | get php repo key - name: webservers | nextcloud | prereq | get php repo key
ansible.builtin.uri: ansible.builtin.uri:
@@ -18,7 +18,7 @@
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "/etc/apt/sources.list.d/php.list" path: "/etc/apt/sources.list.d/php.list"
state: present state: present
line: "deb https://packages.sury.org/php/ {{ ansible_distribution_release | lower }} main" line: "deb https://packages.sury.org/php/ {{ ansible_facts['distribution']_release | lower }} main"
create: True create: True
- name: webservers | nextcloud | prereq | install php - name: webservers | nextcloud | prereq | install php

View File

@@ -1,5 +1,5 @@
# Load distro-specific variables # Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml" - include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"
tags: always tags: always
- block: - block:

View File

@@ -6,23 +6,23 @@
become_user: root become_user: root
command: command:
cmd: "git remote set-url origin ssh://git@gitea.mewissen.site:22422/rene/dotfiles.git" cmd: "git remote set-url origin ssh://git@gitea.mewissen.site:22422/rene/dotfiles.git"
chdir: "{{ ansible_user_dir }}/dotfiles" chdir: "{{ ansible_facts['user_dir'] }}/dotfiles"
- name: "git default settings" - name: "git default settings"
become: true become: true
become_user: root become_user: root
command: command:
cmd: "git config pull.rebase false" cmd: "git config pull.rebase false"
chdir: "{{ ansible_user_dir }}/dotfiles" chdir: "{{ ansible_facts['user_dir'] }}/dotfiles"
# - name: "git pull" # - name: "git pull"
# become: yes # become: yes
# command: # command:
# cmd: "git pull" # cmd: "git pull"
# chdir: "{{ ansible_user_dir }}/dotfiles" # chdir: "{{ ansible_facts['user_dir'] }}/dotfiles"
- name: "remove cronjob for ansible" - name: "remove cronjob for ansible"
become: false become: false
cron: cron:
name: "ansible provision" name: "ansible provision"
user: "{{ ansible_user_id }}" user: "{{ ansible_facts['user_id'] }}"
job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_update.log || cat /var/log/ansible_update.log' job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_update.log || cat /var/log/ansible_update.log'
state: present state: present
minute: 0 minute: 0
@@ -32,7 +32,7 @@
become_user: root become_user: root
cron: cron:
name: "ansible provision" name: "ansible provision"
user: "{{ ansible_user_id }}" user: "{{ ansible_facts['user_id'] }}"
job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_update.log || cat /var/log/ansible_update.log' job: 'ansible-pull --vault-password-file=~/.vaultpass -U "https://gitea.mewissen.site/rene/ansible-pull.git" -d "/opt/ansible-pull" -C master > /var/log/ansible_update.log || cat /var/log/ansible_update.log'
state: present state: present
minute: 0 minute: 0