Compare commits

...
Sign in to create a new pull request.

8 commits
fvs ... main

Author SHA1 Message Date
Daniel Werz
fb98d53fad Fix conditional check of string variable 2026-03-04 11:22:39 +01:00
Raphael Dannecker
c90e626e3d Add comment line to prevent empty content 2026-03-04 11:22:39 +01:00
Raphael Dannecker
cf5e11d7f1 Report failed services (e.g. lmn-updater) 2026-03-04 11:22:39 +01:00
Raphael Dannecker
3deccfb88f Remove reporter file because reporter template is used 2026-03-04 11:22:39 +01:00
Raphael Dannecker
6558f376f5 Add inventory vault password for updater service 2026-03-04 11:22:39 +01:00
Raphael Dannecker
51135966d3 Fix start-condition in lmn-updater.timer 2026-03-04 11:22:39 +01:00
Raphael Dannecker
8ee5517612 Restricting the Ansible pull operation (lmn-updater) on changes in the repository 2026-03-04 11:22:39 +01:00
Raphael Dannecker
c4dbcffebd Add automatic updater using ansible-pull 2026-03-04 11:22:39 +01:00
7 changed files with 53 additions and 36 deletions

View file

@ -33,6 +33,7 @@
dest: /etc/profile.d/lmn-logout.sh dest: /etc/profile.d/lmn-logout.sh
mode: '0755' mode: '0755'
content: | content: |
# logout script (may be empty)
{% if localhome_logout_missing_serverhome %} {% if localhome_logout_missing_serverhome %}
[[ "${UID}" -gt 10000 ]] && ! findmnt /srv/samba/schools/default-school > /dev/null && exit 0 [[ "${UID}" -gt 10000 ]] && ! findmnt /srv/samba/schools/default-school > /dev/null && exit 0
{% endif %} {% endif %}

View file

@ -1,33 +0,0 @@
#!/usr/bin/bash
#
# Send stdout of some commands to monitoring server.
# Collect the reports with 'nc -u -k -l 1234' on 'sendto'.
# Use /bin/nc.openbsd, /bin/nc.traditional seems not to work.
#
set -eu
sendto="collector.steinbeis.schule 1234"
n=0
cmds=(
'uname -a'
'tail -1 /var/local/ansible-stamps'
'ip route list default'
'ip link show | \
sed -nE -e "s/^[2-9]: (\S+): .+/\1/p" -e "s/.+ether ([0-9a-f:]+) .+/\1/p" | \
paste - -'
)
# 'w'
# 'uptime'
# 'ls -d --full-time /home/ansible/.ansible/tmp/'
# 'ip addr show'
# 'apt list --upgradeable -o Apt::Cmd::Disable-Script-Warning=true'
r="$HOSTNAME ------- $(date --rfc-3339=seconds) -------
$(for c in "${cmds[@]}" ; do
n=$(( n + 1 ))
echo -n "$n"
eval "$c" | sed 's/^/\t/'
done | sed "s/^/$HOSTNAME /")
## -------------------------------------------------"
echo "$r" | nc -w 1 -u $sendto

View file

@ -98,7 +98,7 @@
export superusers export superusers
password_pbkdf2 root {{ grub_pwd }} password_pbkdf2 root {{ grub_pwd }}
notify: Run update-grub notify: Run update-grub
when: grub_pwd | bool | default(false) when: grub_pwd is defined and grub_pwd is truthy
- name: Allow booting grub menu entries - name: Allow booting grub menu entries
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
@ -190,6 +190,36 @@
tags: tags:
- baseinstall - baseinstall
# Updater
- name: Provide services and timers for updater
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: '0644'
loop:
- lmn-updater.service
- lmn-updater.timer
when: misc_updater_repository | default(false) is truthy
- name: Enable updater.timer
ansible.builtin.systemd:
name: lmn-updater.timer
enabled: true
when:
- misc_updater_repository | default(false) is truthy
- misc_updater_autostart | default(false) is truthy
- name: Deploy inventory password file
ansible.builtin.copy:
dest: /root/.inventory-pw
owner: root
mode: '0640'
content: "{{ misc_updater_inventory_password }}"
when:
- misc_updater_repository | default(false) is truthy
- misc_updater_inventory_password | default(false) is truthy
# Prepare CloneScreen on Presenter PCs # Prepare CloneScreen on Presenter PCs
- name: Fix primary screen for class room PCs with projector - name: Fix primary screen for class room PCs with projector

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run LMN Client updates via ansible-pull
[Service]
Type=oneshot
User=root
ExecStart=/usr/bin/ansible-pull --only-if-changed --verbose --vault-password-file /root/.inventory-pw -l %H -d /root/lmn-client \
-i {{ misc_updater_inventory }} --url={{ misc_updater_repository }} -C {{ misc_updater_branch }} lmn-client.yml

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run LMN Updater every day
After=network-online.target
[Timer]
OnBootSec=5min
[Install]
WantedBy=timers.target

View file

@ -16,6 +16,7 @@ cmds=(
'ip link show | \ 'ip link show | \
sed -nE -e "s/^[2-9]: (\S+): .+/\1/p" -e "s/.+ether ([0-9a-f:]+) .+/\1/p" | \ sed -nE -e "s/^[2-9]: (\S+): .+/\1/p" -e "s/.+ether ([0-9a-f:]+) .+/\1/p" | \
paste - -' paste - -'
'systemctl --failed | grep -v "^$"'
) )
# 'w' # 'w'
# 'uptime' # 'uptime'

View file

@ -5,14 +5,14 @@
mode: '0644' mode: '0644'
content: > content: >
{{ apt_conf }} {{ apt_conf }}
when: apt_conf | bool | default(false) when: apt_conf is defined and apt_conf is truthy
- name: Set NTP server - name: Set NTP server
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/systemd/timesyncd.conf path: /etc/systemd/timesyncd.conf
insertafter: '^#NTP=' insertafter: '^#NTP='
line: NTP={{ ntp_serv }} line: NTP={{ ntp_serv }}
when: ntp_serv | bool | default(false) when: ntp_serv is defined and ntp_serv is truthy
- name: Add proposed-updates repository - name: Add proposed-updates repository
ansible.builtin.apt_repository: ansible.builtin.apt_repository: