moved post-installation reboots to task blocks from each software's associated handler to reduce power cycle; fixed semantic errors with varables and fixed repository addition issues

This commit is contained in:
2026-06-16 14:47:31 -04:00
parent dc8dbcc43e
commit 7daf57da64
7 changed files with 151 additions and 52 deletions

View File

@@ -27,6 +27,6 @@
- julia - julia
- julialauncher - julialauncher
- juliaup - juliaup
- name: Reboot machine for shell environment change # - name: Reboot machine for shell environment change
ansible.builtin.reboot: # ansible.builtin.reboot:
msg: Rebooting machine # msg: Rebooting machine

View File

@@ -89,7 +89,7 @@
group: root group: root
state: link state: link
loop: "{{ prebuilt_nodepaths | product(['node']) }}" loop: "{{ prebuilt_nodepaths | product(['node']) }}"
- name: Reboot machine for shell environment change # - name: Reboot machine for shell environment change
ansible.builtin.reboot: # ansible.builtin.reboot:
msg: Rebooting machine # msg: Rebooting machine

View File

@@ -46,6 +46,6 @@
- git-remote-rad - git-remote-rad
- rad-id - rad-id
- rad-patch - rad-patch
- name: Reboot machine for shell environment change # - name: Reboot machine for shell environment change
ansible.builtin.reboot: # ansible.builtin.reboot:
msg: Rebooting machine # msg: Rebooting machine

View File

@@ -23,6 +23,6 @@
state: link state: link
loop: loop:
- rustup - rustup
- name: Reboot machine for shell environment change # - name: Reboot machine for shell environment change
ansible.builtin.reboot: # ansible.builtin.reboot:
msg: Rebooting machine # msg: Rebooting machine

View File

@@ -24,6 +24,6 @@
loop: loop:
- uv - uv
- uvx - uvx
- name: Reboot machine for shell environment change # - name: Reboot machine for shell environment change
ansible.builtin.reboot: # ansible.builtin.reboot:
msg: Rebooting machine # msg: Rebooting machine

View File

