This commit is contained in:
Christoph 2021-11-10 15:52:13 +01:00
parent 877fb3a778
commit 1042396802
6 changed files with 90 additions and 54 deletions

View File

@ -65,6 +65,7 @@
name: "{{ apt_initial_install_stretch }}" name: "{{ apt_initial_install_stretch }}"
state: "{{ apt_install_state }}" state: "{{ apt_install_state }}"
when: when:
- apt_initial_install_stretch is defined and apt_initial_install_stretch|length > 0
- ansible_facts['distribution'] == "Debian" - ansible_facts['distribution'] == "Debian"
- ansible_facts['distribution_major_version'] == "9" - ansible_facts['distribution_major_version'] == "9"
tags: tags:
@ -76,12 +77,25 @@
name: "{{ apt_initial_install_buster }}" name: "{{ apt_initial_install_buster }}"
state: "{{ apt_install_state }}" state: "{{ apt_install_state }}"
when: when:
- apt_initial_install_buster is defined and apt_initial_install_buster|length > 0
- ansible_facts['distribution'] == "Debian" - ansible_facts['distribution'] == "Debian"
- ansible_facts['distribution_major_version'] == "10" - ansible_facts['distribution_major_version'] == "10"
tags: tags:
- apt-initial-install - apt-initial-install
- name: (apt.yml) Initial install debian packages (bullseye)
apt:
name: "{{ apt_initial_install_bullseye }}"
state: "{{ apt_install_state }}"
when:
- apt_initial_install_bullseye is defined and apt_initial_install_bullseye|length > 0
- ansible_facts['distribution'] == "Debian"
- ansible_facts['distribution_major_version'] == "11"
tags:
- apt-initial-install
- name: (apt.yml) Initial install ubuntu packages (bionic) - name: (apt.yml) Initial install ubuntu packages (bionic)
apt: apt:
name: "{{ apt_initial_install_bionic }}" name: "{{ apt_initial_install_bionic }}"
@ -122,30 +136,15 @@
- apt-microcode - apt-microcode
- name: (apt.yml) Ensure we have CPU microcode from backports for AMD CPU (debian stretch) - name: (apt.yml) Install CPU microcode (debian buster/bullseye)
apt:
name: "{{ microcode_amd_package }}"
state: present
default_release: "{{ ansible_distribution_release }}-backports"
when:
- apt_backports_enable
- apt_debian_contrib_nonfree_enable
- ansible_facts['distribution'] == "Debian"
- ansible_facts['distribution_major_version'] == "9"
- ansible_facts['processor']|string is search("AMD")
tags:
- apt-initial-install
- apt-microcode
- name: (apt.yml) Install CPU microcode for Intel CPU (debian buster)
apt: apt:
name: "{{ microcode_intel_package }}" name: "{{ microcode_intel_package }}"
state: present state: present
default_release: "{{ ansible_distribution_release }}" default_release: "{{ ansible_distribution_release }}"
when: when:
- apt_debian_contrib_nonfree_enable
- ansible_facts['distribution'] == "Debian" - ansible_facts['distribution'] == "Debian"
- ansible_facts['distribution_major_version'] == "10" - ansible_facts['distribution_major_version'] == "10" or ansible_facts['distribution_major_version'] == "11"
- ansible_facts['processor']|string is search("Intel") - ansible_facts['processor']|string is search("Intel")
tags: tags:
- apt-initial-install - apt-initial-install
@ -228,7 +227,7 @@
# Firmware # Firmware
# --- # ---
- name: (apt.yml) Install Firmware packages - name: (apt.yml) Install Firmware packages (Ubuntu)
apt: apt:
name: "{{ firmware_packages_ubuntu }}" name: "{{ firmware_packages_ubuntu }}"
state: present state: present
@ -239,7 +238,8 @@
- apt-initial-install - apt-initial-install
- apt-firmware - apt-firmware
- name: (apt.yml) Install Firmware packages
- name: (apt.yml) Install Firmware packages (Debian)
apt: apt:
name: "{{ firmware_packages_debian }}" name: "{{ firmware_packages_debian }}"
state: present state: present
@ -251,7 +251,7 @@
- apt-firmware - apt-firmware
- name: (apt.yml) Install non-free Firmware packages - name: (apt.yml) Install non-free Firmware packages (Debian)
apt: apt:
name: "{{ firmware_non_free_packages_debian }}" name: "{{ firmware_non_free_packages_debian }}"
state: present state: present

View File

@ -101,6 +101,13 @@
- samba-remove-user - samba-remove-user
# tags supported inside system-remove-user.yml:
#
- import_tasks: system-remove-user.yml
tags:
- system-remove-user
# tags supported inside system-user.yml: # tags supported inside system-user.yml:
# #
# system-user # system-user

