Skip to content

Commit 3b3eeba

Browse files
authored
Merge pull request #1131 from IBM/refactor
Refactor and CP4D 5.4.0 support
2 parents 95850ce + 013671d commit 3b3eeba

99 files changed

Lines changed: 613 additions & 1658 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ansible-vault.cfg

Lines changed: 0 additions & 22 deletions
This file was deleted.

ansible.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ forks=50
33
timeout=30
44
host_key_checking=False
55
callbacks_enabled=profile_tasks
6-
callback_whitelist=profile_tasks
76
interpreter_python=auto_legacy_silent
87
ssh_args='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
98

109
# Use the YAML callback plugin.
11-
stdout_callback = yaml
10+
stdout_callback = default
11+
callback_result_format = yaml
1212

1313
# Ansible log path
1414
log_path=/tmp/ansible.log

automation-roles/10-validation/lint-config/tasks/main.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
generator_validation_error_message: |
1414
Validation errors:
1515
16-
- name: filter the vault variables from ansible variables
16+
- name: Filter the vault variables from ansible variables
1717
set_fact:
18-
vault_var: "{{ vault_var|default({}) | combine({var_item.key : var_item.value}) }}"
19-
loop: "{{ vars | dict2items}}"
18+
vault_var: "{{ vault_var | default({}) | combine({var_item: lookup('vars', var_item)}) }}"
19+
loop: "{{ lookup('varnames', '^_').split(',') | select() | list }}"
2020
loop_control:
2121
loop_var: var_item
22-
when: var_item.key | regex_search ('^(_*)') # the variable name is start with _
2322

2423
- name: Lint and pre-process all object types
2524
include_tasks: pre-process-object-type.yaml
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
---
22
- name: Run generators for IBM Cloud
3-
include_tasks: "{{_generator_dir}}/{{ GENERATOR_NAME }}/main.yaml"
3+
include_tasks: "{{ _generator_dir }}/{{ GENERATOR_NAME }}/main.yaml"
44
vars:
55
generator:
66
name: "{{ GENERATOR_NAME }}"
77
path: "{{ _generator_dir }}/{{ GENERATOR_NAME }}"
88
attributes: "{{ OBJECT_ELEMENT_ATTRIBUTES }}"
99
config: "{{ all_config }}"
10-
PATH_TO_TERRAFORM_WORK_DIR: "{{status_dir}}/terraform"
10+
PATH_TO_TERRAFORM_WORK_DIR: "{{ status_dir }}/terraform"
1111
when: cloud_platform == 'ibm-cloud'
1212

1313
- name: Run generators for vSphere
14-
include_tasks: "{{_generator_dir}}/{{ GENERATOR_NAME }}/main.yaml"
14+
include_tasks: "{{ _generator_dir }}/{{ GENERATOR_NAME }}/main.yaml"
1515
vars:
1616
generator:
1717
name: "{{ GENERATOR_NAME }}"
1818
path: "{{ _generator_dir }}/{{ GENERATOR_NAME }}"
1919
attributes: "{{ OBJECT_ELEMENT_ATTRIBUTES }}"
2020
config: "{{ all_config }}"
21-
PATH_TO_OUTPUT_DIR: "{{status_dir}}/vsphere-ipi"
21+
PATH_TO_OUTPUT_DIR: "{{ status_dir }}/vsphere-ipi"
2222
when: cloud_platform == 'vsphere'
2323

2424
- name: Run generators for Microsoft Azure
25-
include_tasks: "{{_generator_dir}}/{{ GENERATOR_NAME }}/main.yaml"
25+
include_tasks: "{{ _generator_dir }}/{{ GENERATOR_NAME }}/main.yaml"
2626
vars:
2727
generator:
2828
name: "{{ GENERATOR_NAME }}"
2929
path: "{{ _generator_dir }}/{{ GENERATOR_NAME }}"
3030
attributes: "{{ OBJECT_ELEMENT_ATTRIBUTES }}"
3131
config: "{{ all_config }}"
32-
PATH_TO_OUTPUT_DIR: "{{status_dir}}/azure"
32+
PATH_TO_OUTPUT_DIR: "{{ status_dir }}/azure"
3333
when: cloud_platform == 'azure'
3434

3535
- name: Run generators for AWS
36-
include_tasks: "{{_generator_dir}}/{{ GENERATOR_NAME }}/main.yaml"
36+
include_tasks: "{{ _generator_dir }}/{{ GENERATOR_NAME }}/main.yaml"
3737
loop: "{{ all_config.openshift | default([]) }}"
3838
loop_control:
3939
loop_var: _current_openshift_cluster
@@ -43,5 +43,5 @@
4343
path: "{{ _generator_dir }}/{{ GENERATOR_NAME }}"
4444
attributes: "{{ OBJECT_ELEMENT_ATTRIBUTES }}"
4545
config: "{{ all_config }}"
46-
PATH_TO_OUTPUT_DIR: "{{status_dir}}/aws-ipi"
46+
PATH_TO_OUTPUT_DIR: "{{ status_dir }}/aws-ipi"
4747
when: cloud_platform == 'aws'

automation-roles/30-provision-infra/destroy-aws/tasks/destroy-aws-ipi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Ensure the status log folder exists
33
file:
4-
path: "{{status_dir}}/log"
4+
path: "{{ status_dir }}/log"
55
state: directory
66

77
- name: Delete file servers associated with OpenShift cluster

automation-roles/30-provision-infra/destroy-aws/tasks/destroy-aws-rosa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
- name: Ensure the status log folder exists
2626
file:
27-
path: "{{status_dir}}/log"
27+
path: "{{ status_dir }}/log"
2828
state: directory
2929

