Merge pull request #31 from jooola/use_signed_by
Follow Debian third party repository best practices
This commit is contained in:
commit
f51274c475
|
|
@ -0,0 +1 @@
|
||||||
|
.venv
|
||||||
|
|
@ -55,15 +55,15 @@ repos:
|
||||||
name: Run prettier with docker
|
name: Run prettier with docker
|
||||||
entry: tmknom/prettier:latest -l
|
entry: tmknom/prettier:latest -l
|
||||||
language: docker_image
|
language: docker_image
|
||||||
files: "\\.(\
|
files: |
|
||||||
css|less|scss\
|
(?x)\.(
|
||||||
|graphql|gql\
|
css|less|scss
|
||||||
|html\
|
graphql|gql|
|
||||||
|js|jsx\
|
html|
|
||||||
|json\
|
js|jsx|ts|tsx|
|
||||||
|md|markdown|mdown|mkdn\
|
json|
|
||||||
|mdx\
|
md|markdown|mdown|mkdn|
|
||||||
|ts|tsx\
|
mdx|
|
||||||
|vue\
|
vue|
|
||||||
|yaml|yml\
|
yaml|yml
|
||||||
)$"
|
)$
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ Available variables are listed below, along with default values (see
|
||||||
mariadb_use_official_repo: false
|
mariadb_use_official_repo: false
|
||||||
mariadb_use_official_repo_url: https://deb.mariadb.org
|
mariadb_use_official_repo_url: https://deb.mariadb.org
|
||||||
mariadb_use_official_repo_version: "10.10"
|
mariadb_use_official_repo_version: "10.10"
|
||||||
|
mariadb_use_official_repo_format_deb822: false
|
||||||
```
|
```
|
||||||
|
|
||||||
You may deploy the MariaDB Server version that comes with your distribution
|
You may deploy the MariaDB Server version that comes with your distribution
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ ansible_python_interpreter: /usr/bin/python3
|
||||||
mariadb_use_official_repo: false
|
mariadb_use_official_repo: false
|
||||||
mariadb_use_official_repo_url: https://deb.mariadb.org
|
mariadb_use_official_repo_url: https://deb.mariadb.org
|
||||||
mariadb_use_official_repo_version: 10.6
|
mariadb_use_official_repo_version: 10.6
|
||||||
|
# see: https://manpages.debian.org/stable/apt/sources.list.5.en.html#DEB822-STYLE_FORMAT
|
||||||
|
mariadb_use_official_repo_format_deb822: false
|
||||||
|
|
||||||
mariadb_enabled_on_startup: true
|
mariadb_enabled_on_startup: true
|
||||||
# The following is set to true by default but you may consider setting it to
|
# The following is set to true by default but you may consider setting it to
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,14 @@
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
mariadb -Bse 'STATUS' | grep "^Server version:"
|
mariadb -Bse 'STATUS' | grep "^Server version:"
|
||||||
register: version
|
register: version
|
||||||
when: "{{ lookup('env', 'MARIADB_VERSION') }}"
|
when: lookup('env', 'MARIADB_VERSION')
|
||||||
|
|
||||||
- name: Check MariaDB version
|
- name: Check MariaDB version
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'{{ lookup('env', 'MARIADB_VERSION') }}' in version.stdout"
|
- lookup('env', 'MARIADB_VERSION') in version.stdout
|
||||||
msg: "{{ version.stdout }}"
|
msg: "{{ version.stdout }}"
|
||||||
when: "{{ lookup('env', 'MARIADB_VERSION') }}"
|
when: lookup('env', 'MARIADB_VERSION')
|
||||||
|
|
||||||
- name: Check that Innodb engine is enabled (and default)
|
- name: Check that Innodb engine is enabled (and default)
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,14 @@
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
sudo mariadb -Bse 'STATUS' | grep "^Server version:"
|
sudo mariadb -Bse 'STATUS' | grep "^Server version:"
|
||||||
register: version
|
register: version
|
||||||
when: "{{ lookup('env', 'MARIADB_VERSION') }}"
|
when: lookup('env', 'MARIADB_VERSION')
|
||||||
|
|
||||||
- name: Check MariaDB version
|
- name: Check MariaDB version
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'{{ lookup('env', 'MARIADB_VERSION') }}' in version.stdout"
|
- lookup('env', 'MARIADB_VERSION') in version.stdout
|
||||||
msg: "{{ version.stdout }}"
|
msg: "{{ version.stdout }}"
|
||||||
when: "{{ lookup('env', 'MARIADB_VERSION') }}"
|
when: lookup('env', 'MARIADB_VERSION')
|
||||||
|
|
||||||
- name: Check that Innodb engine is enabled (and default)
|
- name: Check that Innodb engine is enabled (and default)
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
|
|
|
||||||
|
|
@ -10,31 +10,65 @@
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Install mariadb repository key
|
- name: Ensure keyrings dir exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/apt/keyrings
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Fetch mariadb repository key
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
url: "https://mariadb.org/mariadb_release_signing_key.asc"
|
url: https://mariadb.org/mariadb_release_signing_key.asc
|
||||||
dest: "/etc/apt/trusted.gpg.d/mariadb.asc"
|
dest: /etc/apt/keyrings/mariadb-keyring.asc
|
||||||
# //TEMP todo
|
# //TEMP todo
|
||||||
# checksum: sha256:http://example.com/path/sha256sum.txt
|
# checksum: sha256:http://example.com/path/sha256sum.txt
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
register: fetch_repository_key
|
||||||
# change is always triggered in check mode
|
# change is always triggered in check mode
|
||||||
when: not ansible_check_mode
|
when: not ansible_check_mode
|
||||||
|
|
||||||
- name: Determine distribution name (Debian sid pb)
|
- name: Dearmor mariadb repository key
|
||||||
|
ansible.builtin.command: >
|
||||||
|
gpg --dearmor
|
||||||
|
-o /etc/apt/keyrings/mariadb-keyring.gpg
|
||||||
|
/etc/apt/keyrings/mariadb-keyring.asc
|
||||||
|
when: fetch_repository_key is changed
|
||||||
|
|
||||||
|
- name: Determine repo distribution release
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
distribution: "{% if 'n/a' in ansible_distribution_release %}sid{% else %}{{ ansible_distribution_release }}{% endif %}"
|
repo_distribution_release: >-
|
||||||
|
{{ 'sid' if 'n/a' in ansible_distribution_version else ansible_distribution_release }}
|
||||||
|
|
||||||
- name: Setup mariadb repository sourcelist entry
|
- name: Setup mariadb repository sourcelist entry
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /etc/apt/sources.list.d/mariadb.list
|
dest: /etc/apt/sources.list.d/mariadb.list
|
||||||
content: |
|
content: |
|
||||||
# Ansible managed
|
# Ansible managed
|
||||||
deb {{ mariadb_use_official_repo_url }}/{{ mariadb_use_official_repo_version }}/{{ ansible_distribution | lower() }} {{ distribution }} main
|
deb [signed-by=/etc/apt/keyrings/mariadb-keyring.gpg] {{ mariadb_use_official_repo_url }}/{{ mariadb_use_official_repo_version }}/{{ ansible_distribution | lower() }} {{ repo_distribution_release }} main
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
when: not mariadb_use_official_repo_format_deb822
|
||||||
|
|
||||||
|
- name: Setup mariadb repository sources entry
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/apt/sources.list.d/mariadb.sources
|
||||||
|
content: |
|
||||||
|
# Ansible managed
|
||||||
|
X-Repolib-Name: MariaDB
|
||||||
|
Types: deb
|
||||||
|
URIs: {{ mariadb_use_official_repo_url }}/{{ mariadb_use_official_repo_version }}/{{ ansible_distribution | lower() }}
|
||||||
|
Suites: {{ repo_distribution_release }}
|
||||||
|
Components: main
|
||||||
|
Signed-By: /etc/apt/keyrings/mariadb-keyring.gpg
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
when: mariadb_use_official_repo_format_deb822
|
||||||
|
|
||||||
- name: Prefer MariaDB repo over Debian repo
|
- name: Prefer MariaDB repo over Debian repo
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue