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,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