View File

@ -1,32 +1,32 @@
--- ---
# --- ## # ---
# - Remove unwanted users ## # - Remove unwanted users
# --- ## # ---
##
- name: (nis_user.yml) Remove (old) users from system ## - name: (nis_user.yml) Remove (old) users from system
user: ## user:
name: '{{ item.name }}' ## name: '{{ item.name }}'
state: absent ## state: absent
with_items: ## with_items:
- "{{ remove_nis_users }}" ## - "{{ remove_nis_users }}"
loop_control: ## loop_control:
label: '{{ item.name }}' ## label: '{{ item.name }}'
tags: ## tags:
- nis-user ## - nis-user
- system-user ## - system-user
##
- name: (nis_user.yml) Remove home directory from deleted users ## - name: (nis_user.yml) Remove home directory from deleted users
file: ## file:
path: '{{ nis_base_home }}/{{ item.name }}' ## path: '{{ nis_base_home }}/{{ item.name }}'
state: absent ## state: absent
with_items: ## with_items:
- "{{ remove_nis_users }}" ## - "{{ remove_nis_users }}"
loop_control: ## loop_control:
label: '{{ item.name }}' ## label: '{{ item.name }}'
tags: ## tags:
- nis-user ## - nis-user
- system-user ## - system-user
# --- # ---
# - default user/groups # - default user/groups

View File

@ -105,7 +105,7 @@
- samba-server - samba-server
- name: Check if cleaning up trash dirs is configured - name: (samba-install.yml) Check if cleaning up trash dirs is configured
lineinfile: lineinfile:
path: /root/bin/samba/conf/clean_samba_trash.conf path: /root/bin/samba/conf/clean_samba_trash.conf
regexp: "^trash_dirs=*" regexp: "^trash_dirs=*"
@ -117,7 +117,7 @@
- "groups['samba_server']|string is search(inventory_hostname)" - "groups['samba_server']|string is search(inventory_hostname)"
- name: Creates a cron job for cleaning up samba trash dirs - name: (samba-install.yml) Creates a cron job for cleaning up samba trash dirs
cron: cron:
name: '{{ samba_cronjob_trash_dirs.name }}' name: '{{ samba_cronjob_trash_dirs.name }}'
minute: '{{ samba_cronjob_trash_dirs.minute }}' minute: '{{ samba_cronjob_trash_dirs.minute }}'
@ -154,7 +154,7 @@
- samba-server - samba-server
- name: Creates a cron job for cleaning up samba trash dirs - name: (samba-install.yml) Creates a cron job for cleaning up samba trash dirs
cron: cron:
name: '{{ samba_cronjob_permissions.name }}' name: '{{ samba_cronjob_permissions.name }}'
minute: '{{ samba_cronjob_permissions.minute }}' minute: '{{ samba_cronjob_permissions.minute }}'

View File

@ -36,7 +36,7 @@
register: samba_remove_nis_users_present register: samba_remove_nis_users_present
changed_when: "samba_remove_nis_users_present.rc == 0" changed_when: "samba_remove_nis_users_present.rc == 0"
failed_when: "samba_remove_nis_users_present.rc > 1" failed_when: "samba_remove_nis_users_present.rc > 1"
with_items: with_items:
- "{{ remove_nis_users }}" - "{{ remove_nis_users }}"
loop_control: loop_control:
label: '{{ item.name }}' label: '{{ item.name }}'
@ -47,11 +47,11 @@
- name: (samba-remove-user.yml) Remove (old) nis users from samba - name: (samba-remove-user.yml) Remove (old) nis users from samba
shell: > shell: >
smbpasswd -s -x {{ item.item.name }} smbpasswd -s -x {{ item.item.name }}
with_items: with_items:
- "{{ samba_remove_nis_users_present.results }}" - "{{ samba_remove_nis_users_present.results }}"
loop_control: loop_control:
label: '{{ item.item.name }}' label: '{{ item.item.name }}'
when: when:
- item.changed - item.changed
tags: tags:
- samba-user - samba-user

View File

@ -0,0 +1,29 @@
---
# ---
# - Remove unwanted users
# ---
- name: (system-remove-user.yml) Remove (old) users from system
user:
name: '{{ item.name }}'
state: absent
with_items:
- "{{ remove_nis_users }}"
loop_control:
label: '{{ item.name }}'
tags:
- nis-user
- system-user
- name: (system-remove-user.yml) Remove home directory from deleted users
file:
path: '{{ nis_base_home }}/{{ item.name }}'
state: absent
with_items:
- "{{ remove_nis_users }}"
loop_control:
label: '{{ item.name }}'
tags:
- nis-user
- system-user