handle traefik_install variables, and set default values for each chill configuration

This commit is contained in:
2026-01-20 16:33:32 +01:00
parent f545970f05
commit 64d0a63e68
6 changed files with 105 additions and 62 deletions
+12 -12
View File
@@ -1,10 +1,10 @@
- name: Debug task
ansible.builtin.debug:
var: item
- name: Merge defaults with item
ansible.builtin.set_fact:
chill: "{{ default_chill | combine(item, recursive=True) }}"
- name: Create directories to store compose project
ansible.builtin.file:
path: "{{ install_dir }}/{{ item['chill_environment'] }}"
path: "{{ install_dir }}/{{ chill['chill_environment'] }}"
state: directory
mode: '0755'
owner: "{{ as_user }}"
@@ -12,34 +12,34 @@
- name: Add compose.yml file
ansible.builtin.template:
src: compose.yaml
dest: "{{ install_dir }}/{{ item['chill_environment'] }}/compose.yaml"
dest: "{{ install_dir }}/{{ chill['chill_environment'] }}/compose.yaml"
owner: "{{ as_user }}"
mode: '0444'
- name: Add application environment file
ansible.builtin.template:
src: env_file.env
dest: "{{ install_dir }}/{{ item['chill_environment'] }}/env_file.env"
dest: "{{ install_dir }}/{{ chill['chill_environment'] }}/env_file.env"
owner: "{{ as_user }}"
mode: '0400'
- name: Add postgresql environment file if need
ansible.builtin.template:
src: postgres.env
dest: "{{ install_dir }}/{{ item['chill_environment'] }}/postgres.env"
dest: "{{ install_dir }}/{{ chill['chill_environment'] }}/postgres.env"
owner: "{{ as_user }}"
mode: '0400'
- name: Add rabbitmq environment file
ansible.builtin.template:
src: rabbitmq.env
dest: "{{ install_dir }}/{{ item['chill_environment'] }}/rabbitmq.env"
dest: "{{ install_dir }}/{{ chill['chill_environment'] }}/rabbitmq.env"
owner: "{{ as_user }}"
mode: '0400'
- name: Create directory for storing configuration
ansible.builtin.file:
path: "{{ install_dir }}/{{ item['chill_environment'] }}/config/prod"
path: "{{ install_dir }}/{{ chill['chill_environment'] }}/config/prod"
state: directory
owner: "{{ as_user }}"
mode: '0400'
@@ -47,7 +47,7 @@
- name: Copy configuration files
ansible.builtin.template:
src: "config/prod/{{ file }}"
dest: "{{ install_dir }}/{{ item['chill_environment'] }}/config/prod/{{ file }}"
dest: "{{ install_dir }}/{{ chill['chill_environment'] }}/config/prod/{{ file }}"
owner: "{{ as_user }}"
mode: '0444'
loop:
@@ -61,7 +61,7 @@
- name: Create directory for storing data
ansible.builtin.file:
path: "{{ doc_storage_dir }}/{{ item['chill_environment'] }}"
path: "{{ doc_storage_dir }}/{{ chill['chill_environment'] }}"
owner: "82"
group: "82"
mode: '0766'
@@ -71,6 +71,6 @@
#
# - name: Ensure systemd timer for cronjob is up
# ansible.builtin.systemd_service:
# name: "chill-cronjob@{{ item['chill_environment'] }}.timer"
# name: "chill-cronjob@{{ chill['chill_environment'] }}.timer"
# state: restarted
# enabled: true
+4 -4
View File
@@ -1,18 +1,18 @@
- name: Create directory for storing certificates
ansible.builtin.file:
path: "/var/traefik/certs/chill/{{ item['chill_environment'] }}"
path: "/var/traefik/certs/chill/{{ chill['chill_environment'] }}"
state: directory
owner: "{{ as_user }}"
mode: '0400'
- name: Create private key
community.crypto.openssl_privatekey:
path: "/var/traefik/certs/chill/{{ item['chill_environment'] }}/key.pem"
path: "/var/traefik/certs/chill/{{ chill['chill_environment'] }}/key.pem"
- name: Create self signed certificate
community.crypto.x509_certificate:
privatekey_path: "/var/traefik/certs/chill/{{ item['chill_environment'] }}/key.pem"
path: "/var/traefik/certs/chill/{{ item['chill_environment'] }}/cert.pem"
privatekey_path: "/var/traefik/certs/chill/{{ chill['chill_environment'] }}/key.pem"
path: "/var/traefik/certs/chill/{{ chill['chill_environment'] }}/cert.pem"
provider: selfsigned
-4
View File
@@ -13,10 +13,6 @@
docker_install_compose_plugin: true
docker_add_repo: true
- name: Print all available facts
ansible.builtin.debug:
var: ansible_facts
- name: Authenticate against private docker registry
community.docker.docker_login:
registry_url: "{{ registry_url }}"