Seperating the roles of basic infra requirements and docker service requirements into seperate roles
Some checks failed
Ansible Linting / ansible-lint (push) Failing after 6s
Secops Linting and Safety Checks / checkov-scan-s3 (push) Failing after 15s

With this we have a working proof of concept for a proper simple docker host
This commit is contained in:
2025-04-16 18:25:24 -07:00
parent 5f10976264
commit 3521b840ae
6 changed files with 53 additions and 24 deletions

View File

@@ -1,5 +1,18 @@
- name: Ensure docker components are installed
tags:
- setup
ansible.builtin.include_tasks:
file: ensure-docker-basic.yaml
apply:
become: true
tags:
- setup
- name: Ensure docker services are present and ready for configuration/usage
tags:
- services
ansible.builtin.include_tasks:
file: ensure-docker-services.yaml
apply:
become: true
tags:
- services

View File

@@ -0,0 +1,17 @@
- name: Ensure docker dir is present
ansible.builtin.file:
path: "{{ docker_compose_dir }}"
state: directory
mode: "0755"
- name: Ensure compose.yaml is present
ansible.builtin.template:
src: compose.yaml
dest: "{{ docker_compose_dir }}/compose.yaml"
mode: "0644"
- name: Apply docker compose with services
community.docker.docker_compose_v2:
project_src: "{{ docker_compose_dir }}"
register: compose_output
- name: Show output of docker compose apply
ansible.builtin.debug:
var: compose_output

View File

@@ -0,0 +1,6 @@
services:
health:
container_name: health
image: nginx:latest
ports:
- "{{ docker_health_port }}:80"

View File

@@ -0,0 +1,2 @@
docker_compose_dir: /home/nigel/compose
docker_health_port: 8080