added debian values, still needs debugging
Some checks reported warnings
test / Molecule tests (default, debian11) (push) Has been cancelled
test / Molecule tests (default, debian12) (push) Has been cancelled
test / Molecule tests (default, ubuntu2004) (push) Has been cancelled
test / Molecule tests (default, ubuntu2204) (push) Has been cancelled
test / Molecule tests (with_custom_repo, debian11) (push) Has been cancelled
test / Linting (push) Has been cancelled
test / Molecule tests (with_custom_repo, debian12) (push) Has been cancelled
test / Molecule tests (with_custom_repo, ubuntu2004) (push) Has been cancelled
test / Molecule tests (with_custom_repo, ubuntu2204) (push) Has been cancelled

This commit is contained in:
Bertrand Lanson 2023-09-13 00:09:18 +02:00
parent 080f6a3f7c
commit a05133ec81
4 changed files with 59 additions and 59 deletions

View File

@ -1,10 +1,47 @@
---
# task/debian file for manage_repositories
- name: "Configure ubuntu main repositories into sources.list"
- name: "Emtpy /etc/apt/sources.list"
block:
- name: Read the current content of the file
ansible.builtin.slurp:
src: "{{ manage_repositories_sources_list_location }}"
register: sources_list_current_content
ignore_errors: true
- name: "Convert sources.list current content to string"
ansible.builtin.set_fact:
sources_list_current_content_str: "{{ (sources_list_current_content.content | b64decode) | default('') }}"
- name: "Define sources.list new content"
ansible.builtin.set_fact:
sources_list_new_content: "{{ manage_repositories_sources_list_message }}"
- name: "Replace content of /etc/apt/sources.list"
ansible.builtin.replace:
path: "{{ manage_repositories_sources_list_location }}"
regexp: "{{ sources_list_current_content_str | regex_escape }}"
replace: "{{ sources_list_new_content }}"
when: sources_list_current_content_str != sources_list_new_content
- name: "Import list files"
block:
- name: "Create mirrors files"
ansible.builtin.file:
path: "{{ manage_repositories_mirrors_location }}"
state: directory
- name: "Populate mirrors files"
ansible.builtin.copy:
content: |
{{ item.uri }}
dest: "{{ manage_repositories_mirrors_location }}/{{ item.name }}.list"
loop: "{{ manage_repositories_default_repo }}"
- name: "Configure debian main repositories into sources.list"
vars:
repositories: "{{ manage_repositories_default_repo }}"
ansible.builtin.template:
src: "sources.list.j2"
src: "repo.sources.j2"
dest: "{{ manage_repositories_default_repo_location }}"
mode: '0644'
owner: root

View File

@ -33,7 +33,7 @@
- name: "Populate mirrors files"
ansible.builtin.copy:
content: |
"{{ item.uri }}"
{{ item.uri }}
dest: "{{ manage_repositories_mirrors_location }}/{{ item.name }}.list"
loop: "{{ manage_repositories_default_repo }}"

View File

@ -1,31 +1,23 @@
---
# vars file for manage_repositories
manage_repositories_default_repo:
# debian main repository
- uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
gpg_key:
- name: debian
uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
comments: "debian main repository"
type: "deb"
suites: "{{ ansible_distribution_release }}"
components: "main contrib"
# debian updates repository
- uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
gpg_key:
comments: "debian updates repository"
type: "deb"
suites: "{{ ansible_distribution_release }}-updates"
components: "main contrib"
# debian security repository
- uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}-security"
gpg_key:
comments: "debian security repository"
type: "deb"
suites: "{{ ansible_distribution_release }}-security"
components: "main contrib"
# debian backports repository
- uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
gpg_key:
comments: "debian backports repository"
type: "deb"
suites: "{{ ansible_distribution_release }}-backports"
components: "main"
types:
- deb
suites:
- "{{ ansible_distribution_release }}"
- "{{ ansible_distribution_release }}-updates"
- "{{ ansible_distribution_release }}-backports"
components:
- main
- name: debian-security
uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}-security"
comments: "debian main repository"
types:
- deb
suites:
- "{{ ansible_distribution_release }}-security"
components:
- main

View File

@ -1,34 +1,5 @@
---
# vars file for manage_repositories
# manage_repositories_default_repo:
# # ubuntu main repository
# - uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
# gpg_key:
# comments: "ubuntu main repository"
# type: "deb"
# suites: "{{ ansible_distribution_release }}"
# components: "main restricted universe multiverse"
# # ubuntu updates repository
# - uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
# gpg_key:
# comments: "ubuntu updates repository"
# type: "deb"
# suites: "{{ ansible_distribution_release }}-updates"
# components: "main restricted universe multiverse"
# # ubuntu security repository
# - uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
# gpg_key:
# comments: "ubuntu security repository"
# type: "deb"
# suites: "{{ ansible_distribution_release }}-security"
# components: "main restricted universe multiverse"
# # ubuntu backports repository
# - uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
# gpg_key:
# comments: "ubuntu backports repository"
# type: "deb"
# suites: "{{ ansible_distribution_release }}-backports"
# components: "main restricted universe multiverse"
manage_repositories_default_repo:
- name: ubuntu
uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"