started working on deb822 implementation
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 / 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
test / Linting (push) Has been cancelled
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 / 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
test / Linting (push) Has been cancelled
This commit is contained in:
parent
cb36ee65f3
commit
080f6a3f7c
@ -4,16 +4,9 @@
|
||||
ansible.builtin.include_vars:
|
||||
file: "{{ ansible_distribution|lower }}.yml"
|
||||
|
||||
- name: "Import main repositories"
|
||||
- name: "Import main {{ ansible_distribution|lower }} repositories"
|
||||
ansible.builtin.include_tasks: "{{ ansible_distribution|lower }}.yml"
|
||||
when: manage_repositories_enable_default_repo
|
||||
block:
|
||||
- name: "Import ubuntu.yml"
|
||||
ansible.builtin.include_tasks: ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: "Import debian.yml"
|
||||
ansible.builtin.include_tasks: debian.yml
|
||||
when: ansible_distribution == 'Debian'
|
||||
|
||||
- name: "Import custom_repositories.yml"
|
||||
ansible.builtin.include_tasks: custom_repositories.yml
|
||||
|
@ -1,10 +1,47 @@
|
||||
---
|
||||
# task/ubuntu file for manage_repositories
|
||||
- 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 ubuntu 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
|
||||
|
14
templates/repo.sources.j2
Normal file
14
templates/repo.sources.j2
Normal file
@ -0,0 +1,14 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for repository in repositories %}
|
||||
# {{ repository.comments}}
|
||||
types: {{ repository.types | join(' ') }}
|
||||
uris: mirror+file://{{ manage_repositories_mirrors_location }}/{{ repository.name }}.list
|
||||
suites: {{ repository.suites | join(' ') }}
|
||||
components: {{ repository.components | join(' ') }}
|
||||
{% if (repository.options is defined) and repository.options %}
|
||||
{% for option in repository.options %}
|
||||
{{ option }}: {{ repository.options[option] }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -1,6 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for repository in repositories %}
|
||||
# {{ repository.comments}}
|
||||
{{ repository.type }} {% if repository.gpg_key is not none %}[signed-by=/usr/share/keyrings/{{ repository.filename }}-archive-keyring.asc] {% endif %}{{ repository.uri }} {{ repository.suites }} {{ repository.components }}
|
||||
{% endfor %}
|
@ -1,3 +1,6 @@
|
||||
---
|
||||
# vars file for manage_repositories
|
||||
manage_repositories_default_repo_location: /etc/apt/sources.list
|
||||
manage_repositories_sources_list_location: /etc/apt/sources.list
|
||||
manage_repositories_default_repo_location: "/etc/apt/sources.list.d/{{ ansible_distribution|lower }}.sources"
|
||||
manage_repositories_mirrors_location: /etc/apt/mirrors
|
||||
manage_repositories_sources_list_message: "# See /etc/apt/sources.list.d/{{ ansible_distribution|lower }}.sources\\n"
|
||||
|
@ -1,31 +1,47 @@
|
||||
---
|
||||
# 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:
|
||||
# ubuntu main repository
|
||||
- uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
|
||||
gpg_key:
|
||||
- name: ubuntu
|
||||
uri: "{{ manage_repositories_main_repo_uri[ansible_distribution|lower] }}"
|
||||
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"
|
||||
types:
|
||||
- deb
|
||||
suites:
|
||||
- "{{ ansible_distribution_release }}"
|
||||
- "{{ ansible_distribution_release }}-security"
|
||||
- "{{ ansible_distribution_release }}-updates"
|
||||
- "{{ ansible_distribution_release }}-backports"
|
||||
components:
|
||||
- main
|
||||
- restricted
|
||||
- universe
|
||||
- multiverse
|
||||
|
Loading…
Reference in New Issue
Block a user