initial commit
This commit is contained in:
commit
ed2b519c28
44
README.md
Normal file
44
README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
Docker Engine
|
||||||
|
=========
|
||||||
|
|
||||||
|
Docker engine installation on Ubuntu 24.04.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
No requirements.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Docker daemon options to pass to dockerd command (default: undefined):
|
||||||
|
`docker_daemon_run_options: "--dns 1.1.1.1 --dns 1.0.0.1"`
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
No dependencies.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
---
|
||||||
|
- hosts: goapp
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Update apt cache.
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
cache_valid_time: 86400
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: cuqmbr.docker
|
||||||
|
|
||||||
|
TODO
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Add support for other Linux distrubitions:
|
||||||
|
|
||||||
|
- RHEL: Almalinux, RockyLinux 9 and 8
|
||||||
|
- Debian: Debian 12 and 11, Ubuntu 24.04 and 22.04
|
||||||
|
- Archlinux
|
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# docker_daemon_run_options: ""
|
6
handlers/main.yml
Normal file
6
handlers/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Restart docker service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: docker
|
||||||
|
state: restarted
|
11
meta/main.yml
Normal file
11
meta/main.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
role_name: docker
|
||||||
|
author: cuqmbr
|
||||||
|
description: Docker engine installation for Ubuntu 24.04
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
license: MIT
|
||||||
|
min_ansible_version: "2.1"
|
||||||
|
galaxy_tags: []
|
||||||
|
|
||||||
|
dependencies: []
|
15
molecule/default/converge.yml
Normal file
15
molecule/default/converge.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
|
||||||
|
vars:
|
||||||
|
docker_daemon_run_options: "--dns 1.1.1.1 --dns 1.0.0.1"
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Update apt cache.
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
cache_valid_time: 86400
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: cuqmbr.docker
|
18
molecule/default/molecule.yml
Normal file
18
molecule/default/molecule.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: docker.io/geerlingguy/docker-ubuntu2404-ansible:latest
|
||||||
|
pre_build_image: true
|
||||||
|
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
|
cgroupns_mode: host
|
||||||
|
privileged: true
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
verifier:
|
||||||
|
name: ansible
|
54
tasks/main.yml
Normal file
54
tasks/main.yml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Install dependencies.
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create apt keys installation directory.
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/apt/keyrings"
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Add docker apt key.
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "https://download.docker.com/linux/ubuntu/gpg"
|
||||||
|
dest: "/etc/apt/keyrings/docker.asc"
|
||||||
|
mode: "0444"
|
||||||
|
|
||||||
|
- name: Add docker apt repository.
|
||||||
|
ansible.builtin.apt_repository:
|
||||||
|
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] \
|
||||||
|
https://download.docker.com/linux/ubuntu noble stable"
|
||||||
|
filename: docker
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Install docker apt packages.
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- containerd.io
|
||||||
|
- docker-buildx-plugin
|
||||||
|
- docker-compose-plugin
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Start and enable docker service.
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: docker
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: Install service parameters file.
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: docker.j2
|
||||||
|
dest: "/etc/default/docker"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify:
|
||||||
|
- Restart docker service
|
1
templates/docker.j2
Normal file
1
templates/docker.j2
Normal file
@ -0,0 +1 @@
|
|||||||
|
DOCKER_OPTS="{{ docker_daemon_run_options }}"
|
Loading…
Reference in New Issue
Block a user