|
| 1 | +--- |
| 2 | +- name: Create directory to keep configfile |
| 3 | + ansible.builtin.file: |
| 4 | + dest: "/opt/openconext/attribute-aggregation" |
| 5 | + state: "directory" |
| 6 | + owner: "root" |
| 7 | + group: "root" |
| 8 | + mode: "0770" |
| 9 | + |
| 10 | +- name: Place the server application configfiles |
| 11 | + ansible.builtin.template: |
| 12 | + src: "{{ item }}.j2" |
| 13 | + dest: "/opt/openconext/attribute-aggregation/{{ item }}" |
| 14 | + owner: "root" |
| 15 | + group: "root" |
| 16 | + mode: "0644" |
| 17 | + with_items: |
| 18 | + - "serverapplication.yml" |
| 19 | + - "logback.xml" |
| 20 | + - "attributeAuthorities.yml" |
| 21 | + - "serviceProviderConfig.json" |
| 22 | + notify: |
| 23 | + - "Restart attribute-aggregationserver" |
| 24 | + |
| 25 | +- name: Place the link application configfiles |
| 26 | + ansible.builtin.template: |
| 27 | + src: "{{ item }}.j2" |
| 28 | + dest: "/opt/openconext/attribute-aggregation/{{ item }}" |
| 29 | + owner: "root" |
| 30 | + group: "root" |
| 31 | + mode: "0644" |
| 32 | + with_items: |
| 33 | + - "apachelink.conf" |
| 34 | + notify: |
| 35 | + - "Restart attribute-aggregationlink" |
| 36 | + |
| 37 | +- name: Add the MariaDB docker network to the list of networks when MariaDB runs in Docker |
| 38 | + ansible.builtin.set_fact: |
| 39 | + aa_docker_networks: |
| 40 | + - name: "loadbalancer" |
| 41 | + - name: "openconext_mariadb" |
| 42 | + when: "mariadb_in_docker | default(false) | bool" |
| 43 | + |
| 44 | +- name: Create and start the server container |
| 45 | + community.docker.docker_container: |
| 46 | + name: "aaserver" |
| 47 | + image: "ghcr.io/openconext/openconext-attribute-aggregation/aa-server:{{ attribute_aggregation_version }}" |
| 48 | + pull: true |
| 49 | + restart_policy: "always" |
| 50 | + state: "started" |
| 51 | + networks: "{{ aa_docker_networks }}" |
| 52 | + mounts: |
| 53 | + - source: "/opt/openconext/attribute-aggregation/serverapplication.yml" |
| 54 | + target: "/application.yml" |
| 55 | + read_only: true |
| 56 | + type: "bind" |
| 57 | + - source: "/opt/openconext/attribute-aggregation/logback.xml" |
| 58 | + target: "/logback.xml" |
| 59 | + read_only: true |
| 60 | + type: "bind" |
| 61 | + - source: "/opt/openconext/attribute-aggregation/attributeAuthorities.yml" |
| 62 | + target: "/attributeAuthorities.yml" |
| 63 | + read_only: true |
| 64 | + type: "bind" |
| 65 | + - source: "/opt/openconext/attribute-aggregation/serviceProviderConfig.json" |
| 66 | + target: "/serviceProviderConfig.json" |
| 67 | + read_only: true |
| 68 | + type: "bind" |
| 69 | + command: "-Xmx128m --spring.config.location=./" |
| 70 | + etc_hosts: |
| 71 | + host.docker.internal: "host-gateway" |
| 72 | + labels: |
| 73 | + traefik.http.routers.aaserver.rule: "Host(`aa.{{ base_domain }}`)" |
| 74 | + traefik.http.routers.aaserver.tls: "true" |
| 75 | + traefik.enable: "true" |
| 76 | + healthcheck: |
| 77 | + test: |
| 78 | + [ |
| 79 | + "CMD", |
| 80 | + "wget", |
| 81 | + "-no-verbose", |
| 82 | + "--tries=1", |
| 83 | + "--spider", |
| 84 | + "http://localhost:8080/internal/health", |
| 85 | + ] |
| 86 | + interval: "10s" |
| 87 | + timeout: "10s" |
| 88 | + retries: 3 |
| 89 | + start_period: "10s" |
| 90 | + notify: "Restart attribute-aggregationserver" |
| 91 | + register: "aa_servercontainer" |
| 92 | + |
| 93 | +- name: Create the gui link container |
| 94 | + community.docker.docker_container: |
| 95 | + name: "aalink" |
| 96 | + image: "ghcr.io/openconext/openconext-basecontainers/apache2-shibboleth:latest" |
| 97 | + pull: true |
| 98 | + restart_policy: "always" |
| 99 | + state: "started" |
| 100 | + networks: "{{ aa_docker_networks }}" |
| 101 | + mounts: |
| 102 | + - source: "/opt/openconext/attribute-aggregation/apachelink.conf" |
| 103 | + target: "/etc/apache2/sites-enabled/000-default.conf" |
| 104 | + read_only: true |
| 105 | + type: "bind" |
| 106 | + - source: "/etc/localtime" |
| 107 | + target: "/etc/localtime" |
| 108 | + read_only: true |
| 109 | + type: "bind" |
| 110 | + - source: "/opt/openconext/common/favicon.ico" |
| 111 | + target: "/var/www/favicon.ico" |
| 112 | + read_only: true |
| 113 | + type: "bind" |
| 114 | + etc_hosts: |
| 115 | + host.docker.internal: "host-gateway" |
| 116 | + labels: |
| 117 | + traefik.http.routers.aalink.rule: "Host(`link.{{ base_domain }}`)" |
| 118 | + traefik.http.routers.aalink.tls: "true" |
| 119 | + traefik.enable: "true" |
| 120 | + healthcheck: |
| 121 | + test: ["CMD", "curl", "--fail", "http://localhost/internal/health"] |
| 122 | + interval: "10s" |
| 123 | + timeout: "10s" |
| 124 | + retries: 3 |
| 125 | + start_period: "10s" |
| 126 | + hostname: "attribute-link" |
| 127 | + env: |
| 128 | + HTTPD_CSP: "{{ httpd_csp.lenient_with_static_img }}" |
| 129 | + HTTPD_SERVERNAME: "link.{{ base_domain }}" |
| 130 | + OPENCONEXT_INSTANCENAME: "{{ instance_name }}" |
| 131 | + OPENCONEXT_ENGINE_LOGOUT_URL: "https://engine.{{ base_domain }}/logout" |
| 132 | + OPENCONEXT_HELP_EMAIL: "{{ support_email }}" |
| 133 | + SHIB_ENTITYID: "https://link.{{ base_domain }}/shibboleth" |
| 134 | + SHIB_REMOTE_ENTITYID: "https://engine.{{ base_domain }}/authentication/idp/metadata" |
| 135 | + SHIB_REMOTE_METADATA: "{{ shibboleth_metadata_sources.engine }}" |
| 136 | + register: "aa_linkcontainer" |
| 137 | + |
| 138 | +- name: Remove obsolete pdp containers |
| 139 | + community.docker.docker_container: |
| 140 | + name: "{{ item }}" |
| 141 | + state: "absent" |
| 142 | + loop: |
| 143 | + - "aagui" |
0 commit comments