fbe7ae16ad
The apt_key module currently requires that gnupg is in place in order to be able to succesfully import keys. It is possible that the system running this role does not have this, so we should make sure it is installed if we have any keys to install. Change-Id: Ia5ff4d35dc4faed1fb8dfc6bd32670dae394e5c7
33 lines
704 B
YAML
33 lines
704 B
YAML
- name: Install GnuPG for apt-key
|
|
become: true
|
|
when: repositories_keys | length > 0
|
|
apt:
|
|
name: gnupg
|
|
state: present
|
|
|
|
- name: Add apt keys
|
|
become: true
|
|
apt_key:
|
|
url: "{{ zj_item['url'] | default(omit) }}"
|
|
data: "{{ zj_item['data'] | default(omit) }}"
|
|
loop: "{{ repositories_keys }}"
|
|
loop_control:
|
|
loop_var: zj_item
|
|
|
|
- name: Add apt repositories
|
|
become: true
|
|
apt_repository:
|
|
repo: "{{ zj_item['repo'] | default(omit) }}"
|
|
state: present
|
|
update_cache: no
|
|
loop: "{{ repositories_list }}"
|
|
loop_control:
|
|
loop_var: zj_item
|
|
register: _add_apt_repos
|
|
|
|
- name: Update APT cache
|
|
become: true
|
|
apt:
|
|
update_cache: yes
|
|
when: _add_apt_repos is changed
|