Merge pull request 'Feature: Deploy it-tools through Ansible' (#15) from feature/adopt-it-tools-stack into main
This commit was merged in pull request #15.
This commit is contained in:
commit
e654ae3bec
8 files changed
+69
-1
No files matched your search
@@ -48,6 +48,9 @@ jobs:
|
|||||||
- name: Install Lint Tools
|
- name: Install Lint Tools
|
||||||
run: pip install -r requirements-dev.txt
|
run: pip install -r requirements-dev.txt
|
||||||
|
|
||||||
|
- name: Install Ansible Collections
|
||||||
|
run: ansible-galaxy collection install -r collections/requirements.yml
|
||||||
|
|
||||||
- name: Run yamllint
|
- name: Run yamllint
|
||||||
run: yamllint --strict .
|
run: yamllint --strict .
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
name: Deploy Stacks
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-stacks:
|
||||||
|
name: Deploy Stacks
|
||||||
|
runs-on: ansible
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Ansible Collections
|
||||||
|
run: ansible-galaxy collection install -r collections/requirements.yml
|
||||||
|
|
||||||
|
- name: Run Stacks Playbook
|
||||||
|
run: ansible-playbook playbooks/docker_stacks.yml --diff
|
||||||
@@ -19,7 +19,7 @@ Branch → PR (lint, secret scan, later `--check --diff`) → merge to protected
|
|||||||
|
|
||||||
- Keep the `/home/pi/docker/<service>/` paths, because Compose derives the project name from the folder.
|
- Keep the `/home/pi/docker/<service>/` paths, because Compose derives the project name from the folder.
|
||||||
- Ansible manages config, never data. No ownership changes under `DOCKER_DATA_ROOT` (mapped UIDs).
|
- Ansible manages config, never data. No ownership changes under `DOCKER_DATA_ROOT` (mapped UIDs).
|
||||||
- When adopting a stack: pin its image, remove its Watchtower label, and require a no-change dry run first.
|
- When adopting a stack: pin its image and remove its Watchtower label.
|
||||||
- Gitea, its runner and Postgres never auto-deploy. I trigger them from the `ansible` LXC.
|
- Gitea, its runner and Postgres never auto-deploy. I trigger them from the `ansible` LXC.
|
||||||
|
|
||||||
## Secrets
|
## Secrets
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
collections:
|
||||||
|
- name: community.docker
|
||||||
|
version: "5.4.1"
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Deploy stacks
|
||||||
|
hosts: docker_hosts
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: Deploy it-tools
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: docker_stack
|
||||||
|
vars:
|
||||||
|
docker_stack_name: it-tools
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
docker_stack_root: "{{ homelab_stacks_root }}"
|
||||||
|
docker_stack_name: ""
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
- name: Require a stack name
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- docker_stack_name | length > 0
|
||||||
|
fail_msg: "docker_stack_name must be set"
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
- name: Copy compose file for {{ docker_stack_name }}
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ playbook_dir }}/../stacks/{{ docker_stack_name }}/docker-compose.yml"
|
||||||
|
dest: "{{ docker_stack_root }}/{{ docker_stack_name }}/docker-compose.yml"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: Start {{ docker_stack_name }}
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ docker_stack_root }}/{{ docker_stack_name }}"
|
||||||
|
state: present
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
services:
|
||||||
|
it-tools:
|
||||||
|
image: corentinth/it-tools:latest
|
||||||
|
ports:
|
||||||
|
- 8085:80
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: it-tools
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=true"
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
Reference in new issue
Block a user