Make tests for group membership more readable

This commit is contained in:
Andreas B. Mundt 2024-11-21 11:20:26 +01:00
parent 8a25609749
commit 77f4643628
9 changed files with 24 additions and 24 deletions

View file

@ -92,7 +92,7 @@
- plasma-discover
autoremove: true
state: absent
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Make sure wireshark works for all users after installation and upgrades
ansible.builtin.copy:
@ -160,7 +160,7 @@
- pwroff.timer
- reporter.service
- reporter.timer
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Enable pwroff.timer
systemd:
@ -169,13 +169,13 @@
loop:
- pwroff.timer
- reporter.timer
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: PXE first boot order
command: /usr/local/sbin/bootorder.sh
register: cmd_result
changed_when: cmd_result.stdout is not search('Nothing to do.')
when: groups.PCroom is defined and inventory_hostname in groups.PCroom
when: "'PCroom' in group_names"
- name: Copy dolphin config scripts
ansible.builtin.copy:
@ -220,7 +220,7 @@
[AC][SuspendSession]
idleTime=7200000
suspendType=8
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Start with empty session by default
ansible.builtin.copy:
@ -251,7 +251,7 @@
Exec=lmn-fix-screen
Type=Application
NoDisplay=true
when: groups.CloneScreen is defined and inventory_hostname in groups.CloneScreen
when: "'CloneScreen' in group_names"
#- name: Avoid starting kscreen (confusing autodetection)
# ansible.builtin.copy:

View file

@ -117,7 +117,7 @@
path: /etc/systemd/sleep.conf.d/
state: directory
mode: '0755'
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Avoid suspending
ansible.builtin.blockinfile:
@ -129,7 +129,7 @@
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Deploy dolphin script
ansible.builtin.copy:

View file

@ -7,7 +7,7 @@
https_proxy="{{ proxy }}"
ftp_proxy="{{ proxy }}"
no_proxy="{{ no_proxy }}"
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Set aptcache
ansible.builtin.copy:
@ -27,4 +27,4 @@
deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-proposed-updates
main non-free-firmware
state: present
when: groups.R202 is defined and inventory_hostname in groups.R202
when: "'R202' in group_names"

View file

@ -12,7 +12,7 @@
ipv4.route-metric=2048
[keyfile]
unmanaged-devices=interface-name:en*;interface-name:vm*
when: groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop
when: "'teacherlaptop' in group_names"
- name: Use iwd for USB-Wlan-Sticks but ignore interfaces managed by systemd-networkd (wlan0,en*)
blockinfile:
@ -26,7 +26,7 @@
ipv4.route-metric=2048
[keyfile]
unmanaged-devices=interface-name:wlan0;interface-name:en*;interface-name:vm*
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Enable Networkmanager
ansible.builtin.systemd:
@ -59,7 +59,7 @@
Name=enx{{ ansible_facts[ansible_interfaces | select('search', '^enp.*') | first].macaddress | replace(':','') }}
[Network]
Bridge=virbr1
when: groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop
when: "'teacherlaptop' in group_names"
- name: Configure systemd-networkd ethernet.network
ansible.builtin.copy:
@ -113,7 +113,7 @@
DHCP=yes
[DHCPv4]
UseDomains=true
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Enable systemd-networkd
ansible.builtin.systemd:

View file

@ -38,7 +38,7 @@
line: 'SystemGroup root lpadmin role-teacher'
regexp: '^SystemGroup'
state: present
when: groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop
when: "'teacherlaptop' in group_names"
- name: Disable cups-browsed
ansible.builtin.systemd:

View file

@ -17,6 +17,6 @@ ad_gpo_access_control = disabled
ad_gpo_ignore_unreadable = True
ad_maximum_machine_account_password_age = 0
ignore_group_members = True
{% if groups.localhome is defined and inventory_hostname in groups.localhome %}
{% if 'localhome' in group_names %}
override_homedir = /home/%u
{% endif %}

View file

@ -60,7 +60,7 @@
><not><or><user>root</user><user>ansible</user><user>Debian-gdm</user><user>sddm</user><user>{{ localuser }}</user></or></not>
</volume>
insertafter: "<!-- END ANSIBLE MANAGED BLOCK .* -->"
when: groups.localhome is defined and inventory_hostname in groups.localhome
when: "'localhome' in group_names"
- name: Use umount script for proper cleanup
blockinfile:

View file

@ -57,11 +57,11 @@
[Install]
WantedBy=multi-user.target
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"
- name: Enable the enable-wifi service
ansible.builtin.systemd:
name: enable-wifi.service
enabled: True
daemon_reload: True
when: not (groups.teacherlaptop is defined and inventory_hostname in groups.teacherlaptop)
when: "'teacherlaptop' not in group_names"