1
0
IaC/ansible/roles/aur_repo_client/tasks/main.yaml

51 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2024-04-22 08:49:49 -04:00
---
- name: Check if repo public key is in pacman keyring
ansible.builtin.command:
argv:
- pacman-key
- --list-keys
2024-04-22 23:47:14 -04:00
- "{{ aur_repo_client_public_key_fingerprint }}"
2024-04-22 08:49:49 -04:00
register: repo_key_check
2024-04-22 23:47:14 -04:00
failed_when: repo_key_check.rc not in [0, 1]
2024-04-22 08:49:49 -04:00
changed_when: false
- name: Add repo public key to pacman keyring
2024-04-22 23:47:14 -04:00
when: repo_key_check.rc == 1
2024-04-22 08:49:49 -04:00
block:
- name: Import the repo public key
ansible.builtin.command:
argv:
- pacman-key
- --recv-keys
- "{{ aur_repo_client_public_key_fingerprint }}"
- --keyserver
- "{{ aur_repo_client_keyserver }}"
changed_when: true
- name: Trust the repo public key
ansible.builtin.command:
argv:
- pacman-key
- --lsign-key
2024-04-22 23:47:14 -04:00
- "{{ aur_repo_client_public_key_fingerprint }}"
2024-04-22 08:49:49 -04:00
changed_when: true
- name: Add home repo block to pacman.conf
ansible.builtin.blockinfile:
path: /etc/pacman.conf
block: |
[{{ aur_repo_client_repo_name }}]
SigLevel = Required TrustedOnly
Server = {{ aur_repo_client_repo_address }}
create: false
state: present
insertafter: EOF
2024-04-22 23:47:14 -04:00
register: add_pacman_repo
- name: Update pacman database # noqa: no-handler
when: add_pacman_repo.changed
community.general.pacman:
update_cache: true