3030
- name: Delete ROSA cluster, logs can be found in {{ status_dir }}/log/{{ _current_openshift_cluster.name }}-delete-cluster.log

automation-roles/30-provision-infra/destroy-azure/tasks/destroy-azure-ipi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Ensure the status log folder exists
33
file:
4-
path: "{{status_dir}}/log"
4+
path: "{{ status_dir }}/log"
55
state: directory
66

77
- name: Download OpenShift installer for version {{ current_openshift_cluster.ocp_version }}

automation-roles/30-provision-infra/destroy-terraform/tasks/main.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
vars:
1818
path_to_config_dir: "{{ config_dir }}"
1919
path_to_generators_dir: "{{ generators_dir | default([(playbook_dir | dirname),'/automation-generators'] | join) }}"
20-
path_to_terraform_work_dir: "{{status_dir}}/terraform"
20+
path_to_terraform_work_dir: "{{ status_dir }}/terraform"
2121

22-
- name: "Copy variables to Terraform directory {{status_dir}}/terraform"
22+
- name: "Copy variables to Terraform directory {{ status_dir }}/terraform"
2323
template:
2424
src: 'variables.auto.tfvars.j2'
25-
dest: '{{status_dir}}/terraform/variables.auto.tfvars'
25+
dest: '{{ status_dir }}/terraform/variables.auto.tfvars'
2626

2727
- name: Retrieve Terraform tfstate from the vault
2828
include_role:
@@ -55,18 +55,18 @@
5555
content: "{{ secret_value }}"
5656
dest: "{{ status_dir }}/terraform/terraform.tfstate"
5757

58-
- name: "Run terraform init in Terraform directory {{status_dir}}/terraform"
58+
- name: "Run terraform init in Terraform directory {{ status_dir }}/terraform"
5959
shell:
60-
chdir: '{{status_dir}}/terraform'
60+
chdir: '{{ status_dir }}/terraform'
6161
cmd: 'terraform init'
6262

63-
- name: "Run terraform plan in Terraform directory {{status_dir}}/terraform, check {{status_dir}}/terraform/plan.log"
63+
- name: "Run terraform plan in Terraform directory {{ status_dir }}/terraform, check {{ status_dir }}/terraform/plan.log"
6464
shell: |
6565
set -o pipefail
6666
terraform plan -destroy -no-color -detailed-exitcode 2>&1 \
67-
| tee {{status_dir}}/terraform/plan.log
67+
| tee {{ status_dir }}/terraform/plan.log
6868
args:
69-
chdir: "{{status_dir}}/terraform"
69+
chdir: "{{ status_dir }}/terraform"
7070
register: _terraform_plan_result
7171
failed_when: "_terraform_plan_result.rc == 1"
7272

@@ -103,13 +103,13 @@
103103
- _number_to_destroy != '0'
104104
- _confirm_destroy | bool != True
105105

106-
- name: "Run terraform destroy in Terraform directory {{status_dir}}/terraform, check {{status_dir}}/terraform/destroy.log"
106+
- name: "Run terraform destroy in Terraform directory {{ status_dir }}/terraform, check {{ status_dir }}/terraform/destroy.log"
107107
shell: |
108108
set -o pipefail
109109
terraform destroy -auto-approve -no-color 2>&1 \
110-
| tee {{status_dir}}/terraform/destroy.log
110+
| tee {{ status_dir }}/terraform/destroy.log
111111
args:
112-
chdir: "{{status_dir}}/terraform"
112+
chdir: "{{ status_dir }}/terraform"
113113
environment:
114114
TF_LOG: "info"
115115
TF_LOG_PATH: "{{ status_dir }}/terraform/tf_destroy.log"

automation-roles/30-provision-infra/provision-aws/tasks/provision-rosa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
- name: Ensure the status log folder exists
2323
file:
24-
path: "{{status_dir}}/log"
24+
path: "{{ status_dir }}/log"
2525
state: directory
2626

2727
- name: Create ROSA cluster, logs can be found in {{ status_dir }}/log/{{ _current_openshift_cluster.name }}-create-cluster.log

automation-roles/30-provision-infra/provision-ipi/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@
5252
- name: Add API address and oauth-openshift to /etc/hosts
5353
shell:
5454
grep -q "^{{ _current_openshift_cluster.api_vip }}" /etc/hosts || \
55-
echo "{{ _current_openshift_cluster.api_vip }} api.{{ _current_openshift_cluster.name }}.{{_current_openshift_cluster.domain_name }}" >> /etc/hosts
55+
echo "{{ _current_openshift_cluster.api_vip }} api.{{ _current_openshift_cluster.name }}.{{ _current_openshift_cluster.domain_name }}" >> /etc/hosts
5656

5757
- name: Add ingress address and oauth-openshift to /etc/hosts
5858
shell:
5959
grep -q "^{{ _current_openshift_cluster.ingress_vip }}" /etc/hosts || \
60-
echo "{{ _current_openshift_cluster.ingress_vip }} oauth-openshift.apps.{{ _current_openshift_cluster.name }}.{{_current_openshift_cluster.domain_name }}" >> /etc/hosts
60+
echo "{{ _current_openshift_cluster.ingress_vip }} oauth-openshift.apps.{{ _current_openshift_cluster.name }}.{{ _current_openshift_cluster.domain_name }}" >> /etc/hosts
6161

6262
- name: Download OpenShift installer for version {{ _current_openshift_cluster.ocp_version }}
6363
include_role:

0 commit comments

Comments
 (0)