ansible_cache/dnaclab_linux/roles/ncafsa-vm-template/tasks/main.yaml
2024-12-27 12:47:45 +00:00

47 lines
1.1 KiB
YAML
Executable File

---
- name: Install aptitude
ansible.builtin.apt:
name: aptitude
state: latest
update_cache: true
- name: Install required packages
ansible.builtin.apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
state: latest
update_cache: true
- name: Add Docker GPG apt Key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
ansible.builtin.apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt and install docker-ce
ansible.builtin.apt:
name: docker-ce
state: latest
update_cache: true
- name: Run default container to test Docker install
community.docker.docker_container:
name: test_container
image: hello-world
state: present
- name: Add users to Docker group (allows running Docker commands without sudo)
ansible.builtin.user:
name: "{{ item.key }}"
groups: "sudo, docker"
loop: "{{ lookup('dict', users) }}"