From b7d540a81dafef75ff102440f0630efea1585189 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Wed, 11 Sep 2024 16:24:36 +0100 Subject: [PATCH 1/7] wip: rename configs role to envs --- roles/bin/templates/bin/_smi_wrapper.py | 4 +-- roles/configs/defaults/main.yaml | 7 ---- roles/configs/tasks/deploy_config_dir.yaml | 32 ------------------- roles/configs/tasks/main.yaml | 18 ----------- roles/envs/defaults/main.yaml | 6 ++++ roles/envs/tasks/deploy_env_dir.yaml | 25 +++++++++++++++ roles/envs/tasks/main.yaml | 15 +++++++++ .../IsIdentifiableRules/DemoRules.yaml | 0 .../templates/example.old}/NLog.config.xml | 0 .../templates/example.old}/ctp.config.xml | 0 .../templates/example.old}/env.bash | 0 .../example.old}/file-extract-services.yaml | 0 .../example.old}/file-load-services.yaml | 0 .../rabbitmq_file_extract_config.json | 0 .../rabbitmq_file_load_config.json | 0 site.yaml | 4 +-- 16 files changed, 50 insertions(+), 61 deletions(-) delete mode 100644 roles/configs/defaults/main.yaml delete mode 100644 roles/configs/tasks/deploy_config_dir.yaml delete mode 100644 roles/configs/tasks/main.yaml create mode 100644 roles/envs/defaults/main.yaml create mode 100644 roles/envs/tasks/deploy_env_dir.yaml create mode 100644 roles/envs/tasks/main.yaml rename roles/{configs/templates/example => envs/templates/example.old}/IsIdentifiableRules/DemoRules.yaml (100%) rename roles/{configs/templates/example => envs/templates/example.old}/NLog.config.xml (100%) rename roles/{configs/templates/example => envs/templates/example.old}/ctp.config.xml (100%) rename roles/{configs/templates/example => envs/templates/example.old}/env.bash (100%) rename roles/{configs/templates/example => envs/templates/example.old}/file-extract-services.yaml (100%) rename roles/{configs/templates/example => envs/templates/example.old}/file-load-services.yaml (100%) rename roles/{configs/templates/example => envs/templates/example.old}/rabbitmq_file_extract_config.json (100%) rename roles/{configs/templates/example => envs/templates/example.old}/rabbitmq_file_load_config.json (100%) diff --git a/roles/bin/templates/bin/_smi_wrapper.py b/roles/bin/templates/bin/_smi_wrapper.py index 64bbfcd..3010fff 100644 --- a/roles/bin/templates/bin/_smi_wrapper.py +++ b/roles/bin/templates/bin/_smi_wrapper.py @@ -47,7 +47,7 @@ def init() -> tuple[argparse.Namespace, list[str], dict[str, str], str]: assert "SMI_ENV" in os.environ, "SMI_ENV must be set" smi_env = os.environ["SMI_ENV"] - env_dir = f"{INSTALL_DIR}/configs/{smi_env}" + env_dir = f"{INSTALL_DIR}/envs/{smi_env}" assert os.path.isdir(env_dir), f"{env_dir} does not exist" env = {**os.environ, **_env_from(f"{env_dir}/env.bash")} @@ -55,7 +55,7 @@ def init() -> tuple[argparse.Namespace, list[str], dict[str, str], str]: for var in sorted(x for x in env if x.startswith("SMI_")): print(f"{var}={env[var]}") - config_dir = f"{INSTALL_DIR}/configs/{smi_env}" + config_dir = f"{INSTALL_DIR}/envs/{smi_env}" return (wrapper_args, remaining_argv, env, config_dir) diff --git a/roles/configs/defaults/main.yaml b/roles/configs/defaults/main.yaml deleted file mode 100644 index f2e1ab3..0000000 --- a/roles/configs/defaults/main.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -configs_smi_envs: "{{ smi_envs | default([]) }}" -configs_smi_root_dir: "{{ smi_root_dir | default(lookup('env', 'HOME') ~ '/smi') }}" -configs_configs_dir: "{{ configs_smi_root_dir }}/configs" - -# Override this with an absolute path to a local directory of configs -configs_template_dir: "{{ role_path }}/templates" diff --git a/roles/configs/tasks/deploy_config_dir.yaml b/roles/configs/tasks/deploy_config_dir.yaml deleted file mode 100644 index 4d5df01..0000000 --- a/roles/configs/tasks/deploy_config_dir.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: Stat config template dir - ansible.builtin.stat: - path: "{{ configs_template_dir }}/{{ env['name'] }}" - register: stat_result - -- name: Assert config template dir exists - ansible.builtin.assert: - that: stat_result.stat.exists and stat_result.stat.isdir - msg: "Expected {{ configs_template_dir }}/{{ env['name'] }} to be a directory" - -- name: Ensure config dir exists - ansible.builtin.file: - path: "{{ configs_configs_dir }}/{{ env['name'] }}" - state: directory - mode: u=rwx,g=rx,o=rx - -- name: Ensure config directory structure exists - ansible.builtin.file: - path: "{{ configs_configs_dir }}/{{ env['name'] }}//{{ item.path }}" - state: directory - mode: u=rwx,g=rx,o=rx - with_community.general.filetree: "{{ configs_template_dir }}/{{ env['name'] }}" - when: item.state == 'directory' - -- name: Ensure files are populated from templates - ansible.builtin.template: - src: "{{ item.src }}" - dest: "{{ configs_configs_dir }}/{{ env['name'] }}/{{ item.path }}" - mode: u=rw,g=r,o=r - with_community.general.filetree: "{{ configs_template_dir }}/{{ env['name'] }}" - when: item.state == 'file' diff --git a/roles/configs/tasks/main.yaml b/roles/configs/tasks/main.yaml deleted file mode 100644 index 09d7595..0000000 --- a/roles/configs/tasks/main.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: Ensure configs dir exists - become: true - ansible.builtin.file: - name: "{{ configs_configs_dir }}" - state: directory - mode: u=rwx,g=rx,o=rx - -- name: Check configs_smi_envs length - ansible.builtin.assert: - that: "{{ configs_smi_envs | length > 0 }}" - msg: At least one smi_env must be defined for this role - -- name: Deploy configs - ansible.builtin.include_tasks: deploy_config_dir.yaml - with_items: "{{ configs_smi_envs }}" - loop_control: - loop_var: env diff --git a/roles/envs/defaults/main.yaml b/roles/envs/defaults/main.yaml new file mode 100644 index 0000000..e04e6b3 --- /dev/null +++ b/roles/envs/defaults/main.yaml @@ -0,0 +1,6 @@ +--- +envs_smi_root_dir: "{{ smi_root_dir | default(lookup('env', 'HOME') ~ '/smi') }}" +envs_envs_dir: "{{ envs_smi_root_dir }}/envs" + +# Override this with an absolute path to a local directory of configs +envs_template_dir: "{{ role_path }}/templates" diff --git a/roles/envs/tasks/deploy_env_dir.yaml b/roles/envs/tasks/deploy_env_dir.yaml new file mode 100644 index 0000000..65080db --- /dev/null +++ b/roles/envs/tasks/deploy_env_dir.yaml @@ -0,0 +1,25 @@ +--- +# todo load vars & vault +# todo skip above from target + +- name: Ensure env dir exists + ansible.builtin.file: + path: "{{ envs_envs_dir }}/{{ env_name }}" + state: directory + mode: u=rwx,g=rx,o=rx + +- name: Ensure env directory structure exists + ansible.builtin.file: + path: "{{ envs_envs_dir }}/{{ env_name }}//{{ item.path }}" + state: directory + mode: u=rwx,g=rx,o=rx + with_community.general.filetree: "{{ envs_template_dir }}/{{ env_name }}" + when: item.state == 'directory' + +- name: Ensure files are populated from templates + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ envs_envs_dir }}/{{ env_name }}/{{ item.path }}" + mode: u=rw,g=r,o=r + with_community.general.filetree: "{{ envs_template_dir }}/{{ env_name }}" + when: item.state == 'file' diff --git a/roles/envs/tasks/main.yaml b/roles/envs/tasks/main.yaml new file mode 100644 index 0000000..fa69e1e --- /dev/null +++ b/roles/envs/tasks/main.yaml @@ -0,0 +1,15 @@ +--- +- name: Ensure envs dir exists + become: true + ansible.builtin.file: + name: "{{ envs_envs_dir }}" + state: directory + mode: u=rwx,g=rx,o=rx + +# TODO register dirs + +- name: Deploy envs + ansible.builtin.include_tasks: deploy_env_dir.yaml + with_items: "{{ env_names }}" + loop_control: + loop_var: env_name diff --git a/roles/configs/templates/example/IsIdentifiableRules/DemoRules.yaml b/roles/envs/templates/example.old/IsIdentifiableRules/DemoRules.yaml similarity index 100% rename from roles/configs/templates/example/IsIdentifiableRules/DemoRules.yaml rename to roles/envs/templates/example.old/IsIdentifiableRules/DemoRules.yaml diff --git a/roles/configs/templates/example/NLog.config.xml b/roles/envs/templates/example.old/NLog.config.xml similarity index 100% rename from roles/configs/templates/example/NLog.config.xml rename to roles/envs/templates/example.old/NLog.config.xml diff --git a/roles/configs/templates/example/ctp.config.xml b/roles/envs/templates/example.old/ctp.config.xml similarity index 100% rename from roles/configs/templates/example/ctp.config.xml rename to roles/envs/templates/example.old/ctp.config.xml diff --git a/roles/configs/templates/example/env.bash b/roles/envs/templates/example.old/env.bash similarity index 100% rename from roles/configs/templates/example/env.bash rename to roles/envs/templates/example.old/env.bash diff --git a/roles/configs/templates/example/file-extract-services.yaml b/roles/envs/templates/example.old/file-extract-services.yaml similarity index 100% rename from roles/configs/templates/example/file-extract-services.yaml rename to roles/envs/templates/example.old/file-extract-services.yaml diff --git a/roles/configs/templates/example/file-load-services.yaml b/roles/envs/templates/example.old/file-load-services.yaml similarity index 100% rename from roles/configs/templates/example/file-load-services.yaml rename to roles/envs/templates/example.old/file-load-services.yaml diff --git a/roles/configs/templates/example/rabbitmq_file_extract_config.json b/roles/envs/templates/example.old/rabbitmq_file_extract_config.json similarity index 100% rename from roles/configs/templates/example/rabbitmq_file_extract_config.json rename to roles/envs/templates/example.old/rabbitmq_file_extract_config.json diff --git a/roles/configs/templates/example/rabbitmq_file_load_config.json b/roles/envs/templates/example.old/rabbitmq_file_load_config.json similarity index 100% rename from roles/configs/templates/example/rabbitmq_file_load_config.json rename to roles/envs/templates/example.old/rabbitmq_file_load_config.json diff --git a/site.yaml b/site.yaml index e3881ed..73c41b3 100644 --- a/site.yaml +++ b/site.yaml @@ -9,8 +9,8 @@ tags: [always] - role: bin tags: [bin] - - role: configs - tags: [configs] + - role: envs + tags: [envs] - role: smi_smiservices tags: [smiservices] - role: smi_isidentifiable From a1f9860a7d30e0d48461fe0d2f2ad9b3ed954543 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Wed, 11 Sep 2024 17:59:17 +0100 Subject: [PATCH 2/7] wip: loading of vars --- .../IsIdentifiableRules/DemoRules.yaml | 0 .../example.old/NLog.config.xml | 0 .../example.old/ctp.config.xml | 0 .../envs/{templates => }/example.old/env.bash | 0 .../example.old/file-extract-services.yaml | 0 .../example.old/file-load-services.yaml | 0 .../rabbitmq_file_extract_config.json | 0 .../rabbitmq_file_load_config.json | 0 roles/envs/tasks/deploy_env_dir.yaml | 21 ++++++++++++++++++- roles/envs/tasks/main.yaml | 9 ++++++-- roles/envs/templates/ex/foo.txt | 3 +++ roles/envs/templates/ex/vars.yaml | 4 ++++ roles/envs/templates/ex/vault.yaml | 6 ++++++ 13 files changed, 40 insertions(+), 3 deletions(-) rename roles/envs/{templates => }/example.old/IsIdentifiableRules/DemoRules.yaml (100%) rename roles/envs/{templates => }/example.old/NLog.config.xml (100%) rename roles/envs/{templates => }/example.old/ctp.config.xml (100%) rename roles/envs/{templates => }/example.old/env.bash (100%) rename roles/envs/{templates => }/example.old/file-extract-services.yaml (100%) rename roles/envs/{templates => }/example.old/file-load-services.yaml (100%) rename roles/envs/{templates => }/example.old/rabbitmq_file_extract_config.json (100%) rename roles/envs/{templates => }/example.old/rabbitmq_file_load_config.json (100%) create mode 100644 roles/envs/templates/ex/foo.txt create mode 100644 roles/envs/templates/ex/vars.yaml create mode 100644 roles/envs/templates/ex/vault.yaml diff --git a/roles/envs/templates/example.old/IsIdentifiableRules/DemoRules.yaml b/roles/envs/example.old/IsIdentifiableRules/DemoRules.yaml similarity index 100% rename from roles/envs/templates/example.old/IsIdentifiableRules/DemoRules.yaml rename to roles/envs/example.old/IsIdentifiableRules/DemoRules.yaml diff --git a/roles/envs/templates/example.old/NLog.config.xml b/roles/envs/example.old/NLog.config.xml similarity index 100% rename from roles/envs/templates/example.old/NLog.config.xml rename to roles/envs/example.old/NLog.config.xml diff --git a/roles/envs/templates/example.old/ctp.config.xml b/roles/envs/example.old/ctp.config.xml similarity index 100% rename from roles/envs/templates/example.old/ctp.config.xml rename to roles/envs/example.old/ctp.config.xml diff --git a/roles/envs/templates/example.old/env.bash b/roles/envs/example.old/env.bash similarity index 100% rename from roles/envs/templates/example.old/env.bash rename to roles/envs/example.old/env.bash diff --git a/roles/envs/templates/example.old/file-extract-services.yaml b/roles/envs/example.old/file-extract-services.yaml similarity index 100% rename from roles/envs/templates/example.old/file-extract-services.yaml rename to roles/envs/example.old/file-extract-services.yaml diff --git a/roles/envs/templates/example.old/file-load-services.yaml b/roles/envs/example.old/file-load-services.yaml similarity index 100% rename from roles/envs/templates/example.old/file-load-services.yaml rename to roles/envs/example.old/file-load-services.yaml diff --git a/roles/envs/templates/example.old/rabbitmq_file_extract_config.json b/roles/envs/example.old/rabbitmq_file_extract_config.json similarity index 100% rename from roles/envs/templates/example.old/rabbitmq_file_extract_config.json rename to roles/envs/example.old/rabbitmq_file_extract_config.json diff --git a/roles/envs/templates/example.old/rabbitmq_file_load_config.json b/roles/envs/example.old/rabbitmq_file_load_config.json similarity index 100% rename from roles/envs/templates/example.old/rabbitmq_file_load_config.json rename to roles/envs/example.old/rabbitmq_file_load_config.json diff --git a/roles/envs/tasks/deploy_env_dir.yaml b/roles/envs/tasks/deploy_env_dir.yaml index 65080db..8f861ab 100644 --- a/roles/envs/tasks/deploy_env_dir.yaml +++ b/roles/envs/tasks/deploy_env_dir.yaml @@ -10,12 +10,31 @@ - name: Ensure env directory structure exists ansible.builtin.file: - path: "{{ envs_envs_dir }}/{{ env_name }}//{{ item.path }}" + path: "{{ envs_envs_dir }}/{{ env_name }}/{{ item.path }}" state: directory mode: u=rwx,g=rx,o=rx with_community.general.filetree: "{{ envs_template_dir }}/{{ env_name }}" when: item.state == 'directory' +- name: Load env vault.yaml + ansible.builtin.include_vars: + file: "{{ envs_template_dir }}/{{ env_name }}/vault.yaml" + # name: env_vault_vars + register: x + +# - debug: var=env_vault_vars +# - pause: + +- name: Load env vars.yaml + ansible.builtin.include_vars: + file: "{{ envs_template_dir }}/{{ env_name }}/vars.yaml" + name: env_vars + +- name: Assert env_vars defined + ansible.builtin.assert: + that: env_vars is defined + fail_msg: "Expected to load env_vars from file. A variable was possibly undefined (see https://github.com/ansible/ansible/issues/25787)" + - name: Ensure files are populated from templates ansible.builtin.template: src: "{{ item.src }}" diff --git a/roles/envs/tasks/main.yaml b/roles/envs/tasks/main.yaml index fa69e1e..56bbbb3 100644 --- a/roles/envs/tasks/main.yaml +++ b/roles/envs/tasks/main.yaml @@ -6,10 +6,15 @@ state: directory mode: u=rwx,g=rx,o=rx -# TODO register dirs +- name: Register env names + ansible.builtin.find: + paths: "{{ envs_template_dir }}" + file_type: directory + depth: 1 + register: env_names - name: Deploy envs ansible.builtin.include_tasks: deploy_env_dir.yaml - with_items: "{{ env_names }}" + with_items: "{{ env_names.files | map(attribute='path') | map('basename') }}" loop_control: loop_var: env_name diff --git a/roles/envs/templates/ex/foo.txt b/roles/envs/templates/ex/foo.txt new file mode 100644 index 0000000..78e5367 --- /dev/null +++ b/roles/envs/templates/ex/foo.txt @@ -0,0 +1,3 @@ +{{ ansible_managed | comment }} + +{{ env_vars.foo_secret }} diff --git a/roles/envs/templates/ex/vars.yaml b/roles/envs/templates/ex/vars.yaml new file mode 100644 index 0000000..2f762f9 --- /dev/null +++ b/roles/envs/templates/ex/vars.yaml @@ -0,0 +1,4 @@ +foo: yay +bar: baz + +foo_secret: "{{ vault_foo_secret }}" diff --git a/roles/envs/templates/ex/vault.yaml b/roles/envs/templates/ex/vault.yaml new file mode 100644 index 0000000..ee287ba --- /dev/null +++ b/roles/envs/templates/ex/vault.yaml @@ -0,0 +1,6 @@ +$ANSIBLE_VAULT;1.1;AES256 +65653230393063613534356561363233666539623666626262643166623864653630653130326264 +3437636533366331663366656361356438366438653961370a623465313736356335363562303961 +34363564363634663264386565333063303231313730363137393539303863626364623865613938 +3136373834303766330a666239343330626166633161356233366662376333373166623731626437 +62613735303063323932653831613139383238656363346331633766313432323861 From d980994f7f47879b46bc6f368a29d1d72592f3a9 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 12 Sep 2024 09:31:23 +0100 Subject: [PATCH 3/7] finish vault/vars loading and exclude from output --- .meta/ansible-managed-in-templates | 2 + .../IsIdentifiableRules/DemoRules.yaml | 7 - roles/envs/example.old/NLog.config.xml | 28 - roles/envs/example.old/ctp.config.xml | 1048 ----------------- roles/envs/example.old/env.bash | 7 - .../example.old/file-extract-services.yaml | 55 - .../envs/example.old/file-load-services.yaml | 34 - .../rabbitmq_file_extract_config.json | 257 ---- .../rabbitmq_file_load_config.json | 194 --- roles/envs/tasks/deploy_env_dir.yaml | 16 +- roles/envs/templates/ex/foo.txt | 3 - roles/envs/templates/ex/vars.yaml | 4 - roles/envs/templates/ex/vault.yaml | 6 - roles/envs/templates/example/foo.txt | 4 + roles/envs/templates/example/vars.yaml | 4 + roles/envs/templates/example/vault.yaml | 6 + 16 files changed, 23 insertions(+), 1652 deletions(-) delete mode 100644 roles/envs/example.old/IsIdentifiableRules/DemoRules.yaml delete mode 100644 roles/envs/example.old/NLog.config.xml delete mode 100644 roles/envs/example.old/ctp.config.xml delete mode 100644 roles/envs/example.old/env.bash delete mode 100644 roles/envs/example.old/file-extract-services.yaml delete mode 100644 roles/envs/example.old/file-load-services.yaml delete mode 100644 roles/envs/example.old/rabbitmq_file_extract_config.json delete mode 100644 roles/envs/example.old/rabbitmq_file_load_config.json delete mode 100644 roles/envs/templates/ex/foo.txt delete mode 100644 roles/envs/templates/ex/vars.yaml delete mode 100644 roles/envs/templates/ex/vault.yaml create mode 100644 roles/envs/templates/example/foo.txt create mode 100644 roles/envs/templates/example/vars.yaml create mode 100644 roles/envs/templates/example/vault.yaml diff --git a/.meta/ansible-managed-in-templates b/.meta/ansible-managed-in-templates index a305748..aeb0ece 100755 --- a/.meta/ansible-managed-in-templates +++ b/.meta/ansible-managed-in-templates @@ -7,6 +7,8 @@ def main() -> int: rc = 0 for arg in sys.argv[1:]: + if arg.endswith("vault.yaml"): + continue with open(arg) as f: if needle in f.read(): continue diff --git a/roles/envs/example.old/IsIdentifiableRules/DemoRules.yaml b/roles/envs/example.old/IsIdentifiableRules/DemoRules.yaml deleted file mode 100644 index 2c03c21..0000000 --- a/roles/envs/example.old/IsIdentifiableRules/DemoRules.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# {{ ansible_managed }} - -BasicRules: - - Action: Ignore - IfColumn: Manufacturer - IfPattern: ^AGFA$ diff --git a/roles/envs/example.old/NLog.config.xml b/roles/envs/example.old/NLog.config.xml deleted file mode 100644 index 787d09c..0000000 --- a/roles/envs/example.old/NLog.config.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/roles/envs/example.old/ctp.config.xml b/roles/envs/example.old/ctp.config.xml deleted file mode 100644 index da15ac5..0000000 --- a/roles/envs/example.old/ctp.config.xml +++ /dev/null @@ -1,1048 +0,0 @@ - - diff --git a/roles/envs/example.old/env.bash b/roles/envs/example.old/env.bash deleted file mode 100644 index 8202277..0000000 --- a/roles/envs/example.old/env.bash +++ /dev/null @@ -1,7 +0,0 @@ -# {{ ansible_managed }} - -export SMI_LOGS_ROOT="/tmp/smi/logs/{{ env['name'] }}" - -export SMI_SMI_SMISERVICES_VERSION="v5.6.1" -export SMI_SMI_ISIDENTIFIABLE_VERSION="v0.3.0" -export SMI_HICSERVICES_RDMP_VERSION="v8.1.0" diff --git a/roles/envs/example.old/file-extract-services.yaml b/roles/envs/example.old/file-extract-services.yaml deleted file mode 100644 index 8778a2e..0000000 --- a/roles/envs/example.old/file-extract-services.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -# {{ ansible_managed }} - -RabbitOptions: - RabbitMqHostName: "localhost" - RabbitMqHostPort: 5672 - RabbitMqVirtualHost: "smi_{{ env['name'] }}_file_extract" - RabbitMqUserName: "guest" - RabbitMqPassword: "guest" - RabbitMqControlExchangeName: "ControlExchange" - FatalLoggingExchange: "FatalLoggingExchange" - -LoggingOptions: - LogConfigFile: "{{ template_destpath | dirname }}/NLog.config.xml" - LogsRoot: "/tmp/smi/logs/{{ env['name'] }}" - TraceLogging: true - -FileSystemOptions: - FileSystemRoot: "/tmp/smi/PACS" - ExtractRoot: "/tmp/smi/extract" - DicomSearchPattern: "*.dcm" - -RDMPOptions: - CatalogueConnectionString: - YamlDir: - DataExportConnectionString: - -MongoDatabases: - ExtractionStoreOptions: - HostName: "localhost" - Port: 27017 - UserName: - Password: - DatabaseName: "extraction" - -ExtractImagesOptions: - MaxIdentifiersPerMessage: 1000 - ExtractionRequestProducerOptions: - ExchangeName: "RequestExchange" - MaxConfirmAttempts: 1 - ExtractionRequestInfoProducerOptions: - ExchangeName: "RequestInfoExchange" - MaxConfirmAttempts: 1 - -CTPAnonymiserOptions: - VerifyRoutingKey: verify - NoVerifyRoutingKey: noverify - SRAnonTool: "{{ configs_smi_root_dir }}/software/SMI/StructuredReports/SMI-StructuredReports-{{ env['structuredreports_version'] }}/src/applications/SRAnonTool/CTP_SRAnonTool.sh" - AnonFileConsumerOptions: - QueueName: 'ExtractFileAnonQueue' - QoSPrefetchCount: 1 - AutoAck: false - ExtractFileStatusProducerOptions: - ExchangeName: 'ExtractedFileStatusExchange' - MaxConfirmAttempts: 5 diff --git a/roles/envs/example.old/file-load-services.yaml b/roles/envs/example.old/file-load-services.yaml deleted file mode 100644 index 307057c..0000000 --- a/roles/envs/example.old/file-load-services.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -# {{ ansible_managed }} - -RabbitOptions: - RabbitMqHostName: "localhost" - RabbitMqHostPort: 5672 - RabbitMqVirtualHost: "smi_{{ env['name'] }}_file_load" - RabbitMqUserName: "guest" - RabbitMqPassword: "guest" - RabbitMqControlExchangeName: "ControlExchange" - FatalLoggingExchange: "FatalLoggingExchange" - -LoggingOptions: - LogConfigFile: "{{ template_destpath | dirname }}/NLog.config.xml" - LogsRoot: "/tmp/smi/logs/{{ env['name'] }}" - TraceLogging: true - -FileSystemOptions: - FileSystemRoot: "/tmp/smi/PACS" - DicomSearchPattern: "*.dcm" - -MongoDatabases: - DicomStoreOptions: - HostName: "localhost" - Port: 27017 - UserName: - Password: - DatabaseName: "dicom" - -ProcessDirectoryOptions: - AccessionDirectoryProducerOptions: - ExchangeName: "AccessionDirectoryExchange" - MaxConfirmAttempts: 1 -# ... diff --git a/roles/envs/example.old/rabbitmq_file_extract_config.json b/roles/envs/example.old/rabbitmq_file_extract_config.json deleted file mode 100644 index 8dca958..0000000 --- a/roles/envs/example.old/rabbitmq_file_extract_config.json +++ /dev/null @@ -1,257 +0,0 @@ -{ - "_comment": "{{ ansible_managed }}", - "vhosts": [ - { - "name": "smi_{{ env['name'] }}_file_extract" - } - ], - "policies": [ - { - "vhost": "smi_{{ env['name'] }}_file_extract", - "name": "deadLetterExtract", - "pattern": "", - "apply-to": "queues", - "definition": { - "dead-letter-exchange": "DLExchange" - }, - "priority": 0 - } - ], - "exchanges": [ - { - "name": "ControlExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "topic", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "ExtractedFileStatusExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "ExtractedFileVerifiedExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "FileCollectionInfoExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "ExtractFileExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "RequestExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "DLExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "topic", - "durable": true, - "auto_delete": false, - "internal": true, - "arguments": {} - }, - { - "name": "RequestInfoExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "FatalLoggingExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - } - ], - "queues": [ - { - "name": "FileCollectionInfoQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "RequestQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "ExtractedFileToVerifyQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "ExtractedFileNoVerifyQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "ExtractFileAnonQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "ExtractFileIdentQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "DLQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "RequestInfoQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "ExtractedFileVerifiedQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "FatalLoggingQueue", - "vhost": "smi_{{ env['name'] }}_file_extract", - "durable": true, - "auto_delete": false, - "arguments": {} - } - ], - "bindings": [ - { - "source": "DLExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "DLQueue", - "destination_type": "queue", - "routing_key": "#", - "arguments": {} - }, - { - "source": "FileCollectionInfoExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "FileCollectionInfoQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "ExtractFileExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "ExtractFileAnonQueue", - "destination_type": "queue", - "routing_key": "anon", - "arguments": {} - }, - { - "source": "ExtractFileExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "ExtractFileIdentQueue", - "destination_type": "queue", - "routing_key": "ident", - "arguments": {} - }, - { - "source": "ExtractedFileStatusExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "ExtractedFileToVerifyQueue", - "destination_type": "queue", - "routing_key": "verify", - "arguments": {} - }, - { - "source": "ExtractedFileStatusExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "ExtractedFileNoVerifyQueue", - "destination_type": "queue", - "routing_key": "noverify", - "arguments": {} - }, - { - "source": "RequestExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "RequestQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "RequestInfoExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "RequestInfoQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "ExtractedFileVerifiedExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "ExtractedFileVerifiedQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "FatalLoggingExchange", - "vhost": "smi_{{ env['name'] }}_file_extract", - "destination": "FatalLoggingQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - } - ] -} diff --git a/roles/envs/example.old/rabbitmq_file_load_config.json b/roles/envs/example.old/rabbitmq_file_load_config.json deleted file mode 100644 index 676e03d..0000000 --- a/roles/envs/example.old/rabbitmq_file_load_config.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "_comment": "{{ ansible_managed }}", - "vhosts": [ - { - "name": "smi_{{ env['name'] }}_file_load" - } - ], - "policies": [ - { - "name": "deadLetterDataLoad", - "vhost": "smi_{{ env['name'] }}_file_load", - "pattern": "", - "apply-to": "queues", - "definition": { - "dead-letter-exchange": "DLExchange" - }, - "priority": 0 - } - ], - "exchanges": [ - { - "name": "AccessionDirectoryExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "IdentifiableImageExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "IdentifiableSeriesExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "AnonymousImageExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "ControlExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "topic", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - }, - { - "name": "DLExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "topic", - "durable": true, - "auto_delete": false, - "internal": true, - "arguments": {} - }, - { - "name": "FatalLoggingExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "type": "direct", - "durable": true, - "auto_delete": false, - "internal": false, - "arguments": {} - } - ], - "queues": [ - { - "name": "AccessionDirectoryQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "IdentifiableImageQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "MongoImageQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "MongoSeriesQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "AnonymousImageQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "DLQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - }, - { - "name": "FatalLoggingQueue", - "vhost": "smi_{{ env['name'] }}_file_load", - "durable": true, - "auto_delete": false, - "arguments": {} - } - ], - "bindings": [ - { - "source": "AccessionDirectoryExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "AccessionDirectoryQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "IdentifiableImageExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "IdentifiableImageQueue", - "destination_type": "queue", - "routing_key": "reprocessed", - "arguments": {} - }, - { - "source": "IdentifiableImageExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "MongoImageQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "IdentifiableSeriesExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "MongoSeriesQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "AnonymousImageExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "AnonymousImageQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - }, - { - "source": "DLExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "DLQueue", - "destination_type": "queue", - "routing_key": "#", - "arguments": {} - }, - { - "source": "FatalLoggingExchange", - "vhost": "smi_{{ env['name'] }}_file_load", - "destination": "FatalLoggingQueue", - "destination_type": "queue", - "routing_key": "", - "arguments": {} - } - ] -} diff --git a/roles/envs/tasks/deploy_env_dir.yaml b/roles/envs/tasks/deploy_env_dir.yaml index 8f861ab..a506738 100644 --- a/roles/envs/tasks/deploy_env_dir.yaml +++ b/roles/envs/tasks/deploy_env_dir.yaml @@ -1,7 +1,4 @@ --- -# todo load vars & vault -# todo skip above from target - - name: Ensure env dir exists ansible.builtin.file: path: "{{ envs_envs_dir }}/{{ env_name }}" @@ -19,11 +16,12 @@ - name: Load env vault.yaml ansible.builtin.include_vars: file: "{{ envs_template_dir }}/{{ env_name }}/vault.yaml" - # name: env_vault_vars - register: x + name: env_vault_vars -# - debug: var=env_vault_vars -# - pause: +- name: Assert env_vault_vars defined + ansible.builtin.assert: + that: env_vault_vars is defined + fail_msg: "Expected to load vars from file. A variable was possibly undefined (see https://github.com/ansible/ansible/issues/25787)" - name: Load env vars.yaml ansible.builtin.include_vars: @@ -33,7 +31,7 @@ - name: Assert env_vars defined ansible.builtin.assert: that: env_vars is defined - fail_msg: "Expected to load env_vars from file. A variable was possibly undefined (see https://github.com/ansible/ansible/issues/25787)" + fail_msg: "Expected to load vars from file. A variable was possibly undefined (see https://github.com/ansible/ansible/issues/25787)" - name: Ensure files are populated from templates ansible.builtin.template: @@ -41,4 +39,4 @@ dest: "{{ envs_envs_dir }}/{{ env_name }}/{{ item.path }}" mode: u=rw,g=r,o=r with_community.general.filetree: "{{ envs_template_dir }}/{{ env_name }}" - when: item.state == 'file' + when: item.state == 'file' and item.path not in ['vars.yaml', 'vault.yaml'] diff --git a/roles/envs/templates/ex/foo.txt b/roles/envs/templates/ex/foo.txt deleted file mode 100644 index 78e5367..0000000 --- a/roles/envs/templates/ex/foo.txt +++ /dev/null @@ -1,3 +0,0 @@ -{{ ansible_managed | comment }} - -{{ env_vars.foo_secret }} diff --git a/roles/envs/templates/ex/vars.yaml b/roles/envs/templates/ex/vars.yaml deleted file mode 100644 index 2f762f9..0000000 --- a/roles/envs/templates/ex/vars.yaml +++ /dev/null @@ -1,4 +0,0 @@ -foo: yay -bar: baz - -foo_secret: "{{ vault_foo_secret }}" diff --git a/roles/envs/templates/ex/vault.yaml b/roles/envs/templates/ex/vault.yaml deleted file mode 100644 index ee287ba..0000000 --- a/roles/envs/templates/ex/vault.yaml +++ /dev/null @@ -1,6 +0,0 @@ -$ANSIBLE_VAULT;1.1;AES256 -65653230393063613534356561363233666539623666626262643166623864653630653130326264 -3437636533366331663366656361356438366438653961370a623465313736356335363562303961 -34363564363634663264386565333063303231313730363137393539303863626364623865613938 -3136373834303766330a666239343330626166633161356233366662376333373166623731626437 -62613735303063323932653831613139383238656363346331633766313432323861 diff --git a/roles/envs/templates/example/foo.txt b/roles/envs/templates/example/foo.txt new file mode 100644 index 0000000..cdf0f5a --- /dev/null +++ b/roles/envs/templates/example/foo.txt @@ -0,0 +1,4 @@ +{{ ansible_managed }} + +{{ env_vars.foo }} +{{ env_vars.some_secret }} diff --git a/roles/envs/templates/example/vars.yaml b/roles/envs/templates/example/vars.yaml new file mode 100644 index 0000000..8c5b36c --- /dev/null +++ b/roles/envs/templates/example/vars.yaml @@ -0,0 +1,4 @@ +# {{ ansible_managed }} +--- +foo: bar +some_secret: "{{ env_vault_vars.vault_some_secret }}" diff --git a/roles/envs/templates/example/vault.yaml b/roles/envs/templates/example/vault.yaml new file mode 100644 index 0000000..7a00904 --- /dev/null +++ b/roles/envs/templates/example/vault.yaml @@ -0,0 +1,6 @@ +$ANSIBLE_VAULT;1.1;AES256 +64373936396138633437363433636163363732383034656362643461363166393938313133386130 +6335666164366664623666363631336664363831653266620a393661636663643463666438633630 +34386365376538333430396231643037356366353337313031626661613563343634326330613863 +3137643432623437350a326261663331663563366363393531313938666435376162313032383433 +63316237373539396238323135366566303238336264306139323261663763653832 From d79c92e4759ea7169b7b0e5ab20dd2ac0ae6b0db Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 12 Sep 2024 09:32:23 +0100 Subject: [PATCH 4/7] remove unused hook --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a514fd0..0335329 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,6 @@ repos: - id: check-executables-have-shebangs - id: check-merge-conflict - id: check-shebang-scripts-are-executable - - id: check-xml - id: check-yaml - id: detect-private-key - id: end-of-file-fixer From 67bfd0d5c8b0c24f86a60d8f5f74b1ed4ae9be1a Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 12 Sep 2024 10:37:57 +0100 Subject: [PATCH 5/7] fail if no envs detected --- roles/envs/tasks/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/envs/tasks/main.yaml b/roles/envs/tasks/main.yaml index 56bbbb3..b0cdadc 100644 --- a/roles/envs/tasks/main.yaml +++ b/roles/envs/tasks/main.yaml @@ -12,6 +12,7 @@ file_type: directory depth: 1 register: env_names + failed_when: env_names.matched == 0 - name: Deploy envs ansible.builtin.include_tasks: deploy_env_dir.yaml From d74624f57235eff84f1e1e20526d57dc5f17ec15 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 12 Sep 2024 11:10:29 +0100 Subject: [PATCH 6/7] remove become's --- roles/bin/tasks/main.yaml | 2 -- roles/envs/tasks/main.yaml | 1 - roles/hicservices_rdmp/tasks/main.yaml | 2 -- roles/smi_cogstack_semehr/tasks/main.yaml | 3 --- roles/smi_ctp_anon_cli/tasks/main.yaml | 3 --- roles/smi_dicompixelanon/tasks/main.yaml | 3 --- roles/smi_isidentifiable/tasks/main.yaml | 2 -- roles/smi_root/tasks/main.yml | 3 --- roles/smi_smiservices/tasks/main.yaml | 2 -- roles/smi_structuredreports/tasks/main.yaml | 3 --- 10 files changed, 24 deletions(-) diff --git a/roles/bin/tasks/main.yaml b/roles/bin/tasks/main.yaml index 05b2300..ea36ac1 100644 --- a/roles/bin/tasks/main.yaml +++ b/roles/bin/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure bin dir exists - become: true ansible.builtin.file: name: "{{ bin_bin_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Template service scripts to bin - become: true ansible.builtin.template: src: "{{ item }}" dest: "{{ bin_bin_dir }}/" diff --git a/roles/envs/tasks/main.yaml b/roles/envs/tasks/main.yaml index b0cdadc..f9979e6 100644 --- a/roles/envs/tasks/main.yaml +++ b/roles/envs/tasks/main.yaml @@ -1,6 +1,5 @@ --- - name: Ensure envs dir exists - become: true ansible.builtin.file: name: "{{ envs_envs_dir }}" state: directory diff --git a/roles/hicservices_rdmp/tasks/main.yaml b/roles/hicservices_rdmp/tasks/main.yaml index 223f0b0..2886c52 100644 --- a/roles/hicservices_rdmp/tasks/main.yaml +++ b/roles/hicservices_rdmp/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure hicservices_rdmp_base_dir exists - become: true ansible.builtin.file: path: "{{ hicservices_rdmp_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Deploy rdmp-cli versions - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.script: cmd: | diff --git a/roles/smi_cogstack_semehr/tasks/main.yaml b/roles/smi_cogstack_semehr/tasks/main.yaml index dc0d698..818458e 100644 --- a/roles/smi_cogstack_semehr/tasks/main.yaml +++ b/roles/smi_cogstack_semehr/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure smi_cogstack_semehr_base_dir exists - become: true ansible.builtin.file: name: "{{ smi_cogstack_semehr_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Download archives - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.get_url: url: "{{ smi_cogstack_semehr_base_url }}/{{ item.commit_sha }}" @@ -17,7 +15,6 @@ with_items: "{{ smi_cogstack_semehr_tarballs }}" - name: Unpack archives - become: true ansible.builtin.unarchive: src: "{{ smi_cogstack_semehr_base_dir }}/{{ item.commit_sha }}.tgz" dest: "{{ smi_cogstack_semehr_base_dir }}" diff --git a/roles/smi_ctp_anon_cli/tasks/main.yaml b/roles/smi_ctp_anon_cli/tasks/main.yaml index eb722b8..67375de 100644 --- a/roles/smi_ctp_anon_cli/tasks/main.yaml +++ b/roles/smi_ctp_anon_cli/tasks/main.yaml @@ -1,20 +1,17 @@ --- - name: Ensure smi_ctp_anon_cli_base_dir exists - become: true ansible.builtin.file: name: "{{ smi_ctp_anon_cli_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Ensure version dir exists - become: true ansible.builtin.file: name: "{{ smi_ctp_anon_cli_base_dir }}/v{{ smi_ctp_anon_cli_version }}" state: directory mode: u=rwx,g=rx,o=rx - name: Download jar - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.get_url: url: "{{ smi_ctp_anon_cli_base_url }}/v{{ smi_ctp_anon_cli_version }}/ctp-anon-cli-{{ smi_ctp_anon_cli_version }}.jar" diff --git a/roles/smi_dicompixelanon/tasks/main.yaml b/roles/smi_dicompixelanon/tasks/main.yaml index c2db0d0..ea673f4 100644 --- a/roles/smi_dicompixelanon/tasks/main.yaml +++ b/roles/smi_dicompixelanon/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure smi_dicompixelanon_base_dir exists - become: true ansible.builtin.file: name: "{{ smi_dicompixelanon_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Download archives - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.get_url: url: "{{ smi_dicompixelanon_base_url }}/{{ item.commit_sha }}" @@ -17,7 +15,6 @@ with_items: "{{ smi_dicompixelanon_tarballs }}" - name: Unpack archives - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.unarchive: src: "{{ smi_dicompixelanon_base_dir }}/{{ item.commit_sha }}.tgz" diff --git a/roles/smi_isidentifiable/tasks/main.yaml b/roles/smi_isidentifiable/tasks/main.yaml index d4ddac9..ce07678 100644 --- a/roles/smi_isidentifiable/tasks/main.yaml +++ b/roles/smi_isidentifiable/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure smi_isidentifiable_base_dir exists - become: true ansible.builtin.file: path: "{{ smi_isidentifiable_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Deploy IsIdentifiable versions - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.script: cmd: | diff --git a/roles/smi_root/tasks/main.yml b/roles/smi_root/tasks/main.yml index 82cb41e..04e9741 100644 --- a/roles/smi_root/tasks/main.yml +++ b/roles/smi_root/tasks/main.yml @@ -1,15 +1,12 @@ --- - name: Ensure smi_root_smi_root_dir exists - become: true ansible.builtin.file: name: "{{ smi_root_smi_root_dir }}" state: directory - owner: "{{ ansible_become_user | default('root') }}" group: "{{ smi_root_smi_group }}" mode: u=rwx,g=rx,o=rx - name: Template README.md - become: true ansible.builtin.template: src: root_readme.md dest: "{{ smi_root_smi_root_dir }}/README.md" diff --git a/roles/smi_smiservices/tasks/main.yaml b/roles/smi_smiservices/tasks/main.yaml index 9274e58..388e7dc 100644 --- a/roles/smi_smiservices/tasks/main.yaml +++ b/roles/smi_smiservices/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure smi_smiservices_base_dir exists - become: true ansible.builtin.file: name: "{{ smi_smiservices_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Deploy SmiServices versions - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.script: cmd: | diff --git a/roles/smi_structuredreports/tasks/main.yaml b/roles/smi_structuredreports/tasks/main.yaml index af69443..2935d81 100644 --- a/roles/smi_structuredreports/tasks/main.yaml +++ b/roles/smi_structuredreports/tasks/main.yaml @@ -1,13 +1,11 @@ --- - name: Ensure smi_structuredreports_base_dir exists - become: true ansible.builtin.file: name: "{{ smi_structuredreports_base_dir }}" state: directory mode: u=rwx,g=rx,o=rx - name: Download archives - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.get_url: url: "{{ smi_structuredreports_base_url }}/{{ item.commit_sha }}" @@ -17,7 +15,6 @@ with_items: "{{ smi_structuredreports_tarballs }}" - name: Unpack archives - become: true environment: "{{ proxy_env | default({}) }}" ansible.builtin.unarchive: src: "{{ smi_structuredreports_base_dir }}/{{ item.commit_sha }}.tgz" From f2347dcfe1e21c08a8285538dac372c601ece67c Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 12 Sep 2024 11:13:43 +0100 Subject: [PATCH 7/7] register env names from localhost --- roles/envs/tasks/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/envs/tasks/main.yaml b/roles/envs/tasks/main.yaml index f9979e6..a2be302 100644 --- a/roles/envs/tasks/main.yaml +++ b/roles/envs/tasks/main.yaml @@ -6,6 +6,7 @@ mode: u=rwx,g=rx,o=rx - name: Register env names + delegate_to: localhost ansible.builtin.find: paths: "{{ envs_template_dir }}" file_type: directory