From 0038ad9443376f4a06596bd4a8f826707f355109 Mon Sep 17 00:00:00 2001 From: jiaychen Date: Thu, 18 Jul 2024 16:30:51 +0200 Subject: [PATCH] feat: use global var and remove group facts --- roles/satellite/tasks/define.yml | 10 +-- .../activationkey-hostgroup-definition.yml | 60 +++++++------- .../activationkey-hostgroups-deprovision.yml | 61 +++++++------- .../tasks/internals/facts-gathering.yml | 80 ++----------------- .../lifecycleenvironment-definition.yml | 14 ++-- .../lifecycleenvironment-deprovision.yml | 8 +- roles/satellite/tasks/update-prod.yml | 6 +- roles/satellite/tasks/update-test.yml | 4 +- 8 files changed, 87 insertions(+), 156 deletions(-) diff --git a/roles/satellite/tasks/define.yml b/roles/satellite/tasks/define.yml index 14e94f7..586b609 100644 --- a/roles/satellite/tasks/define.yml +++ b/roles/satellite/tasks/define.yml @@ -30,17 +30,17 @@ - include_tasks: file: internals/contentview-promote.yml vars: - target_lce_name: "{{ g_test_lifecycleenvironment }}" + target_lce_name: "{{ test_lifecycleenvironment }}" source_lce_name: Library - when: g_test_lifecycleenvironment_defined + when: test_lifecycleenvironment_defined # promote contentview from test->prod - include_tasks: file: internals/contentview-promote.yml vars: - target_lce_name: "{{ g_prod_lifecycleenvironment }}" - source_lce_name: "{{ g_test_lifecycleenvironment }}" - when: g_test_lifecycleenvironment_defined and g_prod_lifecycleenvironment_defined + target_lce_name: "{{ prod_lifecycleenvironment }}" + source_lce_name: "{{ test_lifecycleenvironment }}" + when: test_lifecycleenvironment_defined and prod_lifecycleenvironment_defined - include_tasks: file: internals/activationkey-hostgroup-definition.yml diff --git a/roles/satellite/tasks/internals/activationkey-hostgroup-definition.yml b/roles/satellite/tasks/internals/activationkey-hostgroup-definition.yml index df97808..48686e0 100644 --- a/roles/satellite/tasks/internals/activationkey-hostgroup-definition.yml +++ b/roles/satellite/tasks/internals/activationkey-hostgroup-definition.yml @@ -4,14 +4,14 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_test_activationkey }}" + name: "{{ test_activationkey }}" content_view: "{{ deploymentcontentview }}" - lifecycle_environment: "{{ g_test_lifecycleenvironment }}" + lifecycle_environment: "{{ test_lifecycleenvironment }}" subscriptions: "{{ subscriptions | default(omit) }}" content_overrides: "{{ contentoverrides | default(omit) }}" auto_attach: True organization: "{{ satellite_organization }}" - when: g_test_lifecycleenvironment_defined and g_test_activationkey_defined + when: test_lifecycleenvironment_defined and test_activationkey_defined - name: "Define hostgroup for test" theforeman.foreman.hostgroup: @@ -20,25 +20,25 @@ server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_test_hostgroup }}" + name: "{{ test_hostgroup }}" organization: "{{ satellite_organization }}" organizations: - "{{ satellite_organization }}" - domain: "{{ hostvars[groups['test'][0]]['domain'] if g_test_domain_is_groupvar else test_domain | default(omit) }}" - architecture: "{{ hostvars[groups['test'][0]]['architecture'] if g_test_architecture_is_groupvar else test_architecture | default(omit) }}" - ptable: "{{ hostvars[groups['test'][0]]['partition_table'] if g_test_partition_table_is_groupvar else test_partition_table | default(omit) }}" - operatingsystem: "{{ hostvars[groups['test'][0]]['operatingsystem'] if g_test_operatingsystem_is_groupvar else test_operatingsystem | default(omit) }}" - medium: "{{ hostvars[groups['test'][0]]['provision_installation_media'] if g_test_medium_is_groupvar else test_provision_installation_media | default(omit) }}" - content_source: "{{ hostvars[groups['test'][0]]['foreman_capsule'] if g_test_foreman_capsule_is_groupvar else test_foreman_capsule | default(omit) }}" - lifecycle_environment: "{{ g_test_lifecycleenvironment }}" - parent: "{{ hostvars[groups['test'][0]]['hostgroup_parent'] if g_test_hostgroup_parent_is_groupvar else test_hostgroup_parent | default(omit) }}" - pxe_loader: "{{ hostvars[groups['test'][0]]['pxe_loader'] if g_test_pxe_loader_is_groupvar else test_pxe_loader | default(omit) }}" + domain: "{{ test_domain | default(omit) }}" + architecture: "{{ test_architecture | default(omit) }}" + ptable: "{{ test_partition_table | default(omit) }}" + operatingsystem: "{{ test_operatingsystem | default(omit) }}" + medium: "{{ test_provision_installation_media | default(omit) }}" + content_source: "{{ test_foreman_capsule | default(omit) }}" + lifecycle_environment: "{{ test_lifecycleenvironment }}" + parent: "{{ test_hostgroup_parent | default(omit) }}" + pxe_loader: "{{ test_pxe_loader | default(omit) }}" locations: "{{ locations.keys() | list }}" parameters: - name: "kt_activation_keys" - value: "{{ g_test_activationkey }}" + value: "{{ test_activationkey }}" content_view: "{{ deploymentcontentview }}" - when: g_test_lifecycleenvironment_defined and g_test_activationkey_defined and g_test_hostgroup_defined + when: test_lifecycleenvironment_defined and test_activationkey_defined and test_hostgroup_defined - name: "Define Activation Key for production" theforeman.foreman.activation_key: @@ -46,14 +46,14 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_prod_activationkey }}" + name: "{{ prod_activationkey }}" content_view: "{{ deploymentcontentview }}" - lifecycle_environment: "{{ g_prod_lifecycleenvironment }}" + lifecycle_environment: "{{ prod_lifecycleenvironment }}" subscriptions: "{{ subscriptions | default(omit) }}" content_overrides: "{{ contentoverrides | default(omit) }}" auto_attach: True organization: "{{ satellite_organization }}" - when: g_prod_lifecycleenvironment_defined and g_prod_activationkey_defined + when: prod_lifecycleenvironment_defined and prod_activationkey_defined - name: "Define hostgroup for production" theforeman.foreman.hostgroup: @@ -62,22 +62,22 @@ server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_prod_hostgroup }}" + name: "{{ prod_hostgroup }}" organization: "{{ satellite_organization }}" organizations: - "{{ satellite_organization }}" - domain: "{{ hostvars[groups['prod'][0]]['domain'] if g_prod_domain_is_groupvar else prod_domain | default(omit) }}" - architecture: "{{ hostvars[groups['prod'][0]]['architecture'] if g_prod_architecture_is_groupvar else prod_architecture | default(omit) }}" - ptable: "{{ hostvars[groups['prod'][0]]['partition_table'] if g_prod_partition_table_is_groupvar else prod_partition_table | default(omit) }}" - operatingsystem: "{{ hostvars[groups['prod'][0]]['operatingsystem'] if g_prod_operatingsystem_is_groupvar else prod_operatingsystem | default(omit) }}" - medium: "{{ hostvars[groups['prod'][0]]['provision_installation_media'] if g_prod_medium_is_groupvar else prod_provision_installation_media | default(omit) }}" - content_source: "{{ hostvars[groups['prod'][0]]['foreman_capsule'] if g_prod_foreman_capsule_is_groupvar else prod_foreman_capsule | default(omit) }}" - lifecycle_environment: "{{ g_prod_lifecycleenvironment }}" - parent: "{{ hostvars[groups['prod'][0]]['hostgroup_parent'] if g_prod_hostgroup_parent_is_groupvar else prod_hostgroup_parent | default(omit) }}" - pxe_loader: "{{ hostvars[groups['prod'][0]]['pxe_loader'] if g_prod_pxe_loader_is_groupvar else prod_pxe_loader | default(omit) }}" + domain: "{{ prod_domain | default(omit) }}" + architecture: "{{ prod_architecture | default(omit) }}" + ptable: "{{ prod_partition_table | default(omit) }}" + operatingsystem: "{{ prod_operatingsystem | default(omit) }}" + medium: "{{ prod_provision_installation_media | default(omit) }}" + content_source: "{{ prod_foreman_capsule | default(omit) }}" + lifecycle_environment: "{{ prod_lifecycleenvironment }}" + parent: "{{ prod_hostgroup_parent | default(omit) }}" + pxe_loader: "{{ prod_pxe_loader | default(omit) }}" locations: "{{ locations.keys() | list }}" parameters: - name: "kt_activation_keys" - value: "{{ g_prod_activationkey }}" + value: "{{ prod_activationkey }}" content_view: "{{ deploymentcontentview }}" - when: g_prod_lifecycleenvironment_defined and g_prod_activationkey_defined and g_prod_hostgroup_defined + when: prod_lifecycleenvironment_defined and prod_activationkey_defined and prod_hostgroup_defined diff --git a/roles/satellite/tasks/internals/activationkey-hostgroups-deprovision.yml b/roles/satellite/tasks/internals/activationkey-hostgroups-deprovision.yml index 559acf7..1967ce6 100644 --- a/roles/satellite/tasks/internals/activationkey-hostgroups-deprovision.yml +++ b/roles/satellite/tasks/internals/activationkey-hostgroups-deprovision.yml @@ -5,26 +5,26 @@ server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_prod_hostgroup }}" + name: "{{ prod_hostgroup }}" organization: "{{ satellite_organization }}" organizations: - "{{ satellite_organization }}" - domain: "{{ hostvars[groups['prod'][0]]['domain'] if g_prod_domain_is_groupvar else prod_domain | default(omit) }}" - architecture: "{{ hostvars[groups['prod'][0]]['architecture'] if g_prod_architecture_is_groupvar else prod_architecture | default(omit) }}" - ptable: "{{ hostvars[groups['prod'][0]]['partition_table'] if g_prod_partition_table_is_groupvar else prod_partition_table | default(omit) }}" - operatingsystem: "{{ hostvars[groups['prod'][0]]['operatingsystem'] if g_prod_operatingsystem_is_groupvar else prod_operatingsystem | default(omit) }}" - medium: "{{ hostvars[groups['prod'][0]]['provision_installation_media'] if g_prod_medium_is_groupvar else prod_provision_installation_media | default(omit) }}" - content_source: "{{ hostvars[groups['prod'][0]]['foreman_capsule'] if g_prod_foreman_capsule_is_groupvar else prod_foreman_capsule | default(omit) }}" - lifecycle_environment: "{{ g_prod_lifecycleenvironment }}" - parent: "{{ hostvars[groups['prod'][0]]['hostgroup_parent'] if g_prod_hostgroup_parent_is_groupvar else prod_hostgroup_parent | default(omit) }}" - pxe_loader: "{{ hostvars[groups['prod'][0]]['pxe_loader'] if g_prod_pxe_loader_is_groupvar else prod_pxe_loader | default(omit) }}" + domain: "{{ prod_domain | default(omit) }}" + architecture: "{{ prod_architecture | default(omit) }}" + ptable: "{{ prod_partition_table | default(omit) }}" + operatingsystem: "{{ prod_operatingsystem | default(omit) }}" + medium: "{{ prod_provision_installation_media | default(omit) }}" + content_source: "{{ prod_foreman_capsule | default(omit) }}" + lifecycle_environment: "{{ prod_lifecycleenvironment }}" + parent: "{{ prod_hostgroup_parent | default(omit) }}" + pxe_loader: "{{ prod_pxe_loader | default(omit) }}" locations: "{{ locations.keys() | list }}" parameters: - name: "kt_activation_keys" - value: "{{ g_prod_activationkey }}" + value: "{{ prod_activationkey }}" content_view: "{{ deploymentcontentview }}" state: absent - when: g_prod_lifecycleenvironment_defined and g_prod_activationkey_defined and g_prod_activationkey_defined + when: prod_lifecycleenvironment_defined and prod_activationkey_defined and prod_activationkey_defined ignore_errors: yes - name: "Deprovision Activation Key for production" @@ -33,16 +33,16 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_prod_activationkey }}" + name: "{{ prod_activationkey }}" content_view: "{{ deploymentcontentview }}" - lifecycle_environment: "{{ g_prod_lifecycleenvironment }}" + lifecycle_environment: "{{ prod_lifecycleenvironment }}" subscriptions: "{{ subscriptions | default(omit) }}" content_overrides: "{{ contentoverrides | default(omit) }}" auto_attach: True organization: "{{ satellite_organization }}" state: absent ignore_errors: yes - when: g_prod_lifecycleenvironment_defined and g_prod_activationkey_defined + when: prod_lifecycleenvironment_defined and prod_activationkey_defined - name: "Deprovision hostgroup for test" theforeman.foreman.hostgroup: @@ -50,27 +50,26 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - - name: "{{ g_test_hostgroup }}" + name: "{{ test_hostgroup }}" organization: "{{ satellite_organization }}" organizations: - "{{ satellite_organization }}" - domain: "{{ hostvars[groups['test'][0]]['domain'] if g_test_domain_is_groupvar else test_domain | default(omit) }}" - architecture: "{{ hostvars[groups['test'][0]]['architecture'] if g_test_architecture_is_groupvar else test_architecture | default(omit) }}" - ptable: "{{ hostvars[groups['test'][0]]['partition_table'] if g_test_partition_table_is_groupvar else test_partition_table | default(omit) }}" - operatingsystem: "{{ hostvars[groups['test'][0]]['operatingsystem'] if g_test_operatingsystem_is_groupvar else test_operatingsystem | default(omit) }}" - medium: "{{ hostvars[groups['test'][0]]['provision_installation_media'] if g_test_medium_is_groupvar else test_provision_installation_media | default(omit) }}" - content_source: "{{ hostvars[groups['test'][0]]['foreman_capsule'] if g_test_foreman_capsule_is_groupvar else test_foreman_capsule | default(omit) }}" - lifecycle_environment: "{{ g_test_lifecycleenvironment }}" - parent: "{{ hostvars[groups['test'][0]]['hostgroup_parent'] if g_test_hostgroup_parent_is_groupvar else test_hostgroup_parent | default(omit) }}" - pxe_loader: "{{ hostvars[groups['test'][0]]['pxe_loader'] if g_test_pxe_loader_is_groupvar else test_pxe_loader | default(omit) }}" + domain: "{{ test_domain | default(omit) }}" + architecture: "{{ test_architecture | default(omit) }}" + ptable: "{{ test_partition_table | default(omit) }}" + operatingsystem: "{{ test_operatingsystem | default(omit) }}" + medium: "{{ test_provision_installation_media | default(omit) }}" + content_source: "{{ test_foreman_capsule | default(omit) }}" + lifecycle_environment: "{{ test_lifecycleenvironment }}" + parent: "{{ test_hostgroup_parent | default(omit) }}" + pxe_loader: "{{ test_pxe_loader | default(omit) }}" locations: "{{ locations.keys() | list }}" parameters: - name: "kt_activation_keys" - value: "{{ g_test_activationkey }}" + value: "{{ test_activationkey }}" content_view: "{{ deploymentcontentview }}" state: absent - when: g_test_lifecycleenvironment_defined and g_test_activationkey_defined and g_test_hostgroup_defined + when: test_lifecycleenvironment_defined and test_activationkey_defined and test_hostgroup_defined ignore_errors: yes - name: "Delete Activation Key for test" @@ -79,13 +78,13 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_test_activationkey }}" + name: "{{ test_activationkey }}" content_view: "{{ deploymentcontentview }}" - lifecycle_environment: "{{ g_test_lifecycleenvironment }}" + lifecycle_environment: "{{ test_lifecycleenvironment }}" subscriptions: "{{ subscriptions | default(omit) }}" content_overrides: "{{ contentoverrides | default(omit) }}" auto_attach: True organization: "{{ satellite_organization }}" state: absent ignore_errors: yes - when: g_test_lifecycleenvironment_defined and g_test_activationkey_defined + when: test_lifecycleenvironment_defined and test_activationkey_defined diff --git a/roles/satellite/tasks/internals/facts-gathering.yml b/roles/satellite/tasks/internals/facts-gathering.yml index 2dfab81..53fabd8 100644 --- a/roles/satellite/tasks/internals/facts-gathering.yml +++ b/roles/satellite/tasks/internals/facts-gathering.yml @@ -2,79 +2,11 @@ - name: Collect facts about Activation Keys / Hostgroups / LifeCycle Environments block: - set_fact: - g_test_lifecycleenvironment_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ('lifecycleenvironment' in hostvars[groups['test'][0]]) }}" - g_prod_lifecycleenvironment_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ('lifecycleenvironment' in hostvars[groups['prod'][0]]) }}" + test_lifecycleenvironment_defined: "{{ test_lifecycleenvironment is defined and deploymentcontentview is defined }}" + prod_lifecycleenvironment_defined: "{{ prod_lifecycleenvironment is defined and deploymentcontentview is defined }}" - g_test_activationkey_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ('activationkey' in hostvars[groups['test'][0]]) }}" - g_prod_activationkey_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ('activationkey' in hostvars[groups['prod'][0]]) }}" + test_activationkey_defined: "{{ test_activationkey is defined }}" + prod_activationkey_defined: "{{ prod_activationkey is defined }}" - g_test_hostgroup_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ('hostgroup' in hostvars[groups['test'][0]]) }}" - g_prod_hostgroup_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ('hostgroup' in hostvars[groups['prod'][0]]) }}" - - g_test_domain_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'domain' in hostvars[groups['test'][0]] ) }}" - g_prod_domain_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'domain' in hostvars[groups['prod'][0]] ) }}" - - g_test_architecture_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'architecture' in hostvars[groups['test'][0]] ) }}" - g_prod_architecture_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'architecture' in hostvars[groups['prod'][0]] ) }}" - - g_test_partition_table_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'partition_table' in hostvars[groups['test'][0]] ) }}" - g_prod_partition_table_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'partition_table' in hostvars[groups['prod'][0]] ) }}" - - g_test_operatingsystem_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'operatingsystem' in hostvars[groups['test'][0]] ) }}" - g_prod_operatingsystem_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'operatingsystem' in hostvars[groups['prod'][0]] ) }}" - - g_test_medium_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'medium' in hostvars[groups['test'][0]] ) }}" - g_prod_medium_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'medium' in hostvars[groups['prod'][0]] ) }}" - - g_test_foreman_capsule_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'foreman_capsule' in hostvars[groups['test'][0]] ) }}" - g_prod_foreman_capsule_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'foreman_capsule' in hostvars[groups['prod'][0]] ) }}" - - g_test_hostgroup_parent_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'hostgroup_parent' in hostvars[groups['test'][0]] ) }}" - g_prod_hostgroup_parent_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'hostgroup_parent' in hostvars[groups['prod'][0]] ) }}" - - g_test_pxe_loader_is_groupvar: "{{ (groups['test'] | default([]) | length>0) and ( 'pxe_loader' in hostvars[groups['test'][0]] ) }}" - g_prod_pxe_loader_is_groupvar: "{{ (groups['prod'] | default([]) | length>0) and ( 'pxe_loader' in hostvars[groups['prod'][0]] ) }}" - - - set_fact: - g_test_lifecycleenvironment_is_globalvar: "{{ test_lifecycleenvironment is defined }}" - g_prod_lifecycleenvironment_is_globalvar: "{{ prod_lifecycleenvironment is defined }}" - - g_test_activationkey_is_globalvar: "{{ test_activationkey is defined }}" - g_prod_activationkey_is_globalvar: "{{ prod_activationkey is defined }}" - - g_test_hostgroup_is_globalvar: "{{ test_hostgroup is defined }}" - g_prod_hostgroup_is_globalvar: "{{ prod_hostgroup is defined }}" - - - set_fact: - g_test_lifecycleenvironment_defined: "{{ ( g_test_lifecycleenvironment_is_groupvar or g_test_lifecycleenvironment_is_globalvar ) and deploymentcontentview is defined }}" - g_prod_lifecycleenvironment_defined: "{{ ( g_prod_lifecycleenvironment_is_groupvar or g_prod_lifecycleenvironment_is_globalvar ) and deploymentcontentview is defined }}" - - g_test_activationkey_defined: "{{ g_test_activationkey_is_groupvar or g_test_activationkey_is_globalvar }}" - g_prod_activationkey_defined: "{{ g_prod_activationkey_is_groupvar or g_prod_activationkey_is_globalvar }}" - - g_test_hostgroup_defined: "{{ g_test_hostgroup_is_groupvar or g_test_hostgroup_is_globalvar }}" - g_prod_hostgroup_defined: "{{ g_prod_hostgroup_is_groupvar or g_prod_hostgroup_is_globalvar }}" - - - set_fact: - g_test_lifecycleenvironment: "{{ hostvars[groups['test'][0]]['lifecycleenvironment'] if g_test_lifecycleenvironment_is_groupvar else test_lifecycleenvironment }}" - when: g_test_lifecycleenvironment_defined - - - set_fact: - g_prod_lifecycleenvironment: "{{ hostvars[groups['prod'][0]]['lifecycleenvironment'] if g_prod_lifecycleenvironment_is_groupvar else prod_lifecycleenvironment }}" - when: g_prod_lifecycleenvironment_defined - - - set_fact: - g_test_activationkey: "{{ hostvars[groups['test'][0]]['activationkey'] if g_test_activationkey_is_groupvar else test_activationkey }}" - when: g_test_activationkey_defined - - - set_fact: - g_prod_activationkey: "{{ hostvars[groups['prod'][0]]['activationkey'] if g_prod_activationkey_is_groupvar else prod_activationkey }}" - when: g_prod_activationkey_defined - - - set_fact: - g_test_hostgroup: "{{ hostvars[groups['test'][0]]['hostgroup'] if g_test_hostgroup_is_groupvar else test_hostgroup }}" - when: g_test_hostgroup_defined - - - set_fact: - g_prod_hostgroup: "{{ hostvars[groups['prod'][0]]['hostgroup'] if g_prod_hostgroup_is_groupvar else prod_hostgroup }}" - when: g_prod_hostgroup_defined + test_hostgroup_defined: "{{ test_hostgroup is defined }}" + prod_hostgroup_defined: "{{ prod_hostgroup is defined }}" diff --git a/roles/satellite/tasks/internals/lifecycleenvironment-definition.yml b/roles/satellite/tasks/internals/lifecycleenvironment-definition.yml index fc7ecc5..576cb37 100644 --- a/roles/satellite/tasks/internals/lifecycleenvironment-definition.yml +++ b/roles/satellite/tasks/internals/lifecycleenvironment-definition.yml @@ -4,11 +4,11 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_test_lifecycleenvironment }}" + name: "{{ test_lifecycleenvironment }}" prior: Library organization: "{{ satellite_organization }}" - label: "{{ g_test_lifecycleenvironment }}" - when: g_test_lifecycleenvironment_defined + label: "{{ test_lifecycleenvironment }}" + when: test_lifecycleenvironment_defined - name: 'Defining Lifecycle Environment for prod' theforeman.foreman.lifecycle_environment: @@ -16,8 +16,8 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_prod_lifecycleenvironment }}" - prior: "{{ g_test_lifecycleenvironment }}" + name: "{{ prod_lifecycleenvironment }}" + prior: "{{ test_lifecycleenvironment }}" organization: "{{ satellite_organization }}" - label: "{{ g_prod_lifecycleenvironment }}" - when: g_test_lifecycleenvironment_defined and g_prod_lifecycleenvironment_defined + label: "{{ prod_lifecycleenvironment }}" + when: test_lifecycleenvironment_defined and prod_lifecycleenvironment_defined diff --git a/roles/satellite/tasks/internals/lifecycleenvironment-deprovision.yml b/roles/satellite/tasks/internals/lifecycleenvironment-deprovision.yml index c2413c4..c5dbdec 100644 --- a/roles/satellite/tasks/internals/lifecycleenvironment-deprovision.yml +++ b/roles/satellite/tasks/internals/lifecycleenvironment-deprovision.yml @@ -4,11 +4,11 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_prod_lifecycleenvironment }}" + name: "{{ prod_lifecycleenvironment }}" organization: "{{ satellite_organization }}" state: "absent" ignore_errors: yes - when: g_test_lifecycleenvironment_defined and g_prod_lifecycleenvironment_defined + when: test_lifecycleenvironment_defined and prod_lifecycleenvironment_defined - name: 'Delete Lifecycle Environment for test' theforeman.foreman.lifecycle_environment: @@ -16,9 +16,9 @@ password: "{{ satellite_pwd }}" server_url: "{{ satellite_url }}" validate_certs: "{{ satellite_verify_ssl }}" - name: "{{ g_test_lifecycleenvironment }}" + name: "{{ test_lifecycleenvironment }}" organization: "{{ satellite_organization }}" state: "absent" ignore_errors: yes - when: g_test_lifecycleenvironment_defined + when: test_lifecycleenvironment_defined diff --git a/roles/satellite/tasks/update-prod.yml b/roles/satellite/tasks/update-prod.yml index e5b83ce..31d3661 100644 --- a/roles/satellite/tasks/update-prod.yml +++ b/roles/satellite/tasks/update-prod.yml @@ -6,9 +6,9 @@ - include_tasks: file: internals/contentview-promote.yml vars: - target_lce_name: "{{ g_prod_lifecycleenvironment }}" - source_lce_name: "{{ g_test_lifecycleenvironment }}" - when: g_test_lifecycleenvironment_defined and g_prod_lifecycleenvironment_defined + target_lce_name: "{{ prod_lifecycleenvironment }}" + source_lce_name: "{{ test_lifecycleenvironment }}" + when: test_lifecycleenvironment_defined and prod_lifecycleenvironment_defined - include_tasks: file: internals/wait-for-capsule-sync.yml diff --git a/roles/satellite/tasks/update-test.yml b/roles/satellite/tasks/update-test.yml index 14c05d8..9d20e0e 100644 --- a/roles/satellite/tasks/update-test.yml +++ b/roles/satellite/tasks/update-test.yml @@ -12,9 +12,9 @@ - include_tasks: file: internals/contentview-promote.yml vars: - target_lce_name: "{{ g_test_lifecycleenvironment }}" + target_lce_name: "{{ test_lifecycleenvironment }}" source_lce_name: Library - when: g_test_lifecycleenvironment_defined + when: test_lifecycleenvironment_defined - include_tasks: file: internals/wait-for-capsule-sync.yml