From 60386bc9286275b964ac51990d4706dbbf0e255a Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Fri, 5 Aug 2022 10:45:15 -0400 Subject: [PATCH] Organize installer templates into subdirectories --- .../tasks/admin_password_configuration.yml | 2 +- .../tasks/broadcast_websocket_configuration.yml | 2 +- roles/installer/tasks/database_configuration.yml | 6 +++--- roles/installer/tasks/resources_configuration.yml | 14 +++++++------- roles/installer/tasks/secret_key_configuration.yml | 2 +- roles/installer/tasks/upgrade_postgres.yml | 4 ++-- .../templates/{ => configmaps}/config.yaml.j2 | 0 .../templates/{ => deployments}/deployment.yaml.j2 | 0 .../templates/{ => networking}/ingress.yaml.j2 | 0 .../templates/{ => networking}/service.yaml.j2 | 0 .../templates/{ => rbac}/service_account.yaml.j2 | 0 .../{ => secrets}/admin_password_secret.yaml.j2 | 0 .../{ => secrets}/app_credentials.yaml.j2 | 6 +++--- .../broadcast_websocket_secret.yaml.j2 | 0 .../{ => secrets}/postgres_secret.yaml.j2 | 0 .../{ => secrets}/postgres_upgrade_secret.yaml.j2 | 0 .../templates/{ => secrets}/secret_key.yaml.j2 | 0 .../templates/{ => settings}/credentials.py.j2 | 0 .../{ => settings}/execution_environments.py.j2 | 0 .../installer/templates/{ => settings}/ldap.py.j2 | 0 .../templates/{ => statefulsets}/postgres.yaml.j2 | 0 .../templates/{ => storage}/persistent.yaml.j2 | 0 22 files changed, 18 insertions(+), 18 deletions(-) rename roles/installer/templates/{ => configmaps}/config.yaml.j2 (100%) rename roles/installer/templates/{ => deployments}/deployment.yaml.j2 (100%) rename roles/installer/templates/{ => networking}/ingress.yaml.j2 (100%) rename roles/installer/templates/{ => networking}/service.yaml.j2 (100%) rename roles/installer/templates/{ => rbac}/service_account.yaml.j2 (100%) rename roles/installer/templates/{ => secrets}/admin_password_secret.yaml.j2 (100%) rename roles/installer/templates/{ => secrets}/app_credentials.yaml.j2 (66%) rename roles/installer/templates/{ => secrets}/broadcast_websocket_secret.yaml.j2 (100%) rename roles/installer/templates/{ => secrets}/postgres_secret.yaml.j2 (100%) rename roles/installer/templates/{ => secrets}/postgres_upgrade_secret.yaml.j2 (100%) rename roles/installer/templates/{ => secrets}/secret_key.yaml.j2 (100%) rename roles/installer/templates/{ => settings}/credentials.py.j2 (100%) rename roles/installer/templates/{ => settings}/execution_environments.py.j2 (100%) rename roles/installer/templates/{ => settings}/ldap.py.j2 (100%) rename roles/installer/templates/{ => statefulsets}/postgres.yaml.j2 (100%) rename roles/installer/templates/{ => storage}/persistent.yaml.j2 (100%) diff --git a/roles/installer/tasks/admin_password_configuration.yml b/roles/installer/tasks/admin_password_configuration.yml index 00214e60..edba5639 100644 --- a/roles/installer/tasks/admin_password_configuration.yml +++ b/roles/installer/tasks/admin_password_configuration.yml @@ -25,7 +25,7 @@ - name: Create admin password secret k8s: apply: true - definition: "{{ lookup('template', 'admin_password_secret.yaml.j2') }}" + definition: "{{ lookup('template', 'secrets/admin_password_secret.yaml.j2') }}" no_log: "{{ no_log }}" - name: Read admin password secret diff --git a/roles/installer/tasks/broadcast_websocket_configuration.yml b/roles/installer/tasks/broadcast_websocket_configuration.yml index 90da32aa..f5ed202d 100644 --- a/roles/installer/tasks/broadcast_websocket_configuration.yml +++ b/roles/installer/tasks/broadcast_websocket_configuration.yml @@ -26,7 +26,7 @@ - name: Create broadcast websocket secret k8s: apply: true - definition: "{{ lookup('template', 'broadcast_websocket_secret.yaml.j2') }}" + definition: "{{ lookup('template', 'secrets/broadcast_websocket_secret.yaml.j2') }}" no_log: "{{ no_log }}" - name: Read broadcast websocket secret diff --git a/roles/installer/tasks/database_configuration.yml b/roles/installer/tasks/database_configuration.yml index 9847aa40..66a6d7d7 100644 --- a/roles/installer/tasks/database_configuration.yml +++ b/roles/installer/tasks/database_configuration.yml @@ -71,7 +71,7 @@ - name: Create Database configuration k8s: apply: true - definition: "{{ lookup('template', 'postgres_secret.yaml.j2') }}" + definition: "{{ lookup('template', 'secrets/postgres_secret.yaml.j2') }}" no_log: "{{ no_log }}" - name: Read Database Configuration @@ -152,7 +152,7 @@ - name: Create Database if no database is specified k8s: apply: true - definition: "{{ lookup('template', 'postgres.yaml.j2') }}" + definition: "{{ lookup('template', 'statefulsets/postgres.yaml.j2') }}" register: create_statefulset_result - name: Scale down Deployment for migration @@ -185,7 +185,7 @@ - name: Recreate PostgreSQL statefulset with updated values k8s: apply: true - definition: "{{ lookup('template', 'postgres.yaml.j2') }}" + definition: "{{ lookup('template', 'statefulsets/postgres.yaml.j2') }}" when: managed_database - name: Set Default label selector for custom resource generated postgres diff --git a/roles/installer/tasks/resources_configuration.yml b/roles/installer/tasks/resources_configuration.yml index 0ce935e3..a24b8d6e 100644 --- a/roles/installer/tasks/resources_configuration.yml +++ b/roles/installer/tasks/resources_configuration.yml @@ -34,12 +34,12 @@ wait: yes register: tower_resources_result loop: - - 'config' - - 'app_credentials' - - 'service_account' - - 'persistent' - - 'service' - - 'ingress' + - 'configmaps/config' + - 'secrets/app_credentials' + - 'rbac/service_account' + - 'storage/persistent' + - 'networking/service' + - 'networking/ingress' no_log: "{{ no_log }}" - name: Set default awx app image @@ -75,7 +75,7 @@ - name: Apply deployment resources k8s: apply: yes - definition: "{{ lookup('template', 'deployment.yaml.j2') }}" + definition: "{{ lookup('template', 'deployments/deployment.yaml.j2') }}" wait: yes register: this_deployment_result diff --git a/roles/installer/tasks/secret_key_configuration.yml b/roles/installer/tasks/secret_key_configuration.yml index 9c8a3cab..00b64255 100644 --- a/roles/installer/tasks/secret_key_configuration.yml +++ b/roles/installer/tasks/secret_key_configuration.yml @@ -25,7 +25,7 @@ - name: Create secret key secret k8s: apply: true - definition: "{{ lookup('template', 'secret_key.yaml.j2') }}" + definition: "{{ lookup('template', 'secrets/secret_key.yaml.j2') }}" no_log: "{{ no_log }}" - name: Read secret key secret diff --git a/roles/installer/tasks/upgrade_postgres.yml b/roles/installer/tasks/upgrade_postgres.yml index edcc3d01..8d6a8431 100644 --- a/roles/installer/tasks/upgrade_postgres.yml +++ b/roles/installer/tasks/upgrade_postgres.yml @@ -22,7 +22,7 @@ - name: Create Database configuration with new -postgres-{{ supported_pg_version }} hostname k8s: apply: true - definition: "{{ lookup('template', 'postgres_upgrade_secret.yaml.j2') }}" + definition: "{{ lookup('template', 'secrets/postgres_upgrade_secret.yaml.j2') }}" no_log: "{{ no_log }}" - name: Set new database var to be used when configuring app credentials (resources_configuration.yml) @@ -33,7 +33,7 @@ - name: Create Database if no database is specified k8s: apply: true - definition: "{{ lookup('template', 'postgres.yaml.j2') }}" + definition: "{{ lookup('template', 'statefulsets/postgres.yaml.j2') }}" wait: true register: create_statefulset_result diff --git a/roles/installer/templates/config.yaml.j2 b/roles/installer/templates/configmaps/config.yaml.j2 similarity index 100% rename from roles/installer/templates/config.yaml.j2 rename to roles/installer/templates/configmaps/config.yaml.j2 diff --git a/roles/installer/templates/deployment.yaml.j2 b/roles/installer/templates/deployments/deployment.yaml.j2 similarity index 100% rename from roles/installer/templates/deployment.yaml.j2 rename to roles/installer/templates/deployments/deployment.yaml.j2 diff --git a/roles/installer/templates/ingress.yaml.j2 b/roles/installer/templates/networking/ingress.yaml.j2 similarity index 100% rename from roles/installer/templates/ingress.yaml.j2 rename to roles/installer/templates/networking/ingress.yaml.j2 diff --git a/roles/installer/templates/service.yaml.j2 b/roles/installer/templates/networking/service.yaml.j2 similarity index 100% rename from roles/installer/templates/service.yaml.j2 rename to roles/installer/templates/networking/service.yaml.j2 diff --git a/roles/installer/templates/service_account.yaml.j2 b/roles/installer/templates/rbac/service_account.yaml.j2 similarity index 100% rename from roles/installer/templates/service_account.yaml.j2 rename to roles/installer/templates/rbac/service_account.yaml.j2 diff --git a/roles/installer/templates/admin_password_secret.yaml.j2 b/roles/installer/templates/secrets/admin_password_secret.yaml.j2 similarity index 100% rename from roles/installer/templates/admin_password_secret.yaml.j2 rename to roles/installer/templates/secrets/admin_password_secret.yaml.j2 diff --git a/roles/installer/templates/app_credentials.yaml.j2 b/roles/installer/templates/secrets/app_credentials.yaml.j2 similarity index 66% rename from roles/installer/templates/app_credentials.yaml.j2 rename to roles/installer/templates/secrets/app_credentials.yaml.j2 index 9776b879..47438d11 100644 --- a/roles/installer/templates/app_credentials.yaml.j2 +++ b/roles/installer/templates/secrets/app_credentials.yaml.j2 @@ -12,6 +12,6 @@ metadata: app.kubernetes.io/component: '{{ deployment_type }}' app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}' data: - credentials.py: "{{ lookup('template', 'credentials.py.j2') | b64encode }}" - ldap.py: "{{ lookup('template', 'ldap.py.j2') | b64encode }}" - execution_environments.py: "{{ lookup('template', 'execution_environments.py.j2') | b64encode }}" + credentials.py: "{{ lookup('template', 'settings/credentials.py.j2') | b64encode }}" + ldap.py: "{{ lookup('template', 'settings/ldap.py.j2') | b64encode }}" + execution_environments.py: "{{ lookup('template', 'settings/execution_environments.py.j2') | b64encode }}" diff --git a/roles/installer/templates/broadcast_websocket_secret.yaml.j2 b/roles/installer/templates/secrets/broadcast_websocket_secret.yaml.j2 similarity index 100% rename from roles/installer/templates/broadcast_websocket_secret.yaml.j2 rename to roles/installer/templates/secrets/broadcast_websocket_secret.yaml.j2 diff --git a/roles/installer/templates/postgres_secret.yaml.j2 b/roles/installer/templates/secrets/postgres_secret.yaml.j2 similarity index 100% rename from roles/installer/templates/postgres_secret.yaml.j2 rename to roles/installer/templates/secrets/postgres_secret.yaml.j2 diff --git a/roles/installer/templates/postgres_upgrade_secret.yaml.j2 b/roles/installer/templates/secrets/postgres_upgrade_secret.yaml.j2 similarity index 100% rename from roles/installer/templates/postgres_upgrade_secret.yaml.j2 rename to roles/installer/templates/secrets/postgres_upgrade_secret.yaml.j2 diff --git a/roles/installer/templates/secret_key.yaml.j2 b/roles/installer/templates/secrets/secret_key.yaml.j2 similarity index 100% rename from roles/installer/templates/secret_key.yaml.j2 rename to roles/installer/templates/secrets/secret_key.yaml.j2 diff --git a/roles/installer/templates/credentials.py.j2 b/roles/installer/templates/settings/credentials.py.j2 similarity index 100% rename from roles/installer/templates/credentials.py.j2 rename to roles/installer/templates/settings/credentials.py.j2 diff --git a/roles/installer/templates/execution_environments.py.j2 b/roles/installer/templates/settings/execution_environments.py.j2 similarity index 100% rename from roles/installer/templates/execution_environments.py.j2 rename to roles/installer/templates/settings/execution_environments.py.j2 diff --git a/roles/installer/templates/ldap.py.j2 b/roles/installer/templates/settings/ldap.py.j2 similarity index 100% rename from roles/installer/templates/ldap.py.j2 rename to roles/installer/templates/settings/ldap.py.j2 diff --git a/roles/installer/templates/postgres.yaml.j2 b/roles/installer/templates/statefulsets/postgres.yaml.j2 similarity index 100% rename from roles/installer/templates/postgres.yaml.j2 rename to roles/installer/templates/statefulsets/postgres.yaml.j2 diff --git a/roles/installer/templates/persistent.yaml.j2 b/roles/installer/templates/storage/persistent.yaml.j2 similarity index 100% rename from roles/installer/templates/persistent.yaml.j2 rename to roles/installer/templates/storage/persistent.yaml.j2