diff --git a/group_vars/all/07_applications.yml b/group_vars/all/07_applications.yml index 58c03a64..d4521a2b 100644 --- a/group_vars/all/07_applications.yml +++ b/group_vars/all/07_applications.yml @@ -706,7 +706,7 @@ defaults_applications: ## Presentation presentation: matomo_tracking_enabled: "{{matomo_tracking_enabled_default}}" # Enables\Disables Matomo Tracking - css_enabled: "{{css_enabled_default}}" # Enables\Disables Global CSS Style + css_enabled: False # Would mess with the presentation layout landingpage_iframe_enabled: False # Makes sense to make the documentary allways in iframe available # Snipe-IT diff --git a/roles/backup-directory-validator/meta/main.yml b/roles/backup-directory-validator/meta/main.yml index dfe9519c..dec32132 100644 --- a/roles/backup-directory-validator/meta/main.yml +++ b/roles/backup-directory-validator/meta/main.yml @@ -22,6 +22,3 @@ galaxy_info: repository: "https://s.veen.world/cymais" issue_tracker_url: "https://s.veen.world/cymaisissues" documentation: "https://s.veen.world/cymais" - -dependencies: - - package-manager diff --git a/roles/backup-directory-validator/tasks/main.yml b/roles/backup-directory-validator/tasks/main.yml index 87ed8231..eb42d033 100644 --- a/roles/backup-directory-validator/tasks/main.yml +++ b/roles/backup-directory-validator/tasks/main.yml @@ -1,6 +1,8 @@ -- name: install directory-validator - command: - cmd: "pkgmgr install directory-validator --clone-mode https" +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: directory-validator when: run_once_backup_directory_validator is not defined - name: run the backup_directory_validator tasks once diff --git a/roles/backup-docker-to-local/meta/main.yml b/roles/backup-docker-to-local/meta/main.yml index e498e168..b0bebf8d 100644 --- a/roles/backup-docker-to-local/meta/main.yml +++ b/roles/backup-docker-to-local/meta/main.yml @@ -27,5 +27,4 @@ dependencies: - systemd-notifier - cleanup-failed-docker-backups - system-maintenance-lock - - backup-directory-validator - - package-manager \ No newline at end of file + - backup-directory-validator \ No newline at end of file diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index 22d7bc5a..bdb97b13 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -1,6 +1,8 @@ -- name: install backup-docker-to-local - command: - cmd: "pkgmgr install backup-docker-to-local --clone-mode https" +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: backup-docker-to-local when: run_once_backup_docker_to_local is not defined - name: Retrieve backup-docker-to-local path from pkgmgr diff --git a/roles/cleanup-docker-anonymous-volumes/meta/main.yml b/roles/cleanup-docker-anonymous-volumes/meta/main.yml index daa65dbf..d67cee63 100644 --- a/roles/cleanup-docker-anonymous-volumes/meta/main.yml +++ b/roles/cleanup-docker-anonymous-volumes/meta/main.yml @@ -23,6 +23,3 @@ galaxy_info: repository: "https://github.com/kevinveenbirkenbach/docker-volume-cleaner" issue_tracker_url: "https://github.com/kevinveenbirkenbach/docker-volume-cleaner/issues" documentation: "https://github.com/kevinveenbirkenbach/docker-volume-cleaner#readme" - -dependencies: - - package-manager diff --git a/roles/cleanup-docker-anonymous-volumes/tasks/main.yml b/roles/cleanup-docker-anonymous-volumes/tasks/main.yml index 737ff1c2..a1779e6c 100644 --- a/roles/cleanup-docker-anonymous-volumes/tasks/main.yml +++ b/roles/cleanup-docker-anonymous-volumes/tasks/main.yml @@ -1,6 +1,8 @@ -- name: install dockreap - command: - cmd: "pkgmgr install dockreap" +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: dockreap when: run_once_cleanup_docker_anonymous_volumes is not defined - name: run dockreap with --no-confirmation diff --git a/roles/cleanup-failed-docker-backups/meta/main.yml b/roles/cleanup-failed-docker-backups/meta/main.yml index e853aac1..36d98dae 100644 --- a/roles/cleanup-failed-docker-backups/meta/main.yml +++ b/roles/cleanup-failed-docker-backups/meta/main.yml @@ -25,4 +25,3 @@ dependencies: - systemd-notifier - system-maintenance-lock - backup-directory-validator - - package-manager diff --git a/roles/cleanup-failed-docker-backups/tasks/main.yml b/roles/cleanup-failed-docker-backups/tasks/main.yml index e4943201..126bcad8 100644 --- a/roles/cleanup-failed-docker-backups/tasks/main.yml +++ b/roles/cleanup-failed-docker-backups/tasks/main.yml @@ -1,6 +1,8 @@ -- name: install cleanup-failed-docker-backups - command: - cmd: "pkgmgr install cleanup-failed-docker-backups --clone-mode https" +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: cleanup-failed-docker-backups when: run_once_cleanup_failed_docker_backups is not defined - name: Retrieve backup-docker-to-local path from pkgmgr diff --git a/roles/client-git/README.md b/roles/client-git/README.md index f882c103..b0469b18 100644 --- a/roles/client-git/README.md +++ b/roles/client-git/README.md @@ -13,7 +13,7 @@ The purpose of this role is to automate the installation and configuration of Gi - **Automated Git Installation:** Installs Git using Pacman. - **Custom Git Configuration:** Invokes the git-configurator tool to merge user-specific configuration options. - **Idempotent Task Execution:** Uses host-level run-once artifacts to ensure that configuration tasks are executed only once per host. -- **Integration:** Works alongside the package-manager role to streamline overall system setup. +- **Integration:** Works alongside the pkgmgr role to streamline overall system setup. ## Credits diff --git a/roles/client-git/meta/main.yml b/roles/client-git/meta/main.yml index 793752db..1fc1b023 100644 --- a/roles/client-git/meta/main.yml +++ b/roles/client-git/meta/main.yml @@ -17,6 +17,4 @@ galaxy_info: - git - configuration - pacman - - personal-computer -dependencies: - - package-manager \ No newline at end of file + - personal-computer \ No newline at end of file diff --git a/roles/client-git/tasks/main.yml b/roles/client-git/tasks/main.yml index 5f154cc4..0e3d1f39 100644 --- a/roles/client-git/tasks/main.yml +++ b/roles/client-git/tasks/main.yml @@ -4,11 +4,11 @@ state: present become: true -- name: install gitconfig - command: - cmd: "pkgmgr install gitconfig --clone-mode https" - when: run_once_gitconfig is not defined - become: true +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: gitconfig - name: setup git command: gitconfig --merge-option rebase --name "{{users.client.full_name}}" --email "{{users.client.email}}" --website "{{users.client.website}}" --signing gpg --gpg-key "{{users.client.gpg}}" diff --git a/roles/client-gnome-extensions/meta/main.yml b/roles/client-gnome-extensions/meta/main.yml index f1fbe5ad..6bdc620e 100644 --- a/roles/client-gnome-extensions/meta/main.yml +++ b/roles/client-gnome-extensions/meta/main.yml @@ -16,6 +16,4 @@ galaxy_info: galaxy_tags: - gnome - extensions - - automation -dependencies: - - package-manager + - automation \ No newline at end of file diff --git a/roles/client-gnome-extensions/tasks/main.yml b/roles/client-gnome-extensions/tasks/main.yml index 2877db06..59684f5d 100644 --- a/roles/client-gnome-extensions/tasks/main.yml +++ b/roles/client-gnome-extensions/tasks/main.yml @@ -2,10 +2,11 @@ ansible.builtin.shell: gsettings set org.gnome.shell disable-user-extensions false become: false -- name: install cli-gnome-extension-manager - command: - cmd: "pkgmgr install cli-gnome-extension-manager --clone-mode https" - become: false +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: cli-gnome-extension-manager - name: Execute CLI GNOME Extension manager script ansible.builtin.shell: cli-gnome-extension-manager "{{ item[0] }}" "{{ item[1] }}" "{{ item[2] }}" diff --git a/roles/docker-portfolio/lookup_plugins/docker_cards.py b/roles/docker-portfolio/lookup_plugins/docker_cards.py index cab23990..c4629404 100644 --- a/roles/docker-portfolio/lookup_plugins/docker_cards.py +++ b/roles/docker-portfolio/lookup_plugins/docker_cards.py @@ -73,6 +73,11 @@ class LookupModule(LookupBase): meta_data = yaml.safe_load(f) galaxy_info = meta_data.get("galaxy_info", {}) + + # If display is set to False ignore it + if not galaxy_info.get("display", True): + continue + description = galaxy_info.get("description", "") logo = galaxy_info.get("logo", {}) icon_class = logo.get("class", "fa-solid fa-cube") diff --git a/roles/docker-portfolio/lookup_plugins/docker_cards_grouped.py b/roles/docker-portfolio/lookup_plugins/docker_cards_grouped.py new file mode 100644 index 00000000..fe71056d --- /dev/null +++ b/roles/docker-portfolio/lookup_plugins/docker_cards_grouped.py @@ -0,0 +1,38 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +from ansible.plugins.lookup import LookupBase +from ansible.errors import AnsibleError + +class LookupModule(LookupBase): + def run(self, terms, variables=None, **kwargs): + """ + Group the given cards into categorized and uncategorized lists + based on the tags from menu_categories. + """ + if len(terms) < 1: + raise AnsibleError("Missing required argument: cards") + + cards = terms[0] + menu_categories = variables.get("menu_categories", {}) + + categorized = {} + uncategorized = [] + + for card in cards: + found = False + for category, data in menu_categories.items(): + if any(tag in data.get('tags', []) for tag in card.get('tags', [])): + categorized.setdefault(category, []).append(card) + found = True + break + if not found: + uncategorized.append(card) + + return [ + { + 'categorized': categorized, + 'uncategorized': uncategorized, + } + ] + diff --git a/roles/docker-portfolio/tasks/main.yml b/roles/docker-portfolio/tasks/main.yml index 550a0a95..2b6d71a8 100644 --- a/roles/docker-portfolio/tasks/main.yml +++ b/roles/docker-portfolio/tasks/main.yml @@ -21,6 +21,22 @@ become: false register: config_file +- name: Load docker cards + set_fact: + portfolio_cards: "{{ lookup('docker_cards', 'roles') }}" + +- name: Group docker cards + set_fact: + portfolio_menu_data: "{{ lookup('docker_cards_grouped', portfolio_cards) }}" + +- name: Debug portfolio data + debug: + msg: + cards: "{{ portfolio_cards }}" + menu_data: "{{ portfolio_menu_data }}" + when: enable_debug | bool + + - name: Copy host-specific config.yaml if it exists template: src: "{{ config_inventory_path }}" diff --git a/roles/docker-portfolio/templates/config.yaml.j2 b/roles/docker-portfolio/templates/config.yaml.j2 index 5c74fade..6fb120f8 100644 --- a/roles/docker-portfolio/templates/config.yaml.j2 +++ b/roles/docker-portfolio/templates/config.yaml.j2 @@ -105,7 +105,7 @@ accounts: - link: navigation.header.contact cards: -{{ lookup('docker_cards', 'roles') | to_nice_yaml(indent=2) }} +{{ portfolio_cards | to_nice_yaml(indent=2) }} platform: titel: {{service_provider.platform.titel}} @@ -166,249 +166,14 @@ navigation: footer: children: - link: accounts - -{% if ["discourse","moodle","listmonk","openproject","taiga","snipe_it","matrix","bigbluebutton","mailu", "matomo","phpmyadmin","keycloak", "ldap", "baserow","yourls","nextcloud"] | any_in(group_names) %} - - name: Solution Hub description: Curated collection of self hosted tools icon: class: fa-solid fa-network-wired children: - {% if ["discourse","moodle","listmonk"] | any_in(group_names) %} - - - name: Community - description: Tools to manage the community - icon: - class: fa-solid fa-users - children: - - {% if "discourse" in group_names %} - - - name: Forum - description: Join the discussion - icon: - class: fa-brands fa-discourse - url: https://{{domains.discourse}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('discourse') }} - - {% endif %} - {% if "moodle" in group_names %} - - - name: Learning Platform - description: Learn with {{ 'our' if service_provider.type == 'legal' else 'my' }} academy - icon: - class: fa-solid fa-graduation-cap - url: https://{{domains.moodle}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('moodle') }} - - {% endif %} - {% if "listmonk" in group_names %} - - - name: Newsletter - description: Subscribe to {{ 'our' if service_provider.type == 'legal' else 'my' }} newsletter - icon: - class: fa-solid fa-envelope-open-text - url: https://{{domains.listmonk}}/subscription/form - iframe: {{ applications | get_landingpage_iframe_enabled('listmonk') }} - - {% endif %} - {% endif %} - {% if ["openproject","taiga","snipe_it"] | any_in(group_names) %} - - - name: Project Management - description: Project Management Tools - icon: - class: fa-solid fa-chart-line - children: - - {% if "openproject" in group_names %} - - - name: Open Project - description: Explore {{ 'our' if service_provider.type == 'legal' else 'my' }} projects - icon: - class: fa-solid fa-tasks - url: https://{{domains.openproject}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('openproject') }} - - {% endif %} - {% if "taiga" in group_names %} - - - name: Taiga - description: View {{ 'our' if service_provider.type == 'legal' else 'my' }} Kanban board - icon: - class: bi bi-clipboard2-check-fill - url: https://{{domains.taiga}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('taiga') }} - - {% endif %} - {% if "snipe_it" in group_names %} - - - name: Snipe IT - description: Manage {{ 'our' if service_provider.type == 'legal' else 'my' }} inventory - icon: - class: fas fa-box-open - url: https://{{domains.snipe_it}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('snipe_it') }} - - {% endif %} - {% endif %} - {% if ["matrix","bigbluebutton","mailu"] | any_in(group_names) %} - - - name: Communication - icon: - class: fa-solid fa-comments - children: - - {% if "matrix" in group_names %} - - - name: Elements - description: Chat with the world - icon: - class: fa-solid fa-comment - url: https://{{domains.matrix_element}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('matrix') }} - - {% endif %} - {% if "bigbluebutton" in group_names %} - - - name: Big Blue Button - description: Join live events - icon: - class: fa-solid fa-video - url: https://{{domains.bigbluebutton}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('bigbluebutton') }} - - {% endif %} - {% if "mailu" in group_names %} - - - name: Mailu - description: Send{{ 'our' if service_provider.type == 'legal' else 'my' }}a mail - icon: - class: fa-solid fa-envelope - url: https://{{domains.mailu}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('mailu') }} - - {% endif %} - {% endif %} - {% if ["matomo","phpmyadmin","keycloak", "ldap"] | any_in(group_names) %} - - - name: Administration - icon: - class: fas fa-building - children: - - {% if "matomo" in group_names %} - - - name: Matomo - description: Analyze with Matomo - icon: - class: fa-solid fa-chart-simple - url: https://{{domains.matomo}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('matomo') }} - - {% endif %} - {% if "phpmyadmin" in group_names %} - - - name: phpMyAdmin - description: Administrate MySQL and MariaDB databases - icon: - class: fas fa-database - url: https://{{domains.phpmyadmin}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('phpmyadmin') }} - - {% endif %} - - {% if "pgadmin" in group_names %} - - - name: pgAdmin - description: Administrate PostgreSQL databases with ease and precision - icon: - class: fas fa-database - url: https://{{domains.pgadmin}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('pgadmin') }} - - {% endif %} - - {% if "keycloak" in group_names %} - - - name: Keycloak - description: Manage User via Keycloak - icon: - class: fas fa-user-shield - iframe: {{ applications | get_landingpage_iframe_enabled('keycloak') }} - children: - - name: Administration - description: Access the central admin console - icon: - class: fa-solid fa-shield-halved - url: https://{{domains.keycloak}}/admin - iframe: {{ applications | get_landingpage_iframe_enabled('keycloak') }} - - name: Profile - description: Update your personal admin settings - icon: - class: fa-solid fa-user-gear - url: https://{{ domains.keycloak }}/realms/{{oidc.client.id}}/account - iframe: {{ applications | get_landingpage_iframe_enabled('keycloak') }} - - name: Logout - description: End your admin session securely - icon: - class: fa-solid fa-right-from-bracket - url: https://{{ domains.keycloak }}/realms/{{oidc.client.id}}/protocol/openid-connect/logout - iframe: false - - {% endif %} - {% if "ldap" in group_names %} - - - name: LDAP - description: Manage LDAP - icon: - class: fas fa-key - url: https://{{domains.ldap}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('ldap') }} - - {% endif %} - {% endif %} - {% if ["baserow","yourls","nextcloud"] | any_in(group_names) %} - - - name: Tools - icon: - class: fas fa-tools - children: - - {% if "baserow" in group_names %} - - - name: Baserow - description: Organize with Baserow - icon: - class: fa-solid fa-table - url: https://{{domains.baserow}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('baserow') }} - - {% endif %} - {% if "yourls" in group_names %} - - - name: Yourls - description: Create Shortlinks - icon: - class: bi bi-link - url: https://{{domains.yourls}}/admin/ - iframe: {{ applications | get_landingpage_iframe_enabled('yourls') }} - - {% endif %} - {% if "nextcloud" in group_names %} - - - name: Nextcloud - description: Access your cloud storage - icon: - class: fa-solid fa-cloud - url: https://{{domains.nextcloud}}/ - iframe: {{ applications | get_landingpage_iframe_enabled('nextcloud') }} - - {% endif %} - {% endif %} -{% endif %} - +{% include 'footer_menu.yaml.j2' %} + - name: Support Us description: "Discover all the ways you can support our work." icon: @@ -444,6 +209,17 @@ navigation: url: https://{{domains.sphinx}} iframe: {{ applications | get_landingpage_iframe_enabled('sphinx') }} +{% endif %} + +{% if "presentation" in group_names %} + + - name: Slides + description: Access our comprehensive documentation and support resources to help you get the most out of the software. + icon: + class: fas fa-book + url: https://{{domains.sphinx}} + iframe: {{ applications | get_landingpage_iframe_enabled('sphinx') }} + {% endif %} - name: Imprint diff --git a/roles/docker-portfolio/templates/footer_menu.yaml.j2 b/roles/docker-portfolio/templates/footer_menu.yaml.j2 new file mode 100644 index 00000000..72a234e2 --- /dev/null +++ b/roles/docker-portfolio/templates/footer_menu.yaml.j2 @@ -0,0 +1,52 @@ +{# Render all categories #} +{% for category, apps in portfolio_menu_data.categorized %} + - name: {{ category }} + description: {{ category_data.menu_categories[category].description }} + icon: + class: {{ category_data.menu_categories[category].icon }} + children: + {% for app in apps %} + - name: {{ app.title }} + description: {{ app.text }} + icon: {{ app.icon }} + url: {{ app.url }} + iframe: {{ app.iframe }} + {% if app.title == 'Keycloak' %} + children: + - name: Administration + description: Access the central admin console + icon: + class: fa-solid fa-shield-halved + url: https://{{domains.keycloak}}/admin + iframe: {{ applications | get_landingpage_iframe_enabled('keycloak') }} + - name: Profile + description: Update your personal admin settings + icon: + class: fa-solid fa-user-gear + url: https://{{ domains.keycloak }}/realms/{{oidc.client.id}}/account + iframe: {{ applications | get_landingpage_iframe_enabled('keycloak') }} + - name: Logout + description: End your admin session securely + icon: + class: fa-solid fa-right-from-bracket + url: https://{{ domains.keycloak }}/realms/{{oidc.client.id}}/protocol/openid-connect/logout + iframe: false + {% endif %} + {% endfor %} +{% endfor %} + +{# Render Uncategorized +{% if portfolio_menu_data.uncategorized %} + - name: Uncategorized + description: Tools without a defined category + icon: + class: fa-solid fa-question + children: + {% for app in portfolio_menu_data.uncategorized %} + - name: {{ app.title }} + description: {{ app.text }} + icon: {{ app.icon }} + url: {{ app.url }} + iframe: {{ app.iframe }} + {% endfor %} +{% endif %} #} diff --git a/roles/docker-portfolio/vars/menu_categories.yml b/roles/docker-portfolio/vars/menu_categories.yml new file mode 100644 index 00000000..19559bf1 --- /dev/null +++ b/roles/docker-portfolio/vars/menu_categories.yml @@ -0,0 +1,42 @@ +menu_categories: + Community: + description: Tools to manage the community + icon: fa-solid fa-users + tags: + - community + - forum + - learning + - newsletter + + Project Management: + description: Project Management Tools + icon: fa-solid fa-chart-line + tags: + - project + - kanban + - management + + Communication: + description: Tools for communication + icon: fa-solid fa-comments + tags: + - chat + - communication + - video + - mail + + Administration: + description: Administration Tools + icon: fas fa-building + tags: + - administration + - database + - user-management + + Tools: + description: Helpful Tools + icon: fas fa-tools + tags: + - tools + - utility + - baserow diff --git a/roles/docker-presentation/meta/main.yml b/roles/docker-presentation/meta/main.yml index 562f0b8e..a4088e87 100644 --- a/roles/docker-presentation/meta/main.yml +++ b/roles/docker-presentation/meta/main.yml @@ -25,6 +25,4 @@ galaxy_info: issue_tracker_url: "https://s.veen.world/cymaisissues" documentation: "https://s.veen.world/cymais" logo: - class: "fas fa-chalkboard-teacher" -dependencies: - - package-manager \ No newline at end of file + class: "fas fa-chalkboard-teacher" \ No newline at end of file diff --git a/roles/docker-presentation/tasks/main.yml b/roles/docker-presentation/tasks/main.yml index f947c4c3..4d3a65c4 100644 --- a/roles/docker-presentation/tasks/main.yml +++ b/roles/docker-presentation/tasks/main.yml @@ -4,10 +4,12 @@ include_role: name: docker-compose -- name: install cymais-presentation - command: - cmd: "pkgmgr install cymais-presentation --clone-mode https" - notify: docker compose project build and setup +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: cymais-presentation + package_notify: docker compose project build and setup - name: Get path of cymais-presentation using pkgmgr command: pkgmgr path cymais-presentation diff --git a/roles/docker-sphinx/meta/main.yml b/roles/docker-sphinx/meta/main.yml index a3f08c82..9781d2b5 100644 --- a/roles/docker-sphinx/meta/main.yml +++ b/roles/docker-sphinx/meta/main.yml @@ -26,6 +26,4 @@ galaxy_info: issue_tracker_url: "https://s.veen.world/cymaisissues" documentation: "https://s.veen.world/cymais" logo: - class: "fa-solid fa-book" -dependencies: - - package-manager + class: "fa-solid fa-book" \ No newline at end of file diff --git a/roles/docker-sphinx/tasks/main.yml b/roles/docker-sphinx/tasks/main.yml index d6f0bf03..86a6f87c 100644 --- a/roles/docker-sphinx/tasks/main.yml +++ b/roles/docker-sphinx/tasks/main.yml @@ -4,10 +4,12 @@ include_role: name: docker-compose -- name: install cymais-sphinx - command: - cmd: "pkgmgr install cymais-sphinx --clone-mode https" - notify: docker compose project build and setup +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: cymais-sphinx + package_notify: docker compose project build and setup - name: Get path of cymais-sphinx using pkgmgr command: pkgmgr path cymais-sphinx diff --git a/roles/driver-lid-switch/meta/main.yml b/roles/driver-lid-switch/meta/main.yml index 82567e42..1cf264b5 100644 --- a/roles/driver-lid-switch/meta/main.yml +++ b/roles/driver-lid-switch/meta/main.yml @@ -23,5 +23,3 @@ galaxy_info: repository: https://s.veen.world/cymais issue_tracker_url: https://s.veen.world/cymaisissues documentation: https://s.veen.world/cymais -dependencies: - - role: package-manager diff --git a/roles/driver-lid-switch/tasks/main.yml b/roles/driver-lid-switch/tasks/main.yml index 2876f474..1e0f557f 100644 --- a/roles/driver-lid-switch/tasks/main.yml +++ b/roles/driver-lid-switch/tasks/main.yml @@ -1,8 +1,9 @@ --- -- name: install setup-hibernate - command: - cmd: "pkgmgr install setup-hibernate --clone-mode https" - become: true +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: setup-hibernate - name: Setup hibernate command: setup-hibernate --non-interactive diff --git a/roles/persona-developer/meta/main.yml b/roles/persona-developer/meta/main.yml index 376ccfd1..274cb41c 100644 --- a/roles/persona-developer/meta/main.yml +++ b/roles/persona-developer/meta/main.yml @@ -25,4 +25,4 @@ galaxy_info: documentation: https://s.veen.world/cymais dependencies: - persona-administrator - - package-manager \ No newline at end of file + - pkgmgr \ No newline at end of file diff --git a/roles/pkgmgr-install/README.md b/roles/pkgmgr-install/README.md new file mode 100644 index 00000000..a9fc8dd3 --- /dev/null +++ b/roles/pkgmgr-install/README.md @@ -0,0 +1,47 @@ +# Package Manager Installation 📦 + +## Description + +This Ansible role installs and updates packages using `pkgmgr` on Arch Linux systems. It provides a unified interface for package installation and update management, ensuring consistent deployment across environments. + +## Overview + +The role abstracts package management operations using `pkgmgr`. It ensures the package manager itself is updated once per run and provides idempotent installation and update routines for specified packages. + +## Purpose + +The purpose of this role is to automate the installation and update process for CyMaIS-related applications or other managed packages using `pkgmgr`. It simplifies package handling and enforces best practices for package deployment in automated environments. + +## Features + +- **Automatic pkgmgr Update:** Ensures the package manager is always up-to-date. +- **Idempotent Package Installation:** Only installs packages when necessary. +- **Flexible Notification:** Supports handler notification for post-install actions (e.g., Docker Compose builds). +- **Optional Privilege Escalation:** Controlled via the `pkgmgr_become` variable (default: `true`). + +## Role Variables + +| Name | Description | Default | +|-----------------|-----------------------------------------------------------------|---------| +| `package_name` | Name of the package to install/update | (required) | +| `package_notify` | Handler to notify on package installation/update | "" | +| `pkgmgr_become` | Execute all tasks with elevated privileges (become: true/false) | true | + +## Example Usage + +```yaml +- name: Install cymais-presentation + include_role: + name: pkgmgr-install + vars: + package_name: cymais-presentation + package_notify: docker compose project build and setup +``` + +## Credits 📝 + +Developed and maintained by **Kevin Veen-Birkenbach**. +Learn more at [www.veen.world](https://www.veen.world) + +Part of the [CyMaIS Project](https://github.com/kevinveenbirkenbach/cymais) +License: [CyMaIS NonCommercial License (CNCL)](https://s.veen.world/cncl) \ No newline at end of file diff --git a/roles/pkgmgr-install/defaults/main.yml b/roles/pkgmgr-install/defaults/main.yml new file mode 100644 index 00000000..99bdca6e --- /dev/null +++ b/roles/pkgmgr-install/defaults/main.yml @@ -0,0 +1,2 @@ +--- +pkgmgr_become: true \ No newline at end of file diff --git a/roles/pkgmgr-install/meta/main.yml b/roles/pkgmgr-install/meta/main.yml new file mode 100644 index 00000000..7426accf --- /dev/null +++ b/roles/pkgmgr-install/meta/main.yml @@ -0,0 +1,25 @@ +galaxy_info: + author: "Kevin Veen-Birkenbach" + description: "Installs and updates packages using pkgmgr." + 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 + galaxy_tags: + - pkgmgr + - package + - update + - archlinux + - cymais + repository: https://s.veen.world/cymais + issue_tracker_url: https://s.veen.world/cymaisissues + documentation: https://s.veen.world/cymais +dependencies: + - pkgmgr \ No newline at end of file diff --git a/roles/pkgmgr-install/tasks/main.yml b/roles/pkgmgr-install/tasks/main.yml new file mode 100644 index 00000000..11ba44f5 --- /dev/null +++ b/roles/pkgmgr-install/tasks/main.yml @@ -0,0 +1,22 @@ +- name: "{{ role_name }} | pkgmgr installation tasks" + become: "{{ pkgmgr_become }}" + block: + - name: update pkgmgr + command: + cmd: "pkgmgr update pkgmgr" + when: run_once_pkgmgr_update is not defined + + - name: install {{ package_name }} + command: + cmd: "pkgmgr install {{ package_name }} --clone-mode https" + notify: "{{ package_notify | default(omit) }}" + + - name: update {{ package_name }} + command: + cmd: "pkgmgr update {{ package_name }}" + notify: "{{ package_notify | default(omit) }}" + + - name: mark pkgmgr update as done + set_fact: + run_once_pkgmgr_update: true + when: run_once_pkgmgr_update is not defined \ No newline at end of file diff --git a/roles/package-manager/README.md b/roles/pkgmgr/README.md similarity index 100% rename from roles/package-manager/README.md rename to roles/pkgmgr/README.md diff --git a/roles/package-manager/meta/main.yml b/roles/pkgmgr/meta/main.yml similarity index 97% rename from roles/package-manager/meta/main.yml rename to roles/pkgmgr/meta/main.yml index f1ad8038..bc15b2be 100644 --- a/roles/package-manager/meta/main.yml +++ b/roles/pkgmgr/meta/main.yml @@ -24,7 +24,7 @@ galaxy_info: versions: - rolling galaxy_tags: - - package-manager + - pkgmgr - automation - git - repositories diff --git a/roles/package-manager/tasks/main.yml b/roles/pkgmgr/tasks/main.yml similarity index 100% rename from roles/package-manager/tasks/main.yml rename to roles/pkgmgr/tasks/main.yml diff --git a/roles/package-manager/templates/config.yaml.j2 b/roles/pkgmgr/templates/config.yaml.j2 similarity index 100% rename from roles/package-manager/templates/config.yaml.j2 rename to roles/pkgmgr/templates/config.yaml.j2 diff --git a/roles/package-manager/vars/main.yml b/roles/pkgmgr/vars/main.yml similarity index 100% rename from roles/package-manager/vars/main.yml rename to roles/pkgmgr/vars/main.yml diff --git a/roles/system-btrfs-auto-balancer/meta/main.yml b/roles/system-btrfs-auto-balancer/meta/main.yml index 422de781..fdacb399 100644 --- a/roles/system-btrfs-auto-balancer/meta/main.yml +++ b/roles/system-btrfs-auto-balancer/meta/main.yml @@ -22,5 +22,4 @@ galaxy_info: issue_tracker_url: "https://s.veen.world/cymaisissues" documentation: "https://s.veen.world/cymais" dependencies: - - package-manager - systemd-notifier diff --git a/roles/system-btrfs-auto-balancer/tasks/main.yml b/roles/system-btrfs-auto-balancer/tasks/main.yml index f912ed9e..8e1119f9 100644 --- a/roles/system-btrfs-auto-balancer/tasks/main.yml +++ b/roles/system-btrfs-auto-balancer/tasks/main.yml @@ -1,6 +1,8 @@ -- name: install btrfs-auto-balancer - command: - cmd: "pkgmgr install btrfs-auto-balancer --clone-mode https" +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: btrfs-auto-balancer when: run_once_system_btrfs_auto_balancer is not defined - name: configure system-btrfs-auto-balancer.cymais.service diff --git a/roles/system-swapfile/meta/main.yml b/roles/system-swapfile/meta/main.yml deleted file mode 100644 index a6de1568..00000000 --- a/roles/system-swapfile/meta/main.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -galaxy_info: - author: "Kevin Veen-Birkenbach" - description: "Automates the creation of a swapfile on the target system by cloning and executing a swapfile creation script, ensuring adequate swap space for improved system performance." - 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: Linux - versions: - - all - galaxy_tags: - - swapfile - - system - - performance - - automation - repository: "https://s.veen.world/cymais" - issue_tracker_url: "https://s.veen.world/cymaisissues" - documentation: "https://s.veen.world/cymais" -dependencies: - - package-manager \ No newline at end of file diff --git a/roles/system-swapfile/tasks/main.yml b/roles/system-swapfile/tasks/main.yml index 5a105391..562f9515 100644 --- a/roles/system-swapfile/tasks/main.yml +++ b/roles/system-swapfile/tasks/main.yml @@ -1,7 +1,8 @@ -- name: install swap-forge - command: - cmd: "pkgmgr install swap-forge --clone-mode https" - become: true +- name: "{{ role_name }} | pkgmgr install" + include_role: + name: pkgmgr-install + vars: + package_name: swap-forge - name: Execute create swapfile script ansible.builtin.shell: swap-forge "{{swapfile_size}}" diff --git a/roles/update-pkgmgr/TODO.md b/roles/update-pkgmgr/TODO.md new file mode 100644 index 00000000..8bb28ea8 --- /dev/null +++ b/roles/update-pkgmgr/TODO.md @@ -0,0 +1,2 @@ +# Todos +- Activate update again. Atm not possible, because it pulls all repos \ No newline at end of file diff --git a/roles/update-pkgmgr/meta/main.yml b/roles/update-pkgmgr/meta/main.yml index 47a9a219..9cb4b148 100644 --- a/roles/update-pkgmgr/meta/main.yml +++ b/roles/update-pkgmgr/meta/main.yml @@ -15,7 +15,7 @@ galaxy_info: - all galaxy_tags: - update - - package-manager + - pkgmgr - pkgmgr - system repository: "https://s.veen.world/cymais" diff --git a/roles/update-pkgmgr/tasks/main.yml b/roles/update-pkgmgr/tasks/main.yml index b33ed0f6..b492ae9c 100644 --- a/roles/update-pkgmgr/tasks/main.yml +++ b/roles/update-pkgmgr/tasks/main.yml @@ -1,2 +1,2 @@ -- name: "Update all repositories with pkgmgr" - command: "pkgmgr update --all" \ No newline at end of file +#- name: "Update all repositories with pkgmgr" +# command: "pkgmgr update --all" \ No newline at end of file