add apt_repository role

This commit is contained in:
uumas
2023-07-14 15:14:54 +03:00
parent 8742ccd7f1
commit a9772173d2
7 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include apt_repository"
ansible.builtin.import_role:
name: apt_repository
vars:
repo_name: docker
repo_url: https://download.docker.com/linux/{{ ansible_distribution | lower }}
repo_key_url: https://download.docker.com/linux/debian/gpg
repo_arch: "{{ apt_arch }}"
repo_components:
- stable

View File

@@ -0,0 +1,13 @@
---
dependency:
name: galaxy
driver:
name: podman
platforms:
- name: bullseye
image: git.uumas.fi/uumas/molecule-testbed:bullseye
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible

View File

@@ -0,0 +1,21 @@
---
- name: Verify
hosts: all
gather_facts: true
tasks:
- name: Get content of docker source file
ansible.builtin.slurp:
src: /etc/apt/sources.list.d/docker.list
register: docker_repo
- name: Ensure docker repo file content is as expected
ansible.builtin.assert:
that: >
docker_repo.content | b64decode == "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc]
https://download.docker.com/linux/{{ ansible_distribution | lower }}
{{ ansible_distribution_release }} stable\n"
msg: >
/etc/apt/sources.list.d/docker.list should contain
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc]
https://download.docker.com/linux/{{ ansible_distribution | lower }}
{{ ansible_distribution_release }} stable but it contained {{ docker_repo.content | b64decode }} instead