diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-06 15:42:21 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-06 15:50:57 +0200 |
commit | fa1736cc08aee7082ed81cb0753dd8ade36e2974 (patch) | |
tree | df39386f908df766661cf4089207911724ea6f12 | |
parent | linux_status: support disabling power mgmt (diff) | |
download | infra-ansible-fa1736cc08aee7082ed81cb0753dd8ade36e2974.tar.gz infra-ansible-fa1736cc08aee7082ed81cb0753dd8ade36e2974.zip |
linux_status: factor out PPA set up to a separate role
-rw-r--r-- | roles/debian_ppa/defaults/main.yml | 1 | ||||
-rw-r--r-- | roles/debian_ppa/tasks/main.yml | 19 | ||||
-rw-r--r-- | roles/linux_status/defaults/main.yml | 3 | ||||
-rw-r--r-- | roles/linux_status/tasks/main.yml | 25 |
4 files changed, 27 insertions, 21 deletions
diff --git a/roles/debian_ppa/defaults/main.yml b/roles/debian_ppa/defaults/main.yml new file mode 100644 index 0000000..72e0753 --- /dev/null +++ b/roles/debian_ppa/defaults/main.yml @@ -0,0 +1 @@ +ppa_keys_dir: /etc/apt/keyrings diff --git a/roles/debian_ppa/tasks/main.yml b/roles/debian_ppa/tasks/main.yml new file mode 100644 index 0000000..e121a52 --- /dev/null +++ b/roles/debian_ppa/tasks/main.yml @@ -0,0 +1,19 @@ +- name: Set up repository + become: true + block: + - name: Create keys directory + ansible.builtin.file: + path: '{{ ppa_keys_dir }}' + mode: '755' + state: directory + + - name: 'Add key: {{ ppa_name }}' + ansible.builtin.get_url: + url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{ ppa_key }}' + dest: '{{ ppa_keys_dir }}/linux-status.asc' + mode: '644' + + - name: 'Add repository: {{ ppa_name }}' + ansible.builtin.apt_repository: + repo: 'deb [signed-by={{ ppa_keys_dir }}/{{ ppa_name }}.asc] https://ppa.launchpadcontent.net/{{ ppa_owner }}/{{ ppa_name }}/ubuntu {{ ppa_distro }} main' + filename: '{{ ppa_name }}' diff --git a/roles/linux_status/defaults/main.yml b/roles/linux_status/defaults/main.yml index 0c526dc..75b3e80 100644 --- a/roles/linux_status/defaults/main.yml +++ b/roles/linux_status/defaults/main.yml @@ -1,4 +1 @@ linux_status_disable_power_management: false - -keys_dir: /etc/apt/keyrings -gpg_key_id: ecb69cbafc6d7cd8bd67ec35b1089b3051c9384d diff --git a/roles/linux_status/tasks/main.yml b/roles/linux_status/tasks/main.yml index 1fa381f..6ce23f9 100644 --- a/roles/linux_status/tasks/main.yml +++ b/roles/linux_status/tasks/main.yml @@ -1,22 +1,11 @@ - name: Set up repository - become: true - block: - - name: Create keys directory - ansible.builtin.file: - path: '{{ keys_dir }}' - mode: '755' - state: directory - - - name: Add key - ansible.builtin.get_url: - url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{ gpg_key_id }}' - dest: '{{ keys_dir }}/linux-status.asc' - mode: '644' - - - name: Add repository - ansible.builtin.apt_repository: - repo: 'deb [signed-by={{ keys_dir }}/linux-status.asc] https://ppa.launchpadcontent.net/egor-tensin/linux-status/ubuntu focal main' - filename: linux-status + ansible.builtin.include_role: + name: debian_ppa + vars: + ppa_owner: egor-tensin + ppa_name: linux-status + ppa_distro: focal + ppa_key: ecb69cbafc6d7cd8bd67ec35b1089b3051c9384d - name: Install linux-status become: true |