Skip to content

Commit

Permalink
access: restart container if config changed
Browse files Browse the repository at this point in the history
  • Loading branch information
phavekes committed Sep 18, 2023
1 parent 0817417 commit 7cec0d0
Showing 1 changed file with 62 additions and 3 deletions.
65 changes: 62 additions & 3 deletions roles/access/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
group: root
mode: "0770"

- name: Place the server configfiles
- name: Place the serverapplication configfiles
ansible.builtin.template:
src: "{{ item }}.j2"
dest: /opt/openconext/access/{{ item }}
Expand All @@ -16,14 +16,46 @@
mode: "0644"
with_items:
- serverapplication.yml
register: serverconfigfiles

- name: Place the mockapplication configfiles
ansible.builtin.template:
src: "{{ item }}.j2"
dest: /opt/openconext/access/{{ item }}
owner: root
group: root
mode: "0644"
with_items:
- mockapplication.yml
register: mockconfigfiles

- name: Create and start the server container
community.docker.docker_container:
name: openconextaccessserver
image: ghcr.io/openconext/openconext-access/accessserver:{{ access_server_version }}
pull: true
restart_policy: "always"
state: started
networks:
- name: "loadbalancer"
mounts:
- source: /opt/openconext/access/serverapplication.yml
target: /application.yml
type: bind
command: '--spring.config.location=./'
log_driver: local
etc_hosts:
host.docker.internal: host-gateway
when: not serverconfigfiles.changed

- name: Create the server container
- name: Create and (re)start the server container
community.docker.docker_container:
name: openconextaccessserver
image: ghcr.io/openconext/openconext-access/accessserver:{{ access_server_version }}
pull: true
restart_policy: "always"
state: started
restart: true
networks:
- name: "loadbalancer"
mounts:
Expand All @@ -34,13 +66,15 @@
log_driver: local
etc_hosts:
host.docker.internal: host-gateway
when: serverconfigfiles.changed

- name: Create the client container
community.docker.docker_container:
name: accessclient
image: ghcr.io/openconext/openconext-access/accessclient:{{ access_client_version }}
pull: true
restart_policy: "always"
state: started
networks:
- name: "loadbalancer"
labels:
Expand All @@ -54,19 +88,43 @@
image: ghcr.io/openconext/openconext-access/accessswelcome:{{ access_welcome_version }}
pull: true
restart_policy: "always"
state: started
networks:
- name: "loadbalancer"
labels:
traefik.http.routers.accesswelcome.rule: "Host(`welcome.{{ base_domain }}`)"
traefik.http.routers.accesswelcome.tls: "true"
traefik.enable: "true"

- name: Create the mock provisioning container
- name: Create and start the mock provisioning container
community.docker.docker_container:
name: accesssprovisioningmock
image: ghcr.io/openconext/openconext-access/accesssprovisioningmock:{{ access_mock_version }}
pull: true
restart_policy: "always"
state: started
command: '--spring.config.location=./'
mounts:
- source: /opt/openconext/access/mockapplication.yml
target: /application.yml
type: bind
networks:
- name: "loadbalancer"
labels:
traefik.http.routers.accessmock.rule: "Host(`mock.{{ base_domain }}`)"
traefik.http.routers.accessmock.tls: "true"
traefik.http.services.accessmock.loadbalancer.server.port: "8081"
traefik.enable: "true"
when: not mockconfigfiles.changed

- name: Create and (re)start the mock provisioning container
community.docker.docker_container:
name: accesssprovisioningmock
image: ghcr.io/openconext/openconext-access/accesssprovisioningmock:{{ access_mock_version }}
pull: true
restart_policy: "always"
restart: true
state: started
command: '--spring.config.location=./'
mounts:
- source: /opt/openconext/access/mockapplication.yml
Expand All @@ -79,6 +137,7 @@
traefik.http.routers.accessmock.tls: "true"
traefik.http.services.accessmock.loadbalancer.server.port: "8081"
traefik.enable: "true"
when: mockconfigfiles.changed

- name: Include the role manage_provision_entities to provision access client to Manage
ansible.builtin.include_role:
Expand Down

0 comments on commit 7cec0d0

Please sign in to comment.