fix: inject image ref into accounts deploy
This commit is contained in:
parent
335ee6ef81
commit
4c62883bfc
@ -3,6 +3,16 @@
|
||||
gather_facts: false
|
||||
become: true
|
||||
vars:
|
||||
accounts_service_image_ref: >-
|
||||
{{
|
||||
(lookup('ansible.builtin.env', 'ACCOUNTS_IMAGE_REF') | default('', true) | trim)
|
||||
or
|
||||
(
|
||||
(lookup('ansible.builtin.env', 'ACCOUNTS_IMAGE_REPO') | default('ghcr.io/x-evor/accounts', true))
|
||||
~ ':'
|
||||
~ (lookup('ansible.builtin.env', 'ACCOUNTS_IMAGE_TAG') | default('latest', true))
|
||||
)
|
||||
}}
|
||||
accounts_service_image_repo: >-
|
||||
{{ lookup('ansible.builtin.env', 'ACCOUNTS_IMAGE_REPO')
|
||||
| default('ghcr.io/x-evor/accounts', true) }}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
---
|
||||
accounts_service_image_ref: "{{ accounts_service_image_repo }}:{{ accounts_service_image_tag }}"
|
||||
accounts_service_image_repo: ghcr.io/x-evor/accounts
|
||||
accounts_service_image_tag: latest
|
||||
accounts_service_pull_image: true
|
||||
|
||||
@ -60,6 +60,14 @@
|
||||
state: present
|
||||
insertbefore: BOF
|
||||
|
||||
- name: Ensure managed IMAGE is present for {{ accounts_service_target.name }}
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ accounts_service_target.env_file }}"
|
||||
regexp: '^IMAGE='
|
||||
line: 'IMAGE={{ accounts_service_image_ref }}'
|
||||
state: present
|
||||
insertafter: '^CONFIG_TEMPLATE='
|
||||
|
||||
- name: Render managed account config for {{ accounts_service_target.name }}
|
||||
ansible.builtin.template:
|
||||
src: account.yaml.j2
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
# Managed by Ansible. Do not edit on the host.
|
||||
CONFIG_PATH=/etc/xcontrol/account.yaml
|
||||
CONFIG_TEMPLATE=/etc/xcontrol/account.template.yaml
|
||||
IMAGE={{ accounts_service_image_ref }}
|
||||
DB_HOST={{ accounts_service_env_defaults.DB_HOST }}
|
||||
DB_NAME={{ accounts_service_env_defaults.DB_NAME }}
|
||||
DB_PASSWORD={{ accounts_service_env_defaults.DB_PASSWORD }}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
services:
|
||||
app:
|
||||
image: "{{ accounts_service_image_repo }}:{{ accounts_service_image_tag }}"
|
||||
image: "{{ accounts_service_image_ref }}"
|
||||
container_name: {{ accounts_service_target.container_name }}
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./env/app.env
|
||||
environment:
|
||||
IMAGE: "{{ accounts_service_image_ref }}"
|
||||
PORT: "{{ accounts_service_container_port }}"
|
||||
volumes:
|
||||
- ./config/account.yaml:/etc/xcontrol/account.template.yaml:ro
|
||||
|
||||
Loading…
Reference in New Issue
Block a user