1
0
Fork 0
vervis-docker-ansible/tasks/main.yml

72 lines
2 KiB
YAML
Raw Permalink Normal View History

2024-10-21 22:37:49 +02:00
---
- name: directories
file: state=directory path="{{ item }}" owner="{{ vervis_host_uid }}" group="{{ vervis_host_gid }}"
loop:
- "{{ vervis_host_base_path }}"
- "{{ vervis_host_base_path }}/config"
- "{{ vervis_host_base_path }}/postgres15"
- "{{ vervis_host_base_path }}/state"
- "{{ vervis_host_base_path }}/state/repos"
- "{{ vervis_host_base_path }}/state/deliveries"
- name: settings base
include_vars:
file: settings.yml
name: vervis_settings_base
- name: settings override
set_fact:
vervis_settings: "{{ vervis_settings_base | combine(vervis_settings_custom) }}"
- name: settings file
copy:
content: "{{ vervis_settings|to_yaml }}"
dest: "{{ vervis_host_base_path }}/config/settings.yml"
owner: "{{ vervis_host_uid }}"
group: "{{ vervis_host_gid }}"
- name: create-db.sql file
template:
src: "{{ item.src }}.j2"
dest: "{{ vervis_host_base_path }}/{{ item.dest|default(item.src) }}"
owner: "{{ vervis_host_uid }}"
group: "{{ vervis_host_gid }}"
loop:
- { src: create-db.sql }
#- name: ssh-host-key
# community.crypto.openssh_keypair:
# path: "{{ vervis_host_base_path }}/state/ssh-host-key"
# comment: "..."
# owner: "{{ vervis_host_uid }}"
# group: "{{ vervis_host_gid }}"
# mode: "0600"
# regenerate: partial_idempotence # a reasonable default behaviour
# #register: keypair_result
- name: ssh-host-key
shell:
cmd: "ssh-keygen -t rsa -m PEM -f {{ vervis_host_base_path }}/state/ssh-host-key"
creates: "{{ vervis_host_base_path }}/state/ssh-host-key"
- name: ssh-host-key permissions
file:
path: "{{ vervis_host_base_path }}/state/{{ item }}"
owner: "{{ vervis_host_uid }}"
group: "{{ vervis_host_gid }}"
loop:
- ssh-host-key
- ssh-host-key.pub
- name: compose definition
include_vars:
file: compose.yml
name: vervis_compose_definition
- name: docker compose up
community.docker.docker_compose_v2:
project_name: vervis
definition: "{{ vervis_compose_definition }}"
remove_orphans: true