mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Another big round of refactoring and cleaning...
This commit is contained in:
29
roles/update-compose/meta/main.yml
Normal file
29
roles/update-compose/meta/main.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Centralizes system update operations by conditionally invoking platform-specific update roles and Docker image updates."
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions:
|
||||
- rolling
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- update
|
||||
- system
|
||||
- maintenance
|
||||
- docker
|
||||
- apt
|
||||
- pacman
|
||||
repository: "https://s.veen.world/cymais"
|
||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
dependencies: []
|
26
roles/update-compose/tasks/README.md
Normal file
26
roles/update-compose/tasks/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Update System
|
||||
|
||||
## Description
|
||||
|
||||
This role serves as a central orchestrator for system updates. It conditionally executes various update roles based on the target system and available directories, ensuring that packages and Docker images are kept up-to-date.
|
||||
|
||||
## Overview
|
||||
|
||||
This role performs the following tasks:
|
||||
- Checks if the Docker Compose instances directory exists.
|
||||
- Executes system updates using platform-specific methods:
|
||||
- Uses [pacman](https://wiki.archlinux.org/title/Pacman) for Arch Linux.
|
||||
- Uses [apt](https://en.wikipedia.org/wiki/APT_(software)) for Debian-based systems.
|
||||
- Invokes the Docker update role if Docker Compose instances are found.
|
||||
- Checks for the presence of the [yay](https://wiki.archlinux.org/title/Yay) AUR helper and, if installed, triggers an update for AUR packages.
|
||||
|
||||
## Purpose
|
||||
|
||||
The primary purpose of this role is to streamline system maintenance by delegating updates to the appropriate update roles based on the system’s platform and current configuration.
|
||||
|
||||
## Features
|
||||
|
||||
- **Conditional Execution:** Runs update roles based on the operating system and available directories.
|
||||
- **Multi-Platform Support:** Supports both Arch Linux and Debian-based distributions.
|
||||
- **Docker Image Updates:** Triggers Docker image updates when applicable.
|
||||
- **AUR Package Updates:** Checks for the AUR helper and updates AUR packages if present.
|
51
roles/update-compose/tasks/main.yml
Normal file
51
roles/update-compose/tasks/main.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
- name: "Check if {{ path_docker_compose_instances }} directory exists"
|
||||
stat:
|
||||
path: "{{ path_docker_compose_instances }}"
|
||||
register: docker_compose_directory_stat
|
||||
|
||||
- name: "Update with pacman"
|
||||
include_role:
|
||||
name: update-pacman
|
||||
when: ansible_distribution == 'Archlinux'
|
||||
|
||||
- name: "Update with apt"
|
||||
include_role:
|
||||
name: update-apt
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: "Update Docker Images"
|
||||
include_role:
|
||||
name: update-docker
|
||||
when: docker_compose_directory_stat.stat.exists
|
||||
|
||||
- name: "Check if yay is installed"
|
||||
command: which yay
|
||||
register: yay_installed
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: "Update with yay"
|
||||
include_role:
|
||||
name: update-yay
|
||||
when: yay_installed.rc == 0
|
||||
|
||||
- name: "Check if pip is installed"
|
||||
command: which pip
|
||||
register: pip_installed
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: "Update with pip"
|
||||
include_role:
|
||||
name: update-pip
|
||||
|
||||
- name: "Check if pkgmgr command is available"
|
||||
command: "which pkgmgr"
|
||||
register: pkgmgr_available
|
||||
failed_when: false
|
||||
|
||||
- name: "Update all repositories using pkgmgr"
|
||||
include_role:
|
||||
name: update-pkgmgr
|
||||
when: pkgmgr_available.rc == 0
|
Reference in New Issue
Block a user