-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to ansible.builtin.deb822_repository and refactor apt reposito…
…ry configuration
- Loading branch information
1 parent
0290323
commit 10fb307
Showing
19 changed files
with
265 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,43 @@ | ||
--- | ||
|
||
- name: Add goaccess GPG key | ||
ansible.builtin.get_url: | ||
url: '{{ goaccess_repo_key_url }}' | ||
dest: /etc/apt/trusted.gpg.d/goaccess.asc | ||
mode: 0644 | ||
force: true | ||
- name: Install binary | ||
when: not goaccess_from_source | ||
block: | ||
- name: Remove old apt repository files | ||
ansible.builtin.file: | ||
path: '{{ item }}' | ||
state: absent | ||
loop: | ||
- /etc/apt/trusted.gpg.d/goaccess.asc | ||
|
||
- name: Add goaccess debian repository | ||
ansible.builtin.apt_repository: | ||
repo: '{{ goaccess_repo_url }}' | ||
update_cache: true | ||
state: "{{ 'absent' if geoaccess_from_source else 'present' }}" | ||
# see https://docs.ansible.com/ansible/latest/collections/ansible/builtin/deb822_repository_module.html | ||
- name: Add goaccess apt repository | ||
ansible.builtin.deb822_repository: | ||
name: goaccess | ||
uris: '{{ goaccess_apt_url }}' | ||
types: deb | ||
suites: '{{ goaccess_apt_suites }}' | ||
components: '{{ goaccess_apt_components }}' | ||
signed_by: '{{ goaccess_apt_key_url }}' | ||
state: present | ||
register: goaccess_repo | ||
|
||
- name: Be sure goaccess packages are installed | ||
ansible.builtin.apt: | ||
name: '{{ goaccess_packages }}' | ||
state: "{{ 'absent' if geoaccess_from_source else 'present' }}" | ||
- name: Update apt cache | ||
apt: | ||
update_cache: true | ||
when: goaccess_repo.changed | ||
tags: | ||
- skip_ansible_lint | ||
|
||
- name: Be sure goaccess packages are installed | ||
ansible.builtin.apt: | ||
name: '{{ goaccess_packages }}' | ||
state: present | ||
|
||
- name: Remove binary | ||
when: goaccess_from_source | ||
block: | ||
- name: Remove goaccess apt repository | ||
ansible.builtin.deb822_repository: | ||
name: goaccess | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
--- | ||
|
||
- name: Ensure apt key for mysql.com is present (local key) | ||
ansible.builtin.copy: | ||
src: mysql.gpg | ||
dest: /etc/apt/trusted.gpg.d/mysql.gpg | ||
mode: 0644 | ||
when: | ||
- mysql_with_mysql_com | ||
- mysql_local_apt_key | ||
- name: Remove mysql apt repository | ||
ansible.builtin.deb822_repository: | ||
name: mysql | ||
state: absent | ||
when: not mysql_with_mysql_com | ||
|
||
# url for remote key is not available - dep package is provided by mysql.com | ||
# - name: Ensure apt key for mysql.com is present (remote key) | ||
# ansible.builtin.get_url: | ||
# url: "{{ mysql_repo_key_url }}" | ||
# dest: /etc/apt/trusted.gpg.d/mysql.asc | ||
# mode: 0644 | ||
# force: true | ||
# when: not mysql_local_key | ||
- name: MySQL.com block | ||
when: mysql_with_mysql_com | ||
block: | ||
- name: Use local gpg key for apt repository | ||
ansible.builtin.copy: | ||
src: mysql.gpg | ||
dest: '{{ mysql_apt_repo_key_file }}' | ||
mode: 0644 | ||
when: mysql_apt_key_url is not defined | ||
|
||
- name: Ensure apt sources list for mysql.com sources is present | ||
ansible.builtin.apt_repository: | ||
repo: '{{ mysql_apt_repo_url }}' | ||
update_cache: true | ||
state: "{{ 'present' if ansible_distribution == 'Debian' and mysql_with_mysql_com else 'absent' }}" | ||
- name: Remove old apt repository files | ||
ansible.builtin.file: | ||
path: '{{ item }}' | ||
state: absent | ||
loop: | ||
- /etc/apt/sources.list.d/repo_mysql_com_apt_debian.list | ||
|
||
- name: Remove previous apt sources list from apt sources | ||
ansible.builtin.apt_repository: | ||
repo: 'deb http://repo.mysql.com/apt/debian/ {{ ansible_distribution_release | lower }} mysql-{{ mysql_apt_repo_version_prev }}' | ||
update_cache: true | ||
state: absent | ||
when: mysql_with_mysql_com | ||
# see https://docs.ansible.com/ansible/latest/collections/ansible/builtin/deb822_repository_module.html | ||
- name: Add mysql apt repository | ||
ansible.builtin.deb822_repository: | ||
name: mysql | ||
uris: "{{ mysql_apt_url }}" | ||
types: deb | ||
suites: '{{ mysql_apt_suites }}' | ||
components: '{{ mysql_apt_components }}' | ||
signed_by: "{{ mysql_apt_key_url | default(mysql_apt_repo_key_file) }}" | ||
state: present | ||
register: mysql_repo | ||
|
||
- name: Update apt cache. | ||
apt: | ||
update_cache: true | ||
when: mysql_repo.changed | ||
tags: | ||
- skip_ansible_lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mysql_apt_repo_key_file: /etc/apt/trusted.gpg.d/mysql.gpg | ||
Oops, something went wrong.