feat(common): setup additional components to apt source list

This commit is contained in:
NaeiKinDus 2023-11-27 00:00:00 +00:00
parent 223cbfb877
commit 9cdcef9dca
Signed by: WoodSmellParticle
GPG key ID: 8E52ADFF7CA8AE56
3 changed files with 27 additions and 0 deletions

View file

@ -51,6 +51,8 @@
hosts:
"{{ item.name }}":
ansible_connection: community.docker.docker
custom_common:
deb822_format: true
ansible.builtin.set_fact:
molecule_inventory: >
{{ molecule_inventory | combine(inventory_partial_yaml | from_yaml) }}

View file

@ -8,3 +8,6 @@ common_gitconfig_force_sign: false
common_gitconfig_signingkey: ""
common_apt_packages: []
common_install_fonts: false
common:
apt_components: ['contrib', 'non-free', 'non-free-firmware']
deb822_format: false

View file

@ -1,4 +1,26 @@
---
- name: '[common] merge with custom vars'
set_fact:
common: "{{ common|combine(custom_common) }}"
changed_when: false
- name: '[apt] verify components of default sources'
block:
- name: '[apt] default source.list'
ansible.builtin.replace:
path: '/etc/apt/sources.list'
regexp: '^(deb((?!{{ item }}).)+)$'
replace: '\1 {{ item }}'
when: not common.deb822_format | bool
loop: '{{ common.apt_components }}'
- name: '[apt] default deb822 debian.sources'
ansible.builtin.replace:
path: '/etc/apt/sources.list.d/debian.sources'
regexp: '^(Components: ((?!{{ item }}).)+)$'
replace: '\1 {{ item }}'
loop: '{{ common.apt_components }}'
when: common.deb822_format | bool
- name: '[apt] install dependencies and tools'
become: true
ansible.builtin.apt: