1
0
IaC/ansible/roles/aur_repo_client/tasks/main.yaml
2024-04-23 00:49:49 +12:00

46 lines
1.1 KiB
YAML

---
- name: Check if repo public key is in pacman keyring
ansible.builtin.command:
argv:
- pacman-key
- --list-keys
- "{{ aur_repo_client_repo_name }}"
register: repo_key_check
failed_when: repo_key_check.rc not in [0, 2]
changed_when: false
- name: Add repo public key to pacman keyring
when: repo_key_check.rc == 2
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
- "{{ aur_repo_client_public_key }}"
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
notify: Update pacman