From ace70337ea26229c424ea95f80b61e930f203971 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sun, 3 Dec 2023 16:20:30 +0100 Subject: [PATCH] Implemented update for yay --- roles/pc-libreoffice/tasks/main.yml | 4 ++-- roles/system-aur-helper/tasks/main.yml | 9 +------ roles/update-yay/README.md | 33 ++++++++++++++++++++++++++ roles/update-yay/meta/main.yml | 2 ++ roles/update-yay/tasks/main.yml | 6 +++++ roles/update/tasks/main.yml | 13 +++++++++- 6 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 roles/update-yay/README.md create mode 100644 roles/update-yay/meta/main.yml create mode 100644 roles/update-yay/tasks/main.yml diff --git a/roles/pc-libreoffice/tasks/main.yml b/roles/pc-libreoffice/tasks/main.yml index 05a00077..5a7d15a7 100644 --- a/roles/pc-libreoffice/tasks/main.yml +++ b/roles/pc-libreoffice/tasks/main.yml @@ -2,11 +2,11 @@ community.general.pacman: name: - ttf-liberation - - libreoffice-still + - libreoffice-fresh state: present - name: install libreoffice language packages community.general.pacman: - name: "libreoffice-still-{{ item }}" + name: "libreoffice-fresh-{{ item }}" state: present loop: "{{libreoffice_languages}}" diff --git a/roles/system-aur-helper/tasks/main.yml b/roles/system-aur-helper/tasks/main.yml index 3fc4281c..390dc334 100644 --- a/roles/system-aur-helper/tasks/main.yml +++ b/roles/system-aur-helper/tasks/main.yml @@ -16,11 +16,4 @@ path: /etc/sudoers.d/11-install-aur_builder line: 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman' create: yes - validate: 'visudo -cf %s' - -- name: Upgrade the system using yay, only act on AUR packages. - become: false - kewlfft.aur.aur: - upgrade: yes - use: yay - aur_only: yes \ No newline at end of file + validate: 'visudo -cf %s' \ No newline at end of file diff --git a/roles/update-yay/README.md b/roles/update-yay/README.md new file mode 100644 index 00000000..f346a5ab --- /dev/null +++ b/roles/update-yay/README.md @@ -0,0 +1,33 @@ +# Ansible Role: update-yay + +This Ansible role is designed for updating AUR packages on Arch Linux systems using `yay`. It automates the process of upgrading AUR packages, ensuring that your system stays up-to-date with the latest versions available in the Arch User Repository (AUR). + +## Requirements + +The role requires that `yay` (Yet Another Yaourt) - an AUR helper - is already installed on the system. If `yay` is not installed, the role `system-aur-helper` should handle its installation. + +## Role Dependencies + +- `system-aur-helper`: This dependency is essential for ensuring that `yay` is available on the system. If `yay` is not installed, this role will manage its installation. + +## Role Variables + +There are no specific variables that need to be defined by the user for this role. The role utilizes the `kewlfft.aur.aur` module with predefined parameters to manage AUR packages. + +## Role Tasks + +- **Upgrade AUR Packages**: The main task of this role is to upgrade the system using `yay`, focusing solely on AUR packages. This task does not require elevated privileges (become: false). + +## Example Playbook + +Here's an example of how to include the `update-yay` role in your playbook: + +```yaml +- hosts: all + roles: + - role: update-yay +``` + +## Author Information + +This role was created by Kevin Veen-Birkenbach. \ No newline at end of file diff --git a/roles/update-yay/meta/main.yml b/roles/update-yay/meta/main.yml new file mode 100644 index 00000000..f2b89588 --- /dev/null +++ b/roles/update-yay/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: +- system-aur-helper \ No newline at end of file diff --git a/roles/update-yay/tasks/main.yml b/roles/update-yay/tasks/main.yml new file mode 100644 index 00000000..69b06d03 --- /dev/null +++ b/roles/update-yay/tasks/main.yml @@ -0,0 +1,6 @@ +- name: upgrade the system using yay, only act on AUR packages. + become: false + kewlfft.aur.aur: + upgrade: yes + use: yay + aur_only: yes \ No newline at end of file diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml index e6a7965d..8b12836b 100644 --- a/roles/update/tasks/main.yml +++ b/roles/update/tasks/main.yml @@ -17,4 +17,15 @@ - name: "Update Docker Images" include_role: name: update-docker - when: docker_compose_directory_stat.stat.exists \ No newline at end of file + when: docker_compose_directory_stat.stat.exists + +- name: "Check if yay is installed" + command: which yay + ignore_errors: yes + register: yay_installed + changed_when: false + +- name: "Update with yay" + include_role: + name: update-yay + when: yay_installed.rc == 0 \ No newline at end of file