Skip to content
Snippets Groups Projects
Commit 6beb8773 authored by Jörg Sachse's avatar Jörg Sachse
Browse files

style: satisfy linter

parent ae911508
No related branches found
No related tags found
No related merge requests found
Pipeline #3553 passed
--- ---
- name: save iptables rules (Debian) - name: save iptables rules (Debian)
when: ansible_os_family == "Debian"
block: block:
- name: Ordner für iptables-Config erstellen - name: Ordner für iptables-Config erstellen
ansible.builtin.file: ansible.builtin.file:
...@@ -18,9 +19,9 @@ ...@@ -18,9 +19,9 @@
- name: save iptables rules - name: save iptables rules
ansible.builtin.command: 'netfilter-persistent save' # noqa no-changed-when ansible.builtin.command: 'netfilter-persistent save' # noqa no-changed-when
listen: "save iptables rules" listen: "save iptables rules"
when: ansible_os_family == "Debian"
- name: save iptables rules (RedHat) - name: save iptables rules (RedHat)
when: ansible_os_family == "RedHat"
block: block:
- name: make sure iptables config file exists - name: make sure iptables config file exists
ansible.builtin.file: ansible.builtin.file:
...@@ -34,7 +35,6 @@ ...@@ -34,7 +35,6 @@
- name: save rules - name: save rules
ansible.builtin.command: /usr/sbin/iptables-save # noqa no-changed-when ansible.builtin.command: /usr/sbin/iptables-save # noqa no-changed-when
listen: "save iptables rules" listen: "save iptables rules"
when: ansible_os_family == "RedHat"
- name: restart exim - name: restart exim
ansible.builtin.systemd: ansible.builtin.systemd:
......
--- ---
galaxy_info: galaxy_info:
role_name: "ansible_lza_install_common"
namespace: "slub"
author: Jörg Sachse author: Jörg Sachse
company: SLUB Dresden company: SLUB Dresden
description: role to deploy a base install of Debian for use in the SLUBarchiv digital preservation repository description: role to deploy a base install of Debian for use in the SLUBarchiv digital preservation repository
......
--- ---
- hosts: "*" - name: "install generic base server"
hosts: "*"
pre_tasks: pre_tasks:
- name: Verify that the installed version of Ansible meets this playbook's version requirements. - name: Verify that the installed version of Ansible meets this playbook's version requirements.
assert: ansible.builtin.assert:
that: "ansible_version.full is version_compare('2.2', '>=')" that: "ansible_version.full is version_compare('2.2', '>=')"
msg: > msg: >
"You must update Ansible to at least 2.2 to use this playbook." "You must update Ansible to at least 2.2 to use this playbook."
...@@ -24,4 +25,4 @@ ...@@ -24,4 +25,4 @@
strategy: linear strategy: linear
roles: roles:
- { role: ansible_lza_install_common, become: true } - { role: "ansible_lza_install_common", become: true }
--- ---
- name: remove apt-cron autoupdate (Debian) - name: remove apt-cron autoupdate (Debian)
when: ansible_os_family == "Debian"
block: block:
- name: Uninstall autoupdate packages (Debian) - name: Uninstall autoupdate packages (Debian)
ansible.builtin.apt: ansible.builtin.apt:
...@@ -13,11 +14,11 @@ ...@@ -13,11 +14,11 @@
- "/etc/cron-apt/action.d/3-download" - "/etc/cron-apt/action.d/3-download"
- "/etc/cron-apt/config" - "/etc/cron-apt/config"
- "/etc/cron.d/cron-apt" - "/etc/cron.d/cron-apt"
when: ansible_os_family == "Debian"
# unattended-upgrades is the default in Debian 11 and new GUBS installations # unattended-upgrades is the default in Debian 11 and new GUBS installations
# anyway, so we use it instead of cron-apt. # anyway, so we use it instead of cron-apt.
- name: Install & configure unattended-upgrades (Debian/Ubuntu) - name: Install & configure unattended-upgrades (Debian/Ubuntu)
when: ansible_os_family == "Debian"
block: block:
- name: install unattended-upgrades - name: install unattended-upgrades
ansible.builtin.apt: ansible.builtin.apt:
...@@ -49,10 +50,10 @@ ...@@ -49,10 +50,10 @@
ansible.builtin.file: ansible.builtin.file:
path: "/etc/apt/apt.conf.d/51only-security-upgrades" path: "/etc/apt/apt.conf.d/51only-security-upgrades"
state: absent state: absent
when: ansible_os_family == "Debian"
# based on: https://access.redhat.com/solutions/2823901 # based on: https://access.redhat.com/solutions/2823901
- name: Install & configurate autoupdate (RedHat) - name: Install & configurate autoupdate (RedHat)
when: ansible_os_family == "RedHat"
block: block:
- name: include vars yum-cron.yml - name: include vars yum-cron.yml
ansible.builtin.include_vars: "yum-cron.yml" ansible.builtin.include_vars: "yum-cron.yml"
...@@ -70,4 +71,3 @@ ...@@ -70,4 +71,3 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when: ansible_os_family == "RedHat"
--- ---
- name: configure Debian repositories - name: configure Debian repositories
when: "ansible_facts['distribution'] == 'Debian'"
block: block:
- name: öffentlichen Schlüssel hinzufügen (sonst muss bei jeder Installation eine Warnmeldung bestätigt werden) - name: öffentlichen Schlüssel hinzufügen (sonst muss bei jeder Installation eine Warnmeldung bestätigt werden)
ansible.builtin.apt_key: ansible.builtin.apt_key:
...@@ -12,7 +13,6 @@ ...@@ -12,7 +13,6 @@
state: present state: present
update_cache: "yes" update_cache: "yes"
mode: "0644" mode: "0644"
when: "ansible_facts['distribution'] == 'Debian'"
- name: add custom repositories - name: add custom repositories
ansible.builtin.yum_repository: ansible.builtin.yum_repository:
......
--- ---
- name: gültige SSH-Keys für Public-Key Authentication einspielen (HUMAN_USERS) - name: gültige SSH-Keys für Public-Key Authentication einspielen (HUMAN_USERS)
ansible.builtin.authorized_key: ansible.posix.authorized_key:
user: "{{ item.key }}" user: "{{ item.key }}"
comment: "{{ item.value.ssh_comment_current | default('') }}" comment: "{{ item.value.ssh_comment_current | default('') }}"
key: "{{ item.value.ssh_key_current | default('') }}" key: "{{ item.value.ssh_key_current | default('') }}"
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
when: item.value.state != "absent" when: item.value.state != "absent"
- name: gültige SSH-Keys für Public-Key Authentication einspielen (ROBOT_USERS) - name: gültige SSH-Keys für Public-Key Authentication einspielen (ROBOT_USERS)
ansible.builtin.authorized_key: ansible.posix.authorized_key:
user: "{{ item.key }}" user: "{{ item.key }}"
comment: "{{ item.value.ssh_comment_current | default('') }}" comment: "{{ item.value.ssh_comment_current | default('') }}"
key: "{{ item.value.ssh_key_current | default('') }}" key: "{{ item.value.ssh_key_current | default('') }}"
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
when: item.value.state != "absent" when: item.value.state != "absent"
- name: alle gültigen SSH-Keys zum Installationsuser hinzufügen - name: alle gültigen SSH-Keys zum Installationsuser hinzufügen
ansible.builtin.authorized_key: ansible.posix.authorized_key:
user: "{{ vault_install_username }}" user: "{{ vault_install_username }}"
comment: "{{ item.value.ssh_comment_current | default('') }}" comment: "{{ item.value.ssh_comment_current | default('') }}"
key: "{{ item.value.ssh_key_current | default('') }}" key: "{{ item.value.ssh_key_current | default('') }}"
......
--- ---
- name: configure zram based swap (Debian) - name: configure zram based swap (Debian)
when: ansible_os_family == "Debian"
block: block:
- name: install zram - name: install zram
ansible.builtin.package: ansible.builtin.package:
...@@ -12,11 +13,11 @@ ...@@ -12,11 +13,11 @@
ALGO=lz4 ALGO=lz4
PERCENT=50 PERCENT=50
notify: restart zramswap notify: restart zramswap
when: ansible_os_family == "Debian"
# RHEL part is based on https://www.techrepublic.com/article/how-to-enable-zram-rocky-linux/ # RHEL part is based on https://www.techrepublic.com/article/how-to-enable-zram-rocky-linux/
# More docu on zram at https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html # More docu on zram at https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html
- name: configure zram based swap (RedHat) - name: configure zram based swap (RedHat)
when: ansible_os_family == "RedHat"
block: block:
- name: disable swapping first, otherwise zram will not work - name: disable swapping first, otherwise zram will not work
ansible.builtin.command: "swapoff -a" ansible.builtin.command: "swapoff -a"
...@@ -71,7 +72,6 @@ ...@@ -71,7 +72,6 @@
dest: "/usr/local/lib/systemd/system/zramswap.service" dest: "/usr/local/lib/systemd/system/zramswap.service"
mode: "0644" mode: "0644"
notify: restart zramswap notify: restart zramswap
when: ansible_os_family == "RedHat"
- name: configure zram based swap (common) - name: configure zram based swap (common)
block: block:
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# Äquivalent von yum update # Äquivalent von yum update
- name: update packages (RedHat) - name: update packages (RedHat)
when: ansible_os_family == "RedHat"
block: block:
- name: yum update - name: yum update
ansible.builtin.yum: ansible.builtin.yum:
...@@ -16,7 +17,6 @@ ...@@ -16,7 +17,6 @@
- name: yum autoremove - name: yum autoremove
ansible.builtin.yum: ansible.builtin.yum:
autoremove: true autoremove: true
when: ansible_os_family == "RedHat"
- name: uninstall packages - name: uninstall packages
ansible.builtin.apt: ansible.builtin.apt:
......
...@@ -14,134 +14,134 @@ ...@@ -14,134 +14,134 @@
### PAKETINSTALLATIONEN ### ### PAKETINSTALLATIONEN ###
# - name: Netzwerk konfigurieren # - name: Netzwerk konfigurieren
# import_tasks: configure-network.yml # ansible.builtin.import_tasks: configure-network.yml
# tags: [network,dns] # tags: [network,dns]
# We don't test for idempotence because these tasks can never be idempotent. # We don't test for idempotence because these tasks can never be idempotent.
# They are meant to copy fresh Backups of the SSH keys every time they are run. # They are meant to copy fresh Backups of the SSH keys every time they are run.
- name: Server-SSH-Schlüssel sichern - name: Server-SSH-Schlüssel sichern
import_tasks: backup_ssh_hostkeys.yml ansible.builtin.import_tasks: "backup_ssh_hostkeys.yml"
tags: [ssh, molecule-idempotence-notest] tags: [ssh, molecule-idempotence-notest]
- name: SLUB-lokales Debian-Repository hinzufügen - name: SLUB-lokales Debian-Repository hinzufügen
import_tasks: configure_package_repositories.yml ansible.builtin.import_tasks: "configure_package_repositories.yml"
tags: [apt, yum, packages] tags: [apt, yum, packages]
- name: NTP-Client - name: NTP-Client
import_tasks: migrate_ntpd_to_esxi_timesync.yml ansible.builtin.import_tasks: "migrate_ntpd_to_esxi_timesync.yml"
when: # implicit AND when passing a list when: # implicit AND when passing a list
- ansible_facts.virtualization_role == "guest" - ansible_facts.virtualization_role == "guest"
- ansible_facts.virtualization_type == "VMware" - ansible_facts.virtualization_type == "VMware"
tags: [ntp, ntpd, time] tags: [ntp, ntpd, time]
- name: Systempakete installieren - name: Systempakete installieren
import_tasks: install_packages.yml ansible.builtin.import_tasks: "install_packages.yml"
tags: [apt, yum, packages] tags: [apt, yum, packages]
- name: HotAdd-Scripte für VMware installieren - name: HotAdd-Scripte für VMware installieren
import_tasks: install_hotadd_scripts.yml ansible.builtin.import_tasks: "install_hotadd_scripts.yml"
tags: [hotadd] tags: [hotadd]
- name: Lzip-Tools installieren - name: Lzip-Tools installieren
import_tasks: install_lzip_tools.yml ansible.builtin.import_tasks: "install_lzip_tools.yml"
tags: [lzip, lziptools] tags: [lzip, lziptools]
### KONFIGURATION ### ### KONFIGURATION ###
- name: Bash (Prompt, Aliases etc.) konfigurieren - name: Bash (Prompt, Aliases etc.) konfigurieren
import_tasks: configure_bash.yml ansible.builtin.import_tasks: "configure_bash.yml"
tags: [bash] tags: [bash]
- name: Autoupdate konfigurieren - name: Autoupdate konfigurieren
import_tasks: configure_autoupdate.yml ansible.builtin.import_tasks: "configure_autoupdate.yml"
tags: [apt, yum, packages] tags: [apt, yum, packages]
- name: Konfigurationsdateien einspielen - SSH-Login - name: Konfigurationsdateien einspielen - SSH-Login
import_tasks: configure_ssh_login.yml ansible.builtin.import_tasks: "configure_ssh_login.yml"
tags: [ssh, bash] tags: [ssh, bash]
- name: Konfigurationsdateien einspielen - HTOP - name: Konfigurationsdateien einspielen - HTOP
import_tasks: configure_htop.yml ansible.builtin.import_tasks: "configure_htop.yml"
tags: [htop] tags: [htop]
- name: tmux konfigurieren - name: tmux konfigurieren
import_tasks: configure_tmux.yml ansible.builtin.import_tasks: "configure_tmux.yml"
tags: [tmux] tags: [tmux]
- name: logrotate konfigurieren - name: logrotate konfigurieren
import_tasks: configure_logrotate.yml ansible.builtin.import_tasks: "configure_logrotate.yml"
tags: [log, logrotate] tags: [log, logrotate]
- name: motd Script einspielen - name: motd Script einspielen
import_tasks: configure_motd.yml ansible.builtin.import_tasks: "configure_motd.yml"
tags: [motd] tags: [motd]
- name: Gruppen und Benutzer erzeugen - name: Gruppen und Benutzer erzeugen
import_tasks: create_users_groups.yml ansible.builtin.import_tasks: "create_users_groups.yml"
tags: [users] tags: [users]
- name: SSH-Keys verwalten - name: SSH-Keys verwalten
import_tasks: configure_ssh_keys.yml ansible.builtin.import_tasks: "configure_ssh_keys.yml"
tags: [users] tags: [users]
- name: ungültige User und SSH-Keys entfernen - name: ungültige User und SSH-Keys entfernen
import_tasks: remove_users_keys.yml ansible.builtin.import_tasks: "remove_users_keys.yml"
tags: [ssh, users, cleanup] tags: [ssh, users, cleanup]
- name: Logging auf Syslog-Server einrichten - name: Logging auf Syslog-Server einrichten
import_tasks: configure_syslog_server_logging.yml ansible.builtin.import_tasks: "configure_syslog_server_logging.yml"
tags: [log, syslog] tags: [log, syslog]
- name: persistentes Journalctl-Logging einrichten - name: persistentes Journalctl-Logging einrichten
import_tasks: configure_persistent_journald_logging.yml ansible.builtin.import_tasks: "configure_persistent_journald_logging.yml"
tags: [log] tags: [log]
- name: Needrestart installieren - name: Needrestart installieren
import_tasks: install_needrestart.yml ansible.builtin.import_tasks: "install_needrestart.yml"
when: ansible_distribution == "Debian" when: ansible_distribution == "Debian"
tags: [apt, needrestart] tags: [apt, needrestart]
- name: Check_MK-Plugins installieren - name: Check_MK-Plugins installieren
import_tasks: install_checkmk_plugins.yml ansible.builtin.import_tasks: "install_checkmk_plugins.yml"
tags: [monitoring] tags: [monitoring]
- name: root-Shell einrichten - name: root-Shell einrichten
import_tasks: configure_root_shell.yml ansible.builtin.import_tasks: "configure_root_shell.yml"
tags: [bash, root, shell, color] tags: [bash, root, shell, color]
- name: root-Shell einrichten - name: root-Shell einrichten
import_tasks: configure_sudoers.yml ansible.builtin.import_tasks: "configure_sudoers.yml"
tags: [sudo] tags: [sudo]
- name: Configure swap - name: Configure swap
import_tasks: configure_swap.yml ansible.builtin.import_tasks: "configure_swap.yml"
tags: [swap, vm] tags: [swap, vm]
- name: sar konfigurieren - name: sar konfigurieren
import_tasks: configure_sar.yml ansible.builtin.import_tasks: "configure_sar.yml"
tags: [sar, sysstat] tags: [sar, sysstat]
- name: Exim konfigurieren - name: Exim konfigurieren
import_tasks: configure_exim.yml ansible.builtin.import_tasks: "configure_exim.yml"
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
tags: [exim, mail] tags: [exim, mail]
- name: Postfix konfigurieren - name: Postfix konfigurieren
import_tasks: configure_postfix.yml ansible.builtin.import_tasks: "configure_postfix.yml"
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
tags: [postfix, mail] tags: [postfix, mail]
# - name: Glances-Server abschalten # - name: Glances-Server abschalten
# import_tasks: configure_glances.yml # ansible.builtin.import_tasks: "configure_glances.yml"
# when: ansible_os_family != "RedHat" # RHEL 7 still runs Glances 2.5, which doesn't come with the glances.service SystemD unit # when: ansible_os_family != "RedHat" # RHEL 7 still runs Glances 2.5, which doesn't come with the glances.service SystemD unit
# tags: [glances] # tags: [glances]
### CGROUP FÜR CHECK_MK KONFIGURIEREN ### ### CGROUP FÜR CHECK_MK KONFIGURIEREN ###
# - name: include cgroup CMK config # - name: include cgroup CMK config
# import_tasks: cgroup_check_mk.yml # ansible.builtin.import_tasks: "cgroup_check_mk.yml"
# tags: [always] # tags: [always]
- name: NTP konfigurieren - name: NTP konfigurieren
import_tasks: configure_ntp.yml ansible.builtin.import_tasks: "configure_ntp.yml"
tags: [ntp] tags: [ntp]
- name: Configure Network - name: Configure Network
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment