Improve ansible code so that ansibe-lint shows fewer errors

This commit is contained in:
Raphael Dannecker 2025-03-24 07:33:56 +01:00
parent e8ef744f59
commit f965f4466c
23 changed files with 228 additions and 189 deletions

View file

@ -20,16 +20,17 @@
- name: Apply common configuration to the machines - name: Apply common configuration to the machines
hosts: all # desktop:laptop hosts: all # desktop:laptop
remote_user: ansible remote_user: ansible
become: yes become: true
pre_tasks: pre_tasks:
- pause: - name: Ask for global-admin AD password
ansible.builtin.pause:
prompt: "Enter global-admin AD password. Leave empty to skip domain join" prompt: "Enter global-admin AD password. Leave empty to skip domain join"
echo: false echo: false
register: adpw register: adpw
no_log: true no_log: true
when: "ansible_cmdline.adpw is not defined" when: "ansible_cmdline.adpw is not defined"
- name: Preseed apparmor - name: Preseed apparmor
debconf: ansible.builtin.debconf:
name: apparmor name: apparmor
question: apparmor/homedirs question: apparmor/homedirs
value: >- value: >-
@ -38,7 +39,7 @@
/srv/samba/schools/default-school/examusers/ /srv/samba/schools/default-school/examusers/
vtype: string vtype: string
- name: Preseed unattended-upgrades - name: Preseed unattended-upgrades
debconf: ansible.builtin.debconf:
name: unattended-upgrades name: unattended-upgrades
question: unattended-upgrades/enable_auto_updates question: unattended-upgrades/enable_auto_updates
value: true value: true
@ -115,13 +116,13 @@
tasks: tasks:
## Temporary fixes and quirks: ## Temporary fixes and quirks:
- name: Remove disturbing NetworkManager connection - name: Remove disturbing NetworkManager connection
file: ansible.builtin.file:
path: "/etc/NetworkManager/system-connections/Wired connection 1" path: "/etc/NetworkManager/system-connections/Wired connection 1"
state: absent state: absent
when: ansible_interfaces | select('search', '^en[pso].+') | length > 1 when: ansible_interfaces | select('search', '^en[pso].+') | length > 1
- name: Fix 8086:4909 external graphics card - name: Fix 8086:4909 external graphics card
replace: ansible.builtin.replace:
dest: "/etc/default/grub" dest: "/etc/default/grub"
regexp: 'GRUB_CMDLINE_LINUX=""$' regexp: 'GRUB_CMDLINE_LINUX=""$'
replace: 'GRUB_CMDLINE_LINUX="i915.force_probe=4909"' replace: 'GRUB_CMDLINE_LINUX="i915.force_probe=4909"'
@ -129,7 +130,7 @@
when: ansible_board_vendor == "LENOVO" and ansible_board_name == "32CB" when: ansible_board_vendor == "LENOVO" and ansible_board_name == "32CB"
- name: Fix sound on 312A - name: Fix sound on 312A
replace: ansible.builtin.replace:
dest: "/etc/default/grub" dest: "/etc/default/grub"
regexp: 'GRUB_CMDLINE_LINUX="snd-intel-dspcfg.dsp_driver=1"$' regexp: 'GRUB_CMDLINE_LINUX="snd-intel-dspcfg.dsp_driver=1"$'
replace: 'GRUB_CMDLINE_LINUX=""' replace: 'GRUB_CMDLINE_LINUX=""'
@ -137,7 +138,7 @@
when: ansible_board_vendor == "LENOVO" and ansible_board_name == "312A" when: ansible_board_vendor == "LENOVO" and ansible_board_name == "312A"
- name: Fix sound on 312A and 312D - name: Fix sound on 312A and 312D
apt: ansible.builtin.apt:
name: firmware-sof-signed name: firmware-sof-signed
state: latest state: latest
when: > when: >
@ -145,31 +146,32 @@
(ansible_board_name == "312D" or ansible_board_name == "312A") (ansible_board_name == "312D" or ansible_board_name == "312A")
- name: Install customized CodeBlocks packages - name: Install customized CodeBlocks packages
when: "'PCroom' in group_names"
block: block:
- name: Check for old CodeBlocks - name: Check for old CodeBlocks
command: ansible.builtin.command:
cmd: dpkg -l codeblocks cmd: dpkg -l codeblocks
register: codeblocks_version register: codeblocks_version
changed_when: False changed_when: false
- name: Download codeblocks zip archive - name: Download codeblocks zip archive
ansible.builtin.get_url: ansible.builtin.get_url:
url: "http://livebox.pn.steinbeis.schule/codeblocks/CodeBlocks.zip" url: "http://livebox.pn.steinbeis.schule/codeblocks/CodeBlocks.zip"
dest: /tmp/CodeBlocks.zip dest: /tmp/CodeBlocks.zip
use_proxy: False mode: '0644'
use_proxy: false
register: new_codeblocks register: new_codeblocks
when: codeblocks_version.stdout is not search('svn13544') when: codeblocks_version.stdout is not search('svn13544')
- name: Unpack zip archive and install packages manually - name: Unpack zip archive and install packages manually
shell: ansible.builtin.shell:
cmd: unzip -d /tmp/cb/ CodeBlocks.zip && dpkg -i cb/*.deb cmd: unzip -d /tmp/cb/ CodeBlocks.zip && dpkg -i cb/*.deb
chdir: /tmp/ chdir: /tmp/
when: new_codeblocks.changed | default(false) when: new_codeblocks.changed | default(false)
when: "'PCroom' in group_names"
## Clean up stuff from obsolete/faulty tasks: ## Clean up stuff from obsolete/faulty tasks:
- name: Remove sddm login screen patch with deprecated marker (homeondisk) - name: Remove sddm login screen patch with deprecated marker (homeondisk)
blockinfile: ansible.builtin.blockinfile:
path: /usr/share/sddm/themes/debian-breeze/Main.qml path: /usr/share/sddm/themes/debian-breeze/Main.qml
marker: // {mark} ANSIBLE MANAGED BLOCK homeondisk marker: // {mark} ANSIBLE MANAGED BLOCK homeondisk
state: absent state: absent
@ -180,15 +182,15 @@
- cachefilesd - cachefilesd
- mosquitto - mosquitto
state: absent state: absent
purge: True purge: true
- name: Remove virtiofs service - name: Remove virtiofs service
file: ansible.builtin.file:
path: /etc/systemd/system/virtiofs@.service path: /etc/systemd/system/virtiofs@.service
state: absent state: absent
- name: Fix mount point permissions and owner - name: Fix mount point permissions and owner
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
mode: '0755' mode: '0755'
owner: root owner: root
@ -198,7 +200,7 @@
- /srv/samba/schools - /srv/samba/schools
- name: Remove pam_mount sysvol mount - name: Remove pam_mount sysvol mount
blockinfile: ansible.builtin.blockinfile:
dest: /etc/security/pam_mount.conf.xml dest: /etc/security/pam_mount.conf.xml
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (SysVol) -->" marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (SysVol) -->"
block: | block: |
@ -212,28 +214,30 @@
</volume> </volume>
state: absent state: absent
- name: check if rmlpr.timer is installed - name: Check if rmlpr.timer is installed
stat: path=/etc/systemd/system/rmlpr.timer ansible.builtin.stat:
path: /etc/systemd/system/rmlpr.timer
register: rmlpr register: rmlpr
- name: disable rmlpr.timer - name: Disable rmlpr.timer
systemd: ansible.builtin.systemd:
name: rmlpr.timer name: rmlpr.timer
enabled: false enabled: false
when: rmlpr.stat.exists when: rmlpr.stat.exists
- name: check if vmimage-torrent.service is installed - name: Check if vmimage-torrent.service is installed
stat: path=/etc/systemd/system/vmimage-torrent.service ansible.builtin.stat:
path: /etc/systemd/system/vmimage-torrent.service
register: vmimagetorrent register: vmimagetorrent
- name: disable vmimage-torrent.service - name: Disable vmimage-torrent.service
systemd: ansible.builtin.systemd:
name: vmimage-torrent.service name: vmimage-torrent.service
enabled: false enabled: false
when: vmimagetorrent.stat.exists when: vmimagetorrent.stat.exists
- name: Remove deprecated files and directories - name: Remove deprecated files and directories
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: absent state: absent
with_items: with_items:
@ -269,12 +273,13 @@
- /etc/NetworkManager/system-connections/macvlan-vm-macvtap.nmconnection - /etc/NetworkManager/system-connections/macvlan-vm-macvtap.nmconnection
- /etc/tmpfiles.d/clean-exam.conf - /etc/tmpfiles.d/clean-exam.conf
- name: check if vm_usage_information.txt exists - name: Check if vm_usage_information.txt exists
stat: path=/lmn/vm/vm_usage_information.txt ansible.builtin.stat:
path: /lmn/vm/vm_usage_information.txt
register: vm_usage_information register: vm_usage_information
- name: pre-fill vm_usage_information.txt - name: Pre-fill vm_usage_information.txt
shell: ansible.builtin.shell:
cmd: | cmd: |
ls -tr *.qcow2 > vm_usage_information.txt || touchvm_usage_information.txt ls -tr *.qcow2 > vm_usage_information.txt || touchvm_usage_information.txt
chown lmnsynci:lmnsynci vm_usage_information.txt chown lmnsynci:lmnsynci vm_usage_information.txt
@ -285,11 +290,11 @@
ansible.builtin.shell: ansible.builtin.shell:
cmd: grep "IPP Everywhere" /etc/cups/printers.conf cmd: grep "IPP Everywhere" /etc/cups/printers.conf
register: ipp_everywhere register: ipp_everywhere
failed_when: False failed_when: false
changed_when: False changed_when: false
- name: Delete old IPP-Everywhere printers - name: Delete old IPP-Everywhere printers
shell: ansible.builtin.shell:
cmd: | cmd: |
for p in $(lpstat -p | cut -d" " -f2); do for p in $(lpstat -p | cut -d" " -f2); do
lpadmin -x "$p" lpadmin -x "$p"
@ -297,17 +302,17 @@
when: not ipp_everywhere.rc when: not ipp_everywhere.rc
- name: Remove old VM-printerlists - name: Remove old VM-printerlists
shell: ansible.builtin.shell:
cmd: rm -f /lmn/media/*/.printerlist.csv cmd: rm -f /lmn/media/*/.printerlist.csv
- name: Remove Listen on VMBridge - name: Remove Listen on VMBridge
lineinfile: ansible.builtin.lineinfile:
dest: /etc/cups/cupsd.conf dest: /etc/cups/cupsd.conf
line: 'Listen 192.168.122.1:631' line: 'Listen 192.168.122.1:631'
state: absent state: absent
- name: Remove NetworkManager Ansible-Block for non-laptops - name: Remove NetworkManager Ansible-Block for non-laptops
blockinfile: ansible.builtin.blockinfile:
path: /etc/NetworkManager/NetworkManager.conf path: /etc/NetworkManager/NetworkManager.conf
state: absent state: absent
when: "'laptop' not in group_names" when: "'laptop' not in group_names"
@ -343,7 +348,7 @@
- name: Timestamp successfull run and send up-to-date report - name: Timestamp successfull run and send up-to-date report
ansible.builtin.shell: ansible.builtin.shell:
cmd: date --iso-8601=seconds >> /var/local/ansible-stamps && /usr/local/sbin/reporter cmd: date --iso-8601=seconds >> /var/local/ansible-stamps && /usr/local/sbin/reporter
changed_when: False changed_when: false
tags: upgrade tags: upgrade
- name: Force ansible-run after install trough emitter by setting timestamp in the past - name: Force ansible-run after install trough emitter by setting timestamp in the past
@ -356,7 +361,7 @@
- name: Apply additional laptop configuration - name: Apply additional laptop configuration
hosts: laptop hosts: laptop
remote_user: ansible remote_user: ansible
become: yes become: true
vars_files: lmn-vault vars_files: lmn-vault
vars: vars:
localuser: "{{ vault_localuser }}" localuser: "{{ vault_localuser }}"
@ -366,7 +371,7 @@
when: "'teacherlaptop' not in group_names" when: "'teacherlaptop' not in group_names"
tasks: tasks:
- name: Remove deprecated files and directories (laptop-class) - name: Remove deprecated files and directories (laptop-class)
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: absent state: absent
with_items: with_items:
@ -380,7 +385,7 @@
- name: Enable wpa-supplicant - name: Enable wpa-supplicant
ansible.builtin.systemd: ansible.builtin.systemd:
name: wpa_supplicant.service name: wpa_supplicant.service
enabled: True enabled: true
tags: tags:
- never - never
- wlan_8021x - wlan_8021x
@ -388,13 +393,13 @@
- name: Disable iwd - name: Disable iwd
ansible.builtin.systemd: ansible.builtin.systemd:
name: iwd.service name: iwd.service
enabled: False enabled: false
tags: tags:
- never - never
- wlan_8021x - wlan_8021x
- name: Remove deprecated NetworkManager config - name: Remove deprecated NetworkManager config
blockinfile: ansible.builtin.blockinfile:
path: /etc/NetworkManager/NetworkManager.conf path: /etc/NetworkManager/NetworkManager.conf
state: absent state: absent
tags: tags:
@ -405,7 +410,7 @@
- name: Apply roles that must run serial - name: Apply roles that must run serial
hosts: all hosts: all
remote_user: ansible remote_user: ansible
become: yes become: true
serial: 1 serial: 1
ignore_unreachable: true ignore_unreachable: true

View file

@ -1,5 +1,5 @@
- name: reload sshd - name: Reload sshd
systemd: ansible.builtin.systemd:
name: sshd name: sshd
state: reloaded state: reloaded
when: not run_in_installer|default(false)|bool when: not run_in_installer|default(false)|bool

View file

@ -1,28 +1,30 @@
- name: Install kerberos packages - name: Install kerberos packages
apt: ansible.builtin.apt:
name: krb5-user name: krb5-user
state: latest
- name: Kerberize sshd server - name: Kerberize sshd server
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/ssh/sshd_config.d/kerberize.conf dest: /etc/ssh/sshd_config.d/kerberize.conf
mode: '0644'
content: | content: |
GSSAPIAuthentication yes GSSAPIAuthentication yes
notify: "reload sshd" notify: "Reload sshd"
- name: Kerberize ssh client, authenticate and delegate credentials - name: Kerberize ssh client, authenticate and delegate credentials
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/ssh/ssh_config.d/kerberize.conf dest: /etc/ssh/ssh_config.d/kerberize.conf
mode: '0644'
content: | content: |
GSSAPIAuthentication yes GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes GSSAPIDelegateCredentials yes
- name: Check if firefox is available - name: Check if firefox is available
stat: path=/etc/firefox-esr/firefox-esr.js ansible.builtin.stat:
path: /etc/firefox-esr/firefox-esr.js
register: firefox register: firefox
- name: Kerberize firefox for sites in the local domain - name: Kerberize firefox for sites in the local domain
lineinfile: ansible.builtin.lineinfile:
dest: /etc/firefox-esr/firefox-esr.js dest: /etc/firefox-esr/firefox-esr.js
line: "{{ item }}" line: "{{ item }}"
with_items: with_items:
@ -32,13 +34,15 @@
when: firefox.stat.exists when: firefox.stat.exists
- name: Ensures /etc/chromium/policies/managed dir exists - name: Ensures /etc/chromium/policies/managed dir exists
file: ansible.builtin.file:
path: "/etc/chromium/policies/managed" path: "/etc/chromium/policies/managed"
state: directory state: directory
mode: '0755'
- name: Kerberize chromium for sites in the local domain - name: Kerberize chromium for sites in the local domain
copy: ansible.builtin.copy:
dest: /etc/chromium/policies/managed/idam.json dest: /etc/chromium/policies/managed/idam.json
mode: '0644'
content: | content: |
{ {
"AuthServerAllowlist": "idam.steinbeis.schule" "AuthServerAllowlist": "idam.steinbeis.schule"

View file

@ -10,7 +10,7 @@
ansible.builtin.systemd: ansible.builtin.systemd:
name: firewalld name: firewalld
state: stopped state: stopped
when: result.changed when: result.changed # noqa: no-handler
- name: Disable firewalld-service - name: Disable firewalld-service
ansible.builtin.systemd: ansible.builtin.systemd:

View file

@ -1,6 +1,6 @@
--- ---
- name: Run update-desktop-database - name: Run update-desktop-database
command: update-desktop-database "{{ item }}" ansible.builtin.command: update-desktop-database "{{ item }}"
loop: loop:
- /usr/local/share/applications - /usr/local/share/applications
- /usr/local/share/desktop-directories - /usr/local/share/desktop-directories

View file

@ -14,9 +14,8 @@
vtype: string vtype: string
when: mirror_msfonts is defined and mirror_msfonts | length > 0 when: mirror_msfonts is defined and mirror_msfonts | length > 0
- name: Install desktop EDU packages and some more - name: Install desktop EDU packages and some more
apt: ansible.builtin.apt:
name: name:
- atftp - atftp
- audacity - audacity
@ -90,7 +89,7 @@
http_proxy: '' # this is needed to avoid ttf-mscorefonts-installer picking up aptcacher http_proxy: '' # this is needed to avoid ttf-mscorefonts-installer picking up aptcacher
- name: Remove update notifications from plasma-discover - name: Remove update notifications from plasma-discover
apt: ansible.builtin.apt:
name: name:
- plasma-discover - plasma-discover
autoremove: true autoremove: true
@ -100,6 +99,7 @@
- name: Make sure wireshark works for all users after installation and upgrades - name: Make sure wireshark works for all users after installation and upgrades
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/apt/apt.conf.d/92wireshark4all dest: /etc/apt/apt.conf.d/92wireshark4all
mode: '0644'
content: | content: |
## Modify permissions after installation/upgrade to allow all ## Modify permissions after installation/upgrade to allow all
## users dumping packages on network interfaces for wireshark ## users dumping packages on network interfaces for wireshark
@ -122,6 +122,7 @@
ansible.builtin.copy: ansible.builtin.copy:
src: policies.json src: policies.json
dest: /etc/firefox-esr/policies/ dest: /etc/firefox-esr/policies/
mode: '0644'
- name: Create chromium policies directory - name: Create chromium policies directory
ansible.builtin.file: ansible.builtin.file:
@ -130,8 +131,9 @@
mode: '0755' mode: '0755'
- name: Set chromium proxy-policy to auto_detect - name: Set chromium proxy-policy to auto_detect
copy: ansible.builtin.copy:
dest: /etc/chromium/policies/managed/proxy.json dest: /etc/chromium/policies/managed/proxy.json
mode: '0644'
content: | content: |
{ {
"ProxyMode": "auto_detect" "ProxyMode": "auto_detect"
@ -144,20 +146,20 @@
replace: ' \1' replace: ' \1'
- name: Copy some scripts - name: Copy some scripts
copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: /usr/local/sbin/ dest: /usr/local/sbin/
mode: 0755 mode: '0755'
loop: loop:
- pwroff - pwroff
- bootorder.sh - bootorder.sh
- reporter - reporter
- name: Provide services and timers for some scripts - name: Provide services and timers for some scripts
copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}" dest: "/etc/systemd/system/{{ item }}"
mode: 0644 mode: '0644'
loop: loop:
- pwroff.service - pwroff.service
- pwroff.timer - pwroff.timer
@ -166,7 +168,7 @@
when: "'teacherlaptop' not in group_names" when: "'teacherlaptop' not in group_names"
- name: Enable pwroff.timer - name: Enable pwroff.timer
systemd: ansible.builtin.systemd:
name: "{{ item }}" name: "{{ item }}"
enabled: true enabled: true
loop: loop:
@ -175,7 +177,7 @@
when: "'teacherlaptop' not in group_names" when: "'teacherlaptop' not in group_names"
- name: PXE first boot order - name: PXE first boot order
command: /usr/local/sbin/bootorder.sh ansible.builtin.command: /usr/local/sbin/bootorder.sh
register: cmd_result register: cmd_result
changed_when: cmd_result.stdout is not search('Nothing to do.') changed_when: cmd_result.stdout is not search('Nothing to do.')
when: "'PCroom' in group_names" when: "'PCroom' in group_names"
@ -184,7 +186,7 @@
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: /usr/local/bin/ dest: /usr/local/bin/
mode: 0755 mode: '0755'
loop: loop:
- lmn-reset-dolphin.sh - lmn-reset-dolphin.sh
- lmn-patch-dolphin.sh - lmn-patch-dolphin.sh
@ -194,19 +196,21 @@
ansible.builtin.copy: ansible.builtin.copy:
src: lmn-dolphin.sh src: lmn-dolphin.sh
dest: /etc/profile.d/ dest: /etc/profile.d/
mode: '0644'
- name: Copy fvs-config.js to configure plasma - name: Copy fvs-config.js to configure plasma
ansible.builtin.copy: ansible.builtin.copy:
src: fvs-config.js src: fvs-config.js
dest: /usr/share/plasma/shells/org.kde.plasma.desktop/contents/updates/fvs-config.js dest: /usr/share/plasma/shells/org.kde.plasma.desktop/contents/updates/fvs-config.js
mode: 0644 mode: '0644'
- name: Configure some KDE aspects - name: Configure some KDE aspects
blockinfile: ansible.builtin.blockinfile:
path: /etc/xdg/kdeglobals path: /etc/xdg/kdeglobals
create: true create: true
mode: '0644'
block: | block: |
[KDE] [KDE]
SingleClick=false SingleClick=false
@ -219,6 +223,7 @@
- name: Shut down when idle for too long - name: Shut down when idle for too long
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/xdg/powermanagementprofilesrc dest: /etc/xdg/powermanagementprofilesrc
mode: '0644'
content: | content: |
[AC][SuspendSession] [AC][SuspendSession]
idleTime=7200000 idleTime=7200000
@ -228,20 +233,22 @@
- name: Start with empty session by default - name: Start with empty session by default
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/xdg/ksmserverrc dest: /etc/xdg/ksmserverrc
mode: '0644'
content: | content: |
[General] [General]
loginMode=emptySession loginMode=emptySession
- name: Fix primary screen for class room PCs with projector - name: Fix primary screen for class room PCs with projector
when: "'CloneScreen' in group_names"
block: block:
- name: Set primary screen for login - name: Set primary screen for login
blockinfile: ansible.builtin.blockinfile:
path: /usr/share/sddm/scripts/Xsetup path: /usr/share/sddm/scripts/Xsetup
block: | block: |
xrandr --output {{ dual_screen[0] }} --primary xrandr --output {{ dual_screen[0] }} --primary
when: dual_screen is defined when: dual_screen is defined
- name: Reset primary screen for login - name: Reset primary screen for login
blockinfile: ansible.builtin.blockinfile:
path: /usr/share/sddm/scripts/Xsetup path: /usr/share/sddm/scripts/Xsetup
state: absent state: absent
when: dual_screen is not defined when: dual_screen is not defined
@ -253,13 +260,13 @@
- name: Deploy fix-screen autostarter - name: Deploy fix-screen autostarter
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/xdg/autostart/lmn-fix-screen.desktop dest: /etc/xdg/autostart/lmn-fix-screen.desktop
mode: '0644'
content: | content: |
[Desktop Entry] [Desktop Entry]
Name=fix-screen Name=fix-screen
Exec=lmn-fix-screen Exec=lmn-fix-screen
Type=Application Type=Application
NoDisplay=true NoDisplay=true
when: "'CloneScreen' in group_names"
# - name: Avoid starting kscreen (confusing autodetection) # - name: Avoid starting kscreen (confusing autodetection)
# ansible.builtin.copy: # ansible.builtin.copy:
@ -281,7 +288,8 @@
ansible.builtin.get_url: ansible.builtin.get_url:
url: "{{ mirror_dvdcss }}/libdvdcss.so.2.2.0" url: "{{ mirror_dvdcss }}/libdvdcss.so.2.2.0"
dest: /usr/lib/x86_64-linux-gnu/libdvdcss.so.2.2.0 dest: /usr/lib/x86_64-linux-gnu/libdvdcss.so.2.2.0
use_proxy: False mode: '0644'
use_proxy: false
when: mirror_dvdcss is defined and mirror_dvdcss | length > 0 when: mirror_dvdcss is defined and mirror_dvdcss | length > 0
- name: Link library so name - name: Link library so name
@ -292,7 +300,7 @@
when: mirror_dvdcss is defined and mirror_dvdcss | length > 0 when: mirror_dvdcss is defined and mirror_dvdcss | length > 0
- name: Patch sddm login screen to show hostname - name: Patch sddm login screen to show hostname
blockinfile: ansible.builtin.blockinfile:
path: /usr/share/sddm/themes/debian-breeze/Main.qml path: /usr/share/sddm/themes/debian-breeze/Main.qml
marker: // {mark} ANSIBLE MANAGED BLOCK marker: // {mark} ANSIBLE MANAGED BLOCK
insertbefore: '\s+//Footer' insertbefore: '\s+//Footer'
@ -311,6 +319,7 @@
- name: Set git default-branch to main - name: Set git default-branch to main
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/gitconfig dest: /etc/gitconfig
mode: '0644'
content: | content: |
[init] [init]
defaultBranch = main defaultBranch = main
@ -318,7 +327,7 @@
- name: Adjust mmcblk-device gid to allow users to access SD-cards - name: Adjust mmcblk-device gid to allow users to access SD-cards
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/udev/rules.d/80-mmcblk.rules dest: /etc/udev/rules.d/80-mmcblk.rules
mode: "0644" mode: '0644'
content: | content: |
KERNEL=="mmcblk[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", GROUP="domain users" KERNEL=="mmcblk[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", GROUP="domain users"
KERNEL=="mmcblk[0-9]p[0-9]*", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", GROUP="domain users" KERNEL=="mmcblk[0-9]p[0-9]*", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", GROUP="domain users"

View file

@ -3,7 +3,7 @@
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
mode: 0755 mode: '0755'
loop: loop:
- /usr/local/share/applications - /usr/local/share/applications
- /usr/local/share/desktop-directories - /usr/local/share/desktop-directories
@ -13,24 +13,26 @@
ansible.builtin.copy: ansible.builtin.copy:
src: fvs.directory src: fvs.directory
dest: /usr/local/share/desktop-directories/ dest: /usr/local/share/desktop-directories/
mode: '0644'
notify: Run update-desktop-database notify: Run update-desktop-database
- name: Copy fvs.menu - name: Copy fvs.menu
ansible.builtin.copy: ansible.builtin.copy:
src: fvs.menu src: fvs.menu
dest: /etc/xdg/menus/applications-merged/ dest: /etc/xdg/menus/applications-merged/
mode: '0644'
notify: Run update-desktop-database notify: Run update-desktop-database
- name: Copy lmn-sync script - name: Copy lmn-sync script
ansible.builtin.copy: ansible.builtin.copy:
src: lmn-sync src: lmn-sync
dest: /usr/local/sbin/ dest: /usr/local/sbin/
mode: 0755 mode: '0755'
register: lmn_sync register: lmn_sync
- name: Run lmn-sync script - name: Run lmn-sync script
ansible.builtin.shell: /usr/local/sbin/lmn-sync ansible.builtin.shell: /usr/local/sbin/lmn-sync
when: lmn_sync.changed when: lmn_sync.changed # noqa: no-handler
- name: Deploy sudo configurations (lmn-sync for role-teacher) - name: Deploy sudo configurations (lmn-sync for role-teacher)
ansible.builtin.copy: ansible.builtin.copy:
@ -42,15 +44,15 @@
%role-teacher ALL=(root) NOPASSWD: /usr/local/sbin/lmn-sync %role-teacher ALL=(root) NOPASSWD: /usr/local/sbin/lmn-sync
- name: Provide lmn-sync service and timer - name: Provide lmn-sync service and timer
copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}" dest: "/etc/systemd/system/{{ item }}"
mode: 0644 mode: '0644'
loop: loop:
- lmn-sync.service - lmn-sync.service
- lmn-sync.timer - lmn-sync.timer
- name: Enable lmn-sync.timer - name: Enable lmn-sync.timer
systemd: ansible.builtin.systemd:
name: lmn-sync.timer name: lmn-sync.timer
enabled: true enabled: true

View file

@ -1,2 +1,2 @@
- name: Run update-grub - name: Run update-grub
command: update-grub ansible.builtin.command: update-grub

View file

@ -39,7 +39,7 @@
autoremove: true autoremove: true
state: latest state: latest
- name: Add {{ ansible_distribution_release }}-backports - name: Add backports {{ ansible_distribution_release }}
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-backports main non-free-firmware repo: deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-backports main non-free-firmware
state: present state: present
@ -69,6 +69,7 @@
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: /etc/xdg/akonadi/akonadiserverrc path: /etc/xdg/akonadi/akonadiserverrc
create: true create: true
mode: '0644'
block: | block: |
[%General] [%General]
Driver=QSQLITE3 Driver=QSQLITE3
@ -83,10 +84,11 @@
/srv/samba/schools/default-school/examusers/ /srv/samba/schools/default-school/examusers/
- name: tune SDDM login - name: Tune SDDM login
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: /etc/sddm.conf path: /etc/sddm.conf
create: true create: true
mode: '0644'
block: | block: |
[Users] [Users]
MaximumUid=999 MaximumUid=999
@ -96,6 +98,7 @@
- name: Enable wake-on-lan for all ethernet connections - name: Enable wake-on-lan for all ethernet connections
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/NetworkManager/conf.d/wake-on-lan.conf dest: /etc/NetworkManager/conf.d/wake-on-lan.conf
mode: '0644'
content: | content: |
[connection] [connection]
ethernet.wake-on-lan=64 ethernet.wake-on-lan=64
@ -103,12 +106,14 @@
- name: Prepare directory for apt-daily override - name: Prepare directory for apt-daily override
ansible.builtin.file: ansible.builtin.file:
path: /etc/systemd/system/apt-daily.timer.d/ path: /etc/systemd/system/apt-daily.timer.d/
recurse: True recurse: true
mode: '0755'
state: directory state: directory
- name: Run apt update early to avoid outdated package lists - name: Run apt update early to avoid outdated package lists
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/systemd/system/apt-daily.timer.d/override.conf dest: /etc/systemd/system/apt-daily.timer.d/override.conf
mode: '0644'
content: | content: |
[Timer] [Timer]
RandomizedDelaySec=30m RandomizedDelaySec=30m
@ -124,6 +129,7 @@
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: /etc/systemd/sleep.conf.d/nosuspend.conf path: /etc/systemd/sleep.conf.d/nosuspend.conf
create: true create: true
mode: '0644'
block: | block: |
[Sleep] [Sleep]
AllowSuspend=no AllowSuspend=no
@ -175,7 +181,7 @@
dest: /etc/default/grub dest: /etc/default/grub
regexp: '^(GRUB_TIMEOUT=).*' regexp: '^(GRUB_TIMEOUT=).*'
line: '\g<1>1' line: '\g<1>1'
backrefs: yes backrefs: true
notify: Run update-grub notify: Run update-grub
- name: Keyboard compose key - name: Keyboard compose key
@ -183,10 +189,11 @@
dest: /etc/default/keyboard dest: /etc/default/keyboard
regexp: '^(XKBOPTIONS=).*' regexp: '^(XKBOPTIONS=).*'
line: '\1"compose:caps"' line: '\1"compose:caps"'
backrefs: yes backrefs: true
- name: Default KDE filepicker - name: Default KDE filepicker
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/environment.d/90lmn-filepicker.conf path: /etc/environment.d/90lmn-filepicker.conf
create: true create: true
mode: '0644'
line: GTK_USE_PORTAL=1 line: GTK_USE_PORTAL=1

View file

@ -1,12 +1,12 @@
--- ---
- name: enable pam_mkhomedir.so - name: Enable pam_mkhomedir.so
lineinfile: ansible.builtin.lineinfile:
dest: /etc/pam.d/common-session dest: /etc/pam.d/common-session
line: "session optional pam_mkhomedir.so umask=0077" line: "session optional pam_mkhomedir.so umask=0077"
insertbefore: '^session\s*optional\s*pam_mount.so' insertbefore: '^session\s*optional\s*pam_mount.so'
- name: Patch sddm login screen to inform about localhome - name: Patch sddm login screen to inform about localhome
blockinfile: ansible.builtin.blockinfile:
path: /usr/share/sddm/themes/debian-breeze/Main.qml path: /usr/share/sddm/themes/debian-breeze/Main.qml
marker: // {mark} ANSIBLE MANAGED BLOCK localhome marker: // {mark} ANSIBLE MANAGED BLOCK localhome
insertbefore: '\s+//Footer' insertbefore: '\s+//Footer'
@ -26,11 +26,12 @@
ansible.builtin.copy: ansible.builtin.copy:
src: lmn-create-unisonconfig.sh src: lmn-create-unisonconfig.sh
dest: /usr/local/bin/ dest: /usr/local/bin/
mode: 0755 mode: '0755'
- name: Install auto-logout-script for first login in /etc/profile.d/ - name: Install auto-logout-script for first login in /etc/profile.d/
copy: ansible.builtin.copy:
dest: /etc/profile.d/lmn-logout.sh dest: /etc/profile.d/lmn-logout.sh
mode: '0755'
content: | content: |
[[ "${UID}" -gt 10000 ]] && ! findmnt "/lmn/media/${USER}/home" > /dev/null && exit 0 [[ "${UID}" -gt 10000 ]] && ! findmnt "/lmn/media/${USER}/home" > /dev/null && exit 0
{% if 'teacherlaptop' not in group_names %} {% if 'teacherlaptop' not in group_names %}

View file

@ -1,6 +1,6 @@
--- ---
- name: Install needed packages - name: Install needed packages
apt: ansible.builtin.apt:
name: name:
- libpam-mount - libpam-mount
- cifs-utils - cifs-utils
@ -10,7 +10,7 @@
state: latest state: latest
- name: Configure pam_mount for Webdav Nextcloud - name: Configure pam_mount for Webdav Nextcloud
blockinfile: ansible.builtin.blockinfile:
dest: /etc/security/pam_mount.conf.xml dest: /etc/security/pam_mount.conf.xml
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (mount Nextcloud) -->" marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (mount Nextcloud) -->"
block: | block: |
@ -25,7 +25,7 @@
when: web_dav is defined and web_dav | length > 0 when: web_dav is defined and web_dav | length > 0
- name: Configure pam_mount for LMN homes - name: Configure pam_mount for LMN homes
blockinfile: ansible.builtin.blockinfile:
dest: /etc/security/pam_mount.conf.xml dest: /etc/security/pam_mount.conf.xml
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (mount LMN home) -->" marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (mount LMN home) -->"
block: | block: |
@ -55,6 +55,7 @@
ansible.builtin.file: ansible.builtin.file:
path: /etc/systemd/user-environment-generators/ path: /etc/systemd/user-environment-generators/
state: directory state: directory
mode: '0755'
- name: Prepare generator for persistent user cache directory - name: Prepare generator for persistent user cache directory
ansible.builtin.copy: ansible.builtin.copy:

View file

@ -1,7 +1,8 @@
--- ---
- name: Deploy http proxy config - name: Deploy http proxy config
copy: ansible.builtin.copy:
dest: /etc/environment.d/10-lmn-proxy.conf dest: /etc/environment.d/10-lmn-proxy.conf
mode: '0644'
content: | content: |
http_proxy="{{ proxy }}" http_proxy="{{ proxy }}"
https_proxy="{{ proxy }}" https_proxy="{{ proxy }}"
@ -12,6 +13,7 @@
- name: Set aptcache - name: Set aptcache
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/apt/apt.conf dest: /etc/apt/apt.conf
mode: '0644'
content: > content: >
{{ apt_conf }} {{ apt_conf }}
@ -22,7 +24,7 @@
line: NTP={{ ntp_serv }} line: NTP={{ ntp_serv }}
- name: Add proposed-updates repository - name: Add proposed-updates repository
apt_repository: ansible.builtin.apt_repository:
repo: > repo: >
deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-proposed-updates deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-proposed-updates
main non-free-firmware main non-free-firmware

View file

@ -1,26 +1,25 @@
--- ---
- name: Install cups - name: Install cups
apt: ansible.builtin.apt:
name: name:
- cups - cups
state: latest
- name: Disable cups printer browsing - name: Disable cups printer browsing
lineinfile: ansible.builtin.lineinfile:
dest: /etc/cups/cupsd.conf dest: /etc/cups/cupsd.conf
regexp: '^(Browsing ).*' regexp: '^(Browsing ).*'
line: '\1No' line: '\1No'
backrefs: yes backrefs: true
- name: Listen on all Interfaces - name: Listen on all Interfaces
lineinfile: ansible.builtin.lineinfile:
dest: /etc/cups/cupsd.conf dest: /etc/cups/cupsd.conf
line: 'Listen *:631' line: 'Listen *:631'
regexp: '^Listen localhost' regexp: '^Listen localhost'
state: present state: present
- name: Allow access from localhost and from VM - name: Allow access from localhost and from VM
blockinfile: ansible.builtin.blockinfile:
dest: /etc/cups/cupsd.conf dest: /etc/cups/cupsd.conf
block: | block: |
Allow localhost Allow localhost
@ -33,7 +32,7 @@
- "/admin" - "/admin"
- name: Allow group role-teacher to manage printers - name: Allow group role-teacher to manage printers
lineinfile: ansible.builtin.lineinfile:
dest: /etc/cups/cups-files.conf dest: /etc/cups/cups-files.conf
line: 'SystemGroup root lpadmin role-teacher' line: 'SystemGroup root lpadmin role-teacher'
regexp: '^SystemGroup' regexp: '^SystemGroup'
@ -44,24 +43,25 @@
ansible.builtin.systemd: ansible.builtin.systemd:
name: cups-browsed.service name: cups-browsed.service
state: stopped state: stopped
enabled: no enabled: false
- name: Install install-printers.sh - name: Install install-printers.sh
template: ansible.builtin.template:
src: install-printers.sh.j2 src: install-printers.sh.j2
dest: /usr/local/bin/install-printers.sh dest: /usr/local/bin/install-printers.sh
mode: 0755 mode: '0755'
- name: Install lmn-install-printers sudoers - name: Install lmn-install-printers sudoers
copy: ansible.builtin.copy:
src: 90-lmn-install-printers src: 90-lmn-install-printers
dest: /etc/sudoers.d/ dest: /etc/sudoers.d/
mode: 0660 mode: '0660'
owner: root owner: root
group: root group: root
- name: Run printer script from /etc/profile.d/ - name: Run printer script from /etc/profile.d/
copy: ansible.builtin.copy:
dest: /etc/profile.d/lmn-printer.sh dest: /etc/profile.d/lmn-printer.sh
mode: '0644'
content: | content: |
[[ "${UID}" -gt 10000 ]] && (sudo /usr/local/bin/install-printers.sh > /dev/null &) [[ "${UID}" -gt 10000 ]] && (sudo /usr/local/bin/install-printers.sh > /dev/null &)

View file

@ -1,5 +1,5 @@
- name: Reload sshd - name: Reload sshd
systemd: ansible.builtin.systemd:
name: sshd name: sshd
state: reloaded state: reloaded
when: not run_in_installer|default(false)|bool when: not run_in_installer|default(false)|bool

View file

@ -9,7 +9,7 @@
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/sudoers.d/95-lmn-ansible path: /etc/sudoers.d/95-lmn-ansible
line: 'ansible ALL=(root) NOPASSWD: ALL' line: 'ansible ALL=(root) NOPASSWD: ALL'
create: True create: true
owner: root owner: root
group: root group: root
mode: '0700' mode: '0700'
@ -17,12 +17,13 @@
- name: Disable ansible user login - name: Disable ansible user login
ansible.builtin.user: ansible.builtin.user:
name: ansible name: ansible
password_lock: True password_lock: true
- name: Limit SSH access to user ansible - name: Limit SSH access to user ansible
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
dest: /etc/ssh/sshd_config.d/local.conf dest: /etc/ssh/sshd_config.d/local.conf
create: true create: true
mode: '0644'
block: | block: |
PasswordAuthentication no PasswordAuthentication no
AllowUsers ansible AllowUsers ansible

View file

@ -1,3 +1,6 @@
- name: restart sssd - name: Restart sssd
service: name=sssd state=restarted enabled=yes ansible.builtin.service:
listen: "restart sssd" name: sssd
state: restarted
enabled: true
listen: "Restart sssd"

View file

@ -1,22 +1,21 @@
--- ---
- name: Install needed packages - name: Install needed packages
apt: ansible.builtin.apt:
name: name:
- sssd-ad - sssd-ad
- sssd-tools - sssd-tools
- adcli - adcli
state: latest
- name: Provide user identities from AD - name: Provide user identities from AD
template: ansible.builtin.template:
src: sssd.conf.j2 src: sssd.conf.j2
dest: /etc/sssd/sssd.conf dest: /etc/sssd/sssd.conf
mode: 0600 mode: '0600'
notify: restart sssd notify: Restart sssd
## Either one of the variables is defined: ## Either one of the variables is defined:
- name: Join the domain - name: Join the domain
shell: ansible.builtin.shell:
cmd: > cmd: >
echo "{{ ansible_cmdline.adpw | default('') + adpw.user_input | default('') }}" | echo "{{ ansible_cmdline.adpw | default('') + adpw.user_input | default('') }}" |
adcli join --stdin-password -U global-admin {{ domain | upper }} adcli join --stdin-password -U global-admin {{ domain | upper }}

View file

@ -1,2 +1,3 @@
--- ---
vm_support: false vm_support: false
torrent_srv: "seedbox.{{ domain }}"

View file

@ -1,5 +1,5 @@
- name: Reload libvirtd - name: Reload libvirtd
systemd: ansible.builtin.systemd:
name: libvirtd.service name: libvirtd.service
listen: reload libvirtd listen: reload libvirtd

View file

@ -4,22 +4,21 @@
- name: Allow users to attach to bridge - name: Allow users to attach to bridge
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/apt/apt.conf.d/94qemu-bridge-suid dest: /etc/apt/apt.conf.d/94qemu-bridge-suid
mode: '0644'
content: | content: |
## Modify permissions after installation/upgrade ## Modify permissions after installation/upgrade
## to run qemu-bridge as root ## to run qemu-bridge as root
DPkg::Post-Invoke {"/usr/bin/chmod 4755 /usr/lib/qemu/qemu-bridge-helper || true"; }; DPkg::Post-Invoke {"/usr/bin/chmod 4755 /usr/lib/qemu/qemu-bridge-helper || true"; };
- name: install libvirt packages - name: Install libvirt packages
apt: ansible.builtin.apt:
name: name:
- aria2 - aria2
- mktorrent - mktorrent
- libvirt-daemon-system - libvirt-daemon-system
- virt-manager - virt-manager
- dialog # for vm-netboot menu - dialog # for vm-netboot menu
state: latest
autoremove: true
# - name: allow all users to use VMs # - name: allow all users to use VMs
# lineinfile: # lineinfile:
@ -29,7 +28,7 @@
# notify: reload libvirtd # notify: reload libvirtd
- name: Configure pam_mount for VM bind mounts - name: Configure pam_mount for VM bind mounts
blockinfile: ansible.builtin.blockinfile:
dest: /etc/security/pam_mount.conf.xml dest: /etc/security/pam_mount.conf.xml
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (bind mounts for VMs) -->" marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (bind mounts for VMs) -->"
block: | block: |
@ -49,7 +48,7 @@
insertafter: "<!-- END ANSIBLE MANAGED BLOCK .* -->" insertafter: "<!-- END ANSIBLE MANAGED BLOCK .* -->"
- name: Configure pam_mount for VM bind mounts - name: Configure pam_mount for VM bind mounts
blockinfile: ansible.builtin.blockinfile:
dest: /etc/security/pam_mount.conf.xml dest: /etc/security/pam_mount.conf.xml
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (bind mount school for VMs) -->" marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (bind mount school for VMs) -->"
block: | block: |
@ -63,7 +62,7 @@
when: localhome is defined and localhome when: localhome is defined and localhome
- name: Use umount script for proper cleanup - name: Use umount script for proper cleanup
blockinfile: ansible.builtin.blockinfile:
dest: /etc/security/pam_mount.conf.xml dest: /etc/security/pam_mount.conf.xml
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (umount script needed for bind mounts ordering) -->" marker: "<!-- {mark} ANSIBLE MANAGED BLOCK (umount script needed for bind mounts ordering) -->"
block: | block: |
@ -75,16 +74,16 @@
ansible.builtin.copy: ansible.builtin.copy:
src: pam-umount.sh src: pam-umount.sh
dest: /usr/local/sbin/pam-umount.sh dest: /usr/local/sbin/pam-umount.sh
mode: "0755" mode: '0755'
- name: Insert domain in default-network - name: Insert domain in default-network
lineinfile: ansible.builtin.lineinfile:
path: /etc/libvirt/qemu/networks/default.xml path: /etc/libvirt/qemu/networks/default.xml
line: ' <domain name="{{ ansible_domain }}" localOnly="no"/>' line: ' <domain name="{{ ansible_domain }}" localOnly="no"/>'
insertafter: '</ip>' insertafter: '</ip>'
- name: Autostart default network for VMs - name: Autostart default network for VMs
file: ansible.builtin.file:
src: /etc/libvirt/qemu/networks/default.xml src: /etc/libvirt/qemu/networks/default.xml
dest: /etc/libvirt/qemu/networks/autostart/default.xml dest: /etc/libvirt/qemu/networks/autostart/default.xml
state: link state: link
@ -97,56 +96,57 @@
create_home: false create_home: false
- name: Create /etc/lmn directory - name: Create /etc/lmn directory
file: ansible.builtin.file:
path: /etc/lmn path: /etc/lmn
state: directory state: directory
mode: '0755'
- name: Create /lmn directory - name: Create /lmn directory
file: ansible.builtin.file:
path: /lmn path: /lmn
state: directory state: directory
mode: '0755'
- name: Create /lmn/media directory - name: Create /lmn/media directory
file: ansible.builtin.file:
path: /lmn/media path: /lmn/media
state: directory state: directory
mode: '1777' mode: '1777'
- name: Create /var/vm directory - name: Create /var/vm directory
file: ansible.builtin.file:
path: /var/vm path: /var/vm
state: directory state: directory
mode: '1777' mode: '1777'
- name: Create vm directory - name: Create vm directory
file: ansible.builtin.file:
path: /lmn/vm path: /lmn/vm
state: directory state: directory
owner: lmnsynci owner: lmnsynci
group: lmnsynci group: lmnsynci
mode: 0755 mode: '0755'
- name: Create cleanup-vm.conf - name: Create cleanup-vm.conf
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/tmpfiles.d/clean-vm.conf dest: /etc/tmpfiles.d/clean-vm.conf
mode: '0644'
content: | content: |
D /var/tmp/vm 1777 root root - D /var/tmp/vm 1777 root root -
- name: Install squid - name: Install squid
apt: ansible.builtin.apt:
name: name:
- squid - squid
state: latest
autoremove: true
- name: Disable squid - name: Disable squid
systemd: ansible.builtin.systemd:
name: squid name: squid
enabled: false enabled: false
state: stopped state: stopped
- name: Deploy squid user mode configuration - name: Deploy squid user mode configuration
template: ansible.builtin.template:
src: "{{ item }}.j2" src: "{{ item }}.j2"
dest: "/etc/squid/{{ item }}" dest: "/etc/squid/{{ item }}"
mode: '0644' mode: '0644'
@ -155,16 +155,16 @@
- squid-usermode-external.conf - squid-usermode-external.conf
- name: Deploy startusersquid script - name: Deploy startusersquid script
template: ansible.builtin.template:
src: startusersquid.sh.j2 src: startusersquid.sh.j2
dest: /usr/local/bin/startusersquid.sh dest: /usr/local/bin/startusersquid.sh
mode: '0755' mode: '0755'
- name: Provide usersquid service - name: Provide usersquid service
copy: ansible.builtin.copy:
src: usersquid.service src: usersquid.service
dest: /etc/systemd/user/usersquid.service dest: /etc/systemd/user/usersquid.service
mode: 0644 mode: '0644'
- name: Enable usersquid service - name: Enable usersquid service
ansible.builtin.systemd: ansible.builtin.systemd:
@ -173,7 +173,7 @@
enabled: true enabled: true
- name: Deploy sudo configurations - name: Deploy sudo configurations
copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: "/etc/sudoers.d/90-{{ item }}" dest: "/etc/sudoers.d/90-{{ item }}"
owner: root owner: root
@ -184,7 +184,7 @@
- lmn-vm - lmn-vm
- name: Deploy vmimages scripts - name: Deploy vmimages scripts
copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: /usr/local/bin/ dest: /usr/local/bin/
owner: root owner: root
@ -210,6 +210,7 @@
dest: /etc/lmn/vm.conf dest: /etc/lmn/vm.conf
owner: root owner: root
group: root group: root
mode: '0644'
- name: Deploy aria2 RPC password file - name: Deploy aria2 RPC password file
ansible.builtin.copy: ansible.builtin.copy:
@ -226,15 +227,18 @@
state: directory state: directory
owner: lmnsynci owner: lmnsynci
group: lmnsynci group: lmnsynci
mode: '0755'
- name: Prepare directory for qemu bridge config - name: Prepare directory for qemu bridge config
ansible.builtin.file: ansible.builtin.file:
path: /etc/qemu/ path: /etc/qemu/
state: directory state: directory
mode: '0755'
- name: Deploy bridge.conf needed for qemu session mode - name: Deploy bridge.conf needed for qemu session mode
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/qemu/bridge.conf dest: /etc/qemu/bridge.conf
mode: '0644'
content: | content: |
allow virbr0 allow virbr0
allow virbr1 allow virbr1
@ -263,6 +267,7 @@
- name: Adjust interface permissions for user mode VMs - name: Adjust interface permissions for user mode VMs
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/udev/rules.d/80-macvlan.rules dest: /etc/udev/rules.d/80-macvlan.rules
mode: '0644'
content: | content: |
{% for interface in (ansible_interfaces | select('search', '^en[pso].+')) %} {% for interface in (ansible_interfaces | select('search', '^en[pso].+')) %}
SUBSYSTEMS=="net", KERNELS=="macvtap-{{ interface[3:9] }}", MODE="0666" SUBSYSTEMS=="net", KERNELS=="macvtap-{{ interface[3:9] }}", MODE="0666"

View file

@ -1,6 +1,5 @@
--- ---
vpn: none vpn: none
# Wireguad config # Wireguad config
wg_endpoint: "203.0.113.1:51820" wg_endpoint: "203.0.113.1:51820"
wg_allowed_ips: "10.0.0.0/16;" wg_allowed_ips: "10.0.0.0/16;"

View file

@ -50,4 +50,3 @@
( not cert_client_active.stat.exists ) or ( not cert_client_active.stat.exists ) or
(cert_serial.stdout | replace('serial=','') | int(base=16) ) in ( radius_crl.revoked_certificates | map(attribute='serial_number') | list ) or (cert_serial.stdout | replace('serial=','') | int(base=16) ) in ( radius_crl.revoked_certificates | map(attribute='serial_number') | list ) or
wlan_force_issue wlan_force_issue

View file

@ -1,39 +1,40 @@
# Update lists and upgrade packages. # Update lists and upgrade packages.
- name: update apt package lists - name: Update apt package lists
apt: ansible.builtin.apt:
update_cache: true update_cache: true
cache_valid_time: 86400 cache_valid_time: 86400
- block: - name: Try to upgrade packages
- name: upgrade packages block:
apt: - name: Upgrade packages
ansible.builtin.apt:
upgrade: dist upgrade: dist
autoremove: true autoremove: true
autoclean: true autoclean: true
rescue: rescue:
- name: Looks like dpkg was interrupted, configure manually - name: Looks like dpkg was interrupted, configure manually
command: ansible.builtin.command:
cmd: dpkg --configure -a cmd: dpkg --configure -a
- name: Try again to upgrade packages - name: Try again to upgrade packages
apt: ansible.builtin.apt:
upgrade: dist upgrade: dist
autoremove: true autoremove: true
autoclean: true autoclean: true
- name: install etckeeper - name: Install etckeeper
apt: ansible.builtin.apt:
name: etckeeper name: etckeeper
state: latest # noqa package-latest state: latest # noqa package-latest
- name: install extra packages from stable - name: Install extra packages from stable
apt: ansible.builtin.apt:
name: "{{ extra_pkgs }}" name: "{{ extra_pkgs }}"
state: latest # noqa package-latest state: latest # noqa package-latest
when: extra_pkgs|length when: extra_pkgs|length
- name: add {{ ansible_distribution_release }}-backports - name: Add backports for {{ ansible_distribution_release }}
apt_repository: ansible.builtin.apt_repository:
repo: > repo: >
deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-backports deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-backports
main non-free-firmware main non-free-firmware
@ -41,8 +42,8 @@
update_cache: true update_cache: true
when: extra_pkgs_bpo|length when: extra_pkgs_bpo|length
- name: install extra packages from backports - name: Install extra packages from backports
apt: ansible.builtin.apt:
name: "{{ extra_pkgs_bpo }}" name: "{{ extra_pkgs_bpo }}"
state: latest # noqa package-latest state: latest # noqa package-latest
default_release: "{{ ansible_distribution_release }}-backports" default_release: "{{ ansible_distribution_release }}-backports"