docker compose

This commit is contained in:
nora 2023-08-26 21:25:31 +02:00
parent a874314588
commit a217582dc1
8 changed files with 83 additions and 43 deletions

View file

@ -5,8 +5,11 @@
tasks:
- name: Install docker
ansible.builtin.apt:
name: docker.io
name: "{{ item }}"
state: present
with_items:
- docker.io
- docker-compose
- name: Install keyring packages
ansible.builtin.apt:
name: "{{ item }}"
@ -52,6 +55,16 @@
mode: "u=rw,g=r,o=r"
notify:
- "Caddyfile changed"
- name: Create /apps
ansible.builtin.file:
path: /apps
state: directory
mode: u=rwx,g=rx,o=rx
- name: Copy docker-compose
ansible.builtin.copy:
dest: /apps/docker-compose.yml
src: "../vps2/docker-compose.yml" # TODO: choose the right directory
mode: "u=r,g=r,o=r"
handlers:
- name: "Caddyfile changed"
ansible.builtin.service:

37
new/playbooks/vps2.yml Normal file
View file

@ -0,0 +1,37 @@
---
- name: Generic setup
ansible.builtin.import_playbook: ./basic-setup.yml
- name: VPS 2 setup
hosts: vps2
gather_facts: false
tasks:
- name: Install htpasswd
ansible.builtin.apt:
name: apache2-utils
#####
# APP: docker registry, /apps/registry
#####
- name: Create /apps/registry
ansible.builtin.file:
path: /apps/registry
state: directory
mode: u=rwx,g=rx,o=rx
- name: Create /apps/registry/data
ansible.builtin.file:
path: /apps/registry/data
state: directory
mode: u=rwx,g=rx,o=rx
- name: Copy over registry config.yml
ansible.builtin.copy:
dest: /apps/registry/config.yml
src: ../apps/registry/config.yml
mode: u=r,g=r,o=r # readonly
#####
# END: docker compose up!
#####
# We want this to be last so that all app-specific config has been done.
- name: Docker compose up! 🚀
community.docker.docker_compose:
project_src: /apps
state: present