@@ -45,9 +45,55 @@
when: ansible_facts["os_family"] == "Debian" when: ansible_facts["os_family"] == "Debian"
become: true become: true
block: block:
- name: Creating core OS repository sources for package manager
when: ansible_facts["os_family"] == "Debian"
ansible.builtin.deb822_repository:
name: "{{ item.name }}"
uris: "{{ item.sources }}"
types: "{{ item.types }}"
suites: "{{ item.suites }}"
components: "{{ item.comps }}"
signed_by: "{{ item.sigkey }}"
state: present
loop:
- name: debian-trixie
sources: "http://deb.debian.org/debian/"
sigkey: /usr/share/keyrings/debian-archive-keyring.gpg
types:
- deb-src
- deb
suites:
- trixie
- trixie-updates
comps:
- main
- non-free-firmware
- contrib
- name: debian-trixie-security
sources: "http://security.debian.org/debian-security"
sigkey: /usr/share/keyrings/debian-archive-keyring.gpg
types:
- deb-src
- deb
suites: trixie-security
comps:
- main
- non-free-firmware
- contrib
- name: Remove previous core OS repository sources for package manager
ansible.builtin.file:
path: /etc/apt/sources.list
state: absent
# @TODO uncomment below before continuing with testing previous task
# - name: Premature end of play
# ansible.builtin.meta: end_play
- name: Updating package cache - name: Updating package cache
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
- name: Updating package cache
ansible.builtin.apt:
upgrade: dist
autoremove: true
- name: Registering a package source - name: Registering a package source
when: item.sources != None when: item.sources != None
ansible.builtin.deb822_repository: ansible.builtin.deb822_repository:
@@ -59,24 +105,22 @@
signed_by: "{{ item.sigkey }}" signed_by: "{{ item.sigkey }}"
state: present state: present
loop: "{{ ((pkgs.mngr.core | default([]))) }}" loop: "{{ ((pkgs.mngr.core | default([]))) }}"
- name: Updating package cache
ansible.builtin.apt:
update_cache: true
- name: Installing a local package in managed node - name: Installing a local package in managed node
when: item.uri != None when: item.uri != None
ansible.builtin.apt: ansible.builtin.apt:
deb: "{{ item.uri }}" deb: "{{ item.uri }}"
state: present state: present
# @TODO add a default value for notify notify: "{{ item.handler | default('default') }}"
# notify: "{{ item.name }}"
loop: "{{ (pkgs.mngr.core | default([])) | selectattr('uri', 'search', '\\.deb$') }}" loop: "{{ (pkgs.mngr.core | default([])) | selectattr('uri', 'search', '\\.deb$') }}"
- name: Updating package cache
ansible.builtin.apt:
update_cache: true
- name: Installing a package - name: Installing a package
when: item.name != None and item.uri == None when: item.name != None and item.uri == None
ansible.builtin.package: ansible.builtin.package:
name: "{{ item.name }}" name: "{{ item.name }}"
state: latest state: present
# @TODO add a default value for notify notify: "{{ item.handler | default('default') }}"
# notify: "{{ item.name }}"
loop: "{{ ((pkgs.mngr.core | default([]))) | rejectattr('uri', 'search', '\\.deb$') }}" loop: "{{ ((pkgs.mngr.core | default([]))) | rejectattr('uri', 'search', '\\.deb$') }}"
tags: tags:
- get_mngr_pkgs - get_mngr_pkgs
@@ -94,12 +138,15 @@
group: "{{ ansible_user }}" group: "{{ ansible_user }}"
force: true force: true
mode: "744" mode: "744"
# @TODO add a default value for notify notify: "{{ ((pkgs.script.core | default([])))[idx].handler | default('default') }}"
notify: "{{ ((pkgs.script.core | default([])))[idx].name }}"
loop: "{{ (pkgs.script.core | default([])) }}" loop: "{{ (pkgs.script.core | default([])) }}"
loop_control: loop_control:
index_var: idx index_var: idx
register: install_scripts register: install_scripts
- name: Reboot machine for shell environment change
become: true
ansible.builtin.reboot:
msg: Rebooting machine
tags: tags:
- get_script_pkgs - get_script_pkgs
- name: Installing software by building it from source archives - name: Installing software by building it from source archives
@@ -131,16 +178,21 @@
loop_control: loop_control:
index_var: idx index_var: idx
- name: Unarchiving software build archive - name: Unarchiving software build archive
become: true
become_user: "{{ current_user.stdout }}"
when: item.dest != None and (((pkgs.script.core | default([]))) | length) > 0 when: item.dest != None and (((pkgs.script.core | default([]))) | length) > 0
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ item.dest }}" src: "{{ item.dest }}"
remote_src: true remote_src: true
dest: "{{ ansible_user_home.stdout }}/downloads/archives/released/{{ ((pkgs.archive.core | default([])))[idx].name }}/" dest: "{{ ansible_user_home.stdout }}/downloads/archives/released/{{ ((pkgs.archive.core | default([])))[idx].name }}/"
# @TODO add a default value for notify notify: "{{ ((pkgs.archive.core | default([])))[idx].handler | default('default') }}"
notify: "{{ ((pkgs.archive.core | default([])))[idx].name }}"
loop: "{{ archived_builds.results }}" loop: "{{ archived_builds.results }}"
loop_control: loop_control:
index_var: idx index_var: idx
- name: Reboot machine for shell environment change
become: true
ansible.builtin.reboot:
msg: Rebooting machine
tags: tags:
- get_archive_pkgs - get_archive_pkgs
- name: Installing software from source git repositories - name: Installing software from source git repositories
@@ -155,9 +207,12 @@
version: "{{ item.branch }}" version: "{{ item.branch }}"
clone: true clone: true
single_branch: true single_branch: true
# @TODO add a default value for notify notify: "{{ item.handler | default('default') }}"
notify: "{{ item.name }}"
loop: "{{ (pkgs.git_repos.core | default([])) }}" loop: "{{ (pkgs.git_repos.core | default([])) }}"
register: installation_repos register: installation_repos
- name: Reboot machine for shell environment change
become: true
ansible.builtin.reboot:
msg: Rebooting machine
tags: tags:
- get_git_pkgs - get_git_pkgs

View File

@@ -46,9 +46,55 @@
when: ansible_facts["os_family"] == "Debian" when: ansible_facts["os_family"] == "Debian"
become: true become: true
block: block:
- name: Creating core OS repository sources for package manager
when: ansible_facts["os_family"] == "Debian"
ansible.builtin.deb822_repository:
name: "{{ item.name }}"
uris: "{{ item.sources }}"
types: "{{ item.types }}"
suites: "{{ item.suites }}"
components: "{{ item.comps }}"
signed_by: "{{ item.sigkey }}"
state: present
loop:
- name: debian-trixie
sources: "http://deb.debian.org/debian/"
sigkey: /usr/share/keyrings/debian-archive-keyring.gpg
types:
- deb-src
- deb
suites:
- trixie
- trixie-updates
comps:
- main
- non-free-firmware
- contrib
- name: debian-trixie-security
sources: "http://security.debian.org/debian-security"
sigkey: /usr/share/keyrings/debian-archive-keyring.gpg
types:
- deb-src
- deb
suites: trixie-security
comps:
- main
- non-free-firmware
- contrib
- name: Remove previous core OS repository sources for package manager
ansible.builtin.file:
path: /etc/apt/sources.list
state: absent
# @TODO uncomment below before continuing with testing previous task
# - name: Premature end of play
# ansible.builtin.meta: end_play
- name: Updating package cache - name: Updating package cache
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
- name: Updating package cache
ansible.builtin.apt:
upgrade: dist
autoremove: true
- name: Registering a package source - name: Registering a package source
when: item.sources != None when: item.sources != None
ansible.builtin.deb822_repository: ansible.builtin.deb822_repository:
@@ -60,32 +106,30 @@
signed_by: "{{ item.sigkey }}" signed_by: "{{ item.sigkey }}"
state: present state: present
loop: "{{ (pkgs.mngr.userspace | default([])) }}" loop: "{{ (pkgs.mngr.userspace | default([])) }}"
- name: Updating package cache
ansible.builtin.apt:
update_cache: true
- name: Installing a local package in managed node - name: Installing a local package in managed node
when: item.uri != None when: item.uri != None
ansible.builtin.apt: ansible.builtin.apt:
deb: "{{ item.uri }}" deb: "{{ item.uri }}"
state: present state: present
# @TODO add a default value for notify notify: "{{ item.handler | default('default') }}"
# notify: "{{ item.name }}"
loop: "{{ (pkgs.mngr.userspace | default([])) | selectattr('uri', 'search', '\\.deb$') }}" loop: "{{ (pkgs.mngr.userspace | default([])) | selectattr('uri', 'search', '\\.deb$') }}"
- name: Updating package cache
ansible.builtin.apt:
update_cache: true
- name: Installing a package - name: Installing a package
when: item.name != None and item.uri == None when: item.name != None and item.uri == None
ansible.builtin.package: ansible.builtin.package:
name: "{{ item.name }}" name: "{{ item.name }}"
state: latest state: latest
# @TODO add a default value for notify notify: "{{ item.handler | default('default') }}" # @TODO create corresponding roles/init-vps handlers
# notify: "{{ item.name }}" # @TODO create corresponding roles/init-vps handlers
loop: "{{ (pkgs.mngr.userspace | default([])) | rejectattr('uri', 'search', '\\.deb$') }}" loop: "{{ (pkgs.mngr.userspace | default([])) | rejectattr('uri', 'search', '\\.deb$') }}"
tags: tags:
- get_mngr_pkgs - get_mngr_pkgs
- name: Installing software by executing installation shell scripts - name: Installing software by executing installation shell scripts
become: true become: true
become_user: "{{ current_user.stdout }}"
block: block:
- name: Acquiring installation shell script - name: Acquiring installation shell script
become_user: "{{ current_user.stdout }}"
when: item.src != None and ((pkgs.script.userspace | default([])) | length) > 0 when: item.src != None and ((pkgs.script.userspace | default([])) | length) > 0
ansible.builtin.uri: ansible.builtin.uri:
url: "{{ item.src }}" url: "{{ item.src }}"
@@ -95,12 +139,14 @@
group: "{{ ansible_user }}" group: "{{ ansible_user }}"
force: true force: true
mode: "744" mode: "744"
# @TODO add a default value for notify notify: "{{ (pkgs.script.userspace | default([]))[idx].handler | default('default') }}"
notify: "{{ (pkgs.script.userspace | default([]))[idx].name }}"
loop: "{{ (pkgs.script.userspace | default([])) }}" loop: "{{ (pkgs.script.userspace | default([])) }}"
loop_control: loop_control:
index_var: idx index_var: idx
register: install_scripts register: install_scripts
- name: Reboot machine for shell environment change
ansible.builtin.reboot:
msg: Rebooting machine
tags: tags:
- get_script_pkgs - get_script_pkgs
- name: Installing software by building it from source archives - name: Installing software by building it from source archives
@@ -139,37 +185,35 @@
dest: "{{ ansible_user_home.stdout }}/downloads/archives/released/{{ (pkgs.archive.userspace | default([]))[idx].name }}/" dest: "{{ ansible_user_home.stdout }}/downloads/archives/released/{{ (pkgs.archive.userspace | default([]))[idx].name }}/"
owner: "{{ ansible_user }}" owner: "{{ ansible_user }}"
group: "{{ ansible_user }}" group: "{{ ansible_user }}"
# @TODO add a default value for notify notify: "{{ (pkgs.archive.userspace | default([]))[idx].handler | default('default') }}"
notify: "{{ (pkgs.archive.userspace | default([]))[idx].name }}"
loop: "{{ archived_builds.results }}" loop: "{{ archived_builds.results }}"
loop_control: loop_control:
index_var: idx index_var: idx
- name: Reboot machine for shell environment change
become: true
ansible.builtin.reboot:
msg: Rebooting machine
tags: tags:
- get_archive_pkgs - get_archive_pkgs
- name: Installing software from source git repositories - name: Installing software from source git repositories
block: block:
- name: Clone git bare repository - name: Clone git bare repository
when: item.src != None
become: true become: true
become_user: "{{ current_user.stdout }}" become_user: "{{ current_user.stdout }}"
when: item.src != None
ansible.builtin.git: ansible.builtin.git:
repo: "{{ item.src }}" repo: "{{ item.src }}"
dest: "{{ ansible_user_home.stdout }}/repos/.foreign/{{ item.name }}" dest: "{{ ansible_user_home.stdout }}/repos/.foreign/{{ item.name }}"
version: "{{ item.branch }}" version: "{{ item.branch }}"
clone: true clone: true
single_branch: true single_branch: true
notify: "{{ item.handler | default('default') }}"
loop: "{{ (pkgs.git_repos.userspace | default([])) }}" loop: "{{ (pkgs.git_repos.userspace | default([])) }}"
register: installation_repos register: installation_repos
# - name: Changing ownership of specific repo subdirectory - name: Reboot machine for shell environment change
# become: true become: true
# become_user: "{{ current_user.stdout }}" ansible.builtin.reboot:
# ansible.builtin.file: msg: Rebooting machine
# path: "{{ ansible_user_home.stdout }}/repos/.foreign/{{ item.name }}"
# recurse: true
# owner: "{{ ansible_user }}"
# group: "{{ ansible_user }}"
# notify: "{{ item.name }}"
# loop: "{{ (pkgs.git_repos.userspace | default([])) }}"
tags: tags:
- get_git_pkgs - get_git_pkgs
# @TODO add a reboot either here or in any of the handlers potentially notified from here in # @TODO add a reboot either here or in any of the handlers potentially notified from here in