Skip to content

Commit

Permalink
fixes for AAP 2.5 installation support
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagoor Shaik committed Oct 20, 2024
1 parent 47add14 commit 4b8d7d2
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 14 deletions.
2 changes: 1 addition & 1 deletion roles/aap_setup_download/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# aap_setup_down_offline_token:

# which version of the installer to download
aap_setup_down_version: "2.4"
aap_setup_down_version: "2.5"

# Which system architecture to dowload for
aap_setup_arch: x86_64
Expand Down
4 changes: 4 additions & 0 deletions roles/aap_setup_download/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@
- name: Extract the name of the downloaded installer to aap_setup_down_installer_file
ansible.builtin.set_fact:
aap_setup_down_installer_file: "{{ __aap_setup_down_downloads.dest }}"

- name: Set aap_setup_down_version fact
ansible.builtin.set_fact:
aap_setup_down_version: "{{ aap_setup_down_version }}"
...
1 change: 1 addition & 0 deletions roles/aap_setup_install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The following input variables are available:

|Variable Name|Default Value|Required|Description|Example|
|---:|:---:|:---:|:---|:---:|
|`aap_setup_down_version`|"`{{ aap_setup_down_version }}`"|no|defines the minor version to download (e.g. 2.5), note that `aap_setup_down_version` is a fact set by the role `aap_setup_download`|'2.5'|
|`aap_setup_inst_setup_dir`|"`{{ aap_setup_prep_setup_dir }}`"|no|absolute path where to find the extracted installation tarball on the remote host, note that `aap_setup_prep_setup_dir` is a fact set by the role `aap_setup_prepare`|'/var/tmp/myinstaller'|
|`aap_setup_inst_inventory`|"`inventory`"|no|path to the inventory file/directory to be used for the installation, the path can be absolute or relative to the previous directory|'/etc/ansible/inventory'|
|`aap_setup_inst_extra_vars`|`{}`|no|dictionary of extra vars to use when calling setup.sh|see [defaults/main.yml](defaults/main.yml)|
Expand Down
11 changes: 11 additions & 0 deletions roles/aap_setup_install/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
# defaults file for aap_setup_install

# which version of the installer to download
aap_setup_down_version: "{{ aap_setup_down_version }}"

# where is the setup directory
aap_setup_inst_setup_dir: "{{ aap_setup_prep_setup_dir }}"

Expand Down Expand Up @@ -72,6 +75,14 @@ ah_hostname: "{{ (aap_setup_prep_inv_nodes['automationhub'].keys() | list)[0] }}
eda_hostname: "{{ (aap_setup_prep_inv_nodes[__aap_setup_inst_eda_group_name].keys() | list)[0] }}"
# eda_validate_certs: false

# gateway_hostname: "{{ inventory_hostname }}"
gateway_hostname: "{{ (aap_setup_prep_inv_nodes['automationgateway'].keys() | list)[0] }}"
# gateway_username: "admin"
# gateway_password: ""
# gateway_oauthtoken: ""
# gateway_config_file: ""
# gateway_validate_certs: false

# force the installation of AAP even if it's already running
aap_setup_inst_force: false

Expand Down
110 changes: 100 additions & 10 deletions roles/aap_setup_install/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
failed_when: false
when:
- "'automationcontroller' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '<')
- not aap_setup_inst_force | bool

- name: Check Automation Hub Running
Expand All @@ -27,33 +28,53 @@
failed_when: false
when:
- "'automationhub' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '<')
- not aap_setup_inst_force | bool

- name: Check EDA Controller Running
ansible.builtin.uri:
url: https://{{ eda_hostname }}/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationedacontroller_admin_password | default(aap_setup_prep_inv_vars.all.automationedacontroller_admin_password)
}}"
password: "{{ aap_setup_prep_inv_secrets.all.automationedacontroller_admin_password | default(aap_setup_prep_inv_vars.all.automationedacontroller_admin_password) }}"
validate_certs: "{{ eda_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_eda_check
ignore_errors: true
failed_when: false
when:
- "'automationedacontroller' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '<')
- not aap_setup_inst_force | bool

- name: Check Gateway API Status
ansible.builtin.uri:
url: https://{{ gateway_hostname }}/api/gateway/v1/status/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationgateway_admin_password | default(aap_setup_prep_inv_vars.all.automationgateway_admin_password) }}"
validate_certs: "{{ gateway_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_gateway_check
ignore_errors: true
failed_when: false
when:
- "'automationgateway' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '>=')
- not aap_setup_inst_force | bool

- name: Install AAP
when: >
aap_setup_inst_force
or ('automationcontroller' in aap_setup_prep_inv_nodes
and __aap_setup_inst_ctl_check.status != 200)
and (aap_setup_down_version is version('2.5', '>=') |
ternary(__aap_setup_inst_gateway_check.json.services.controller.status | default('') != 'good', __aap_setup_inst_ctl_check.status | default(401) != 200)))
or ('automationhub' in aap_setup_prep_inv_nodes
and __aap_setup_inst_ah_check.status != 200)
and (aap_setup_down_version is version('2.5', '>=') |
ternary(__aap_setup_inst_gateway_check.json.services.hub.status | default('') != 'good', __aap_setup_inst_ctl_ah.status | default(401) != 200)))
or ('automationedacontroller' in aap_setup_prep_inv_nodes
and __aap_setup_inst_eda_check.status != 200)
and (aap_setup_down_version is version('2.5', '>=') |
ternary(__aap_setup_inst_gateway_check.json.services.eda.status | default('') != 'good', __aap_setup_inst_ctl_eda.status | default(401) != 200)))
block:
- name: Copy extra vars files to workspace
ansible.builtin.copy:
Expand Down Expand Up @@ -85,7 +106,9 @@
until: __aap_setup_inst_result.status == 200
retries: 90
delay: 10
when: "'automationcontroller' in aap_setup_prep_inv_nodes"
when:
- "'automationcontroller' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '<')

- name: Wait for automation hub to be running
ansible.builtin.uri: # use the first host from the list if no hostname is defined
Expand All @@ -100,20 +123,87 @@
until: __aap_setup_inst_result_ah.status == 200
retries: 90
delay: 10
when: "'automationhub' in aap_setup_prep_inv_nodes"
when:
- "'automationhub' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '<')

- name: Wait for EDA controller to be running
ansible.builtin.uri: # use the first host from the list if no hostname is defined
url: https://{{ eda_hostname }}/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationedacontroller_admin_password | default(aap_setup_prep_inv_vars.all.automationedacontroller_admin_password)
}}"
password: "{{ aap_setup_prep_inv_secrets.all.automationedacontroller_admin_password | default(aap_setup_prep_inv_vars.all.automationedacontroller_admin_password) }}"
validate_certs: "{{ eda_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_result_eda
until: __aap_setup_inst_result_eda.status == 200
retries: 90
delay: 10
when: "'automationedacontroller' in aap_setup_prep_inv_nodes"
when:
- "'automationedacontroller' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '<')

- name: Wait for Automation controller service to be running
ansible.builtin.uri: # use the first host from the list if no hostname is defined
url: https://{{ gateway_hostname }}/api/gateway/v1/status/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationgateway_admin_password | default(aap_setup_prep_inv_vars.all.automationgateway_admin_password) }}"
validate_certs: "{{ gateway_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_result_gateway
until: __aap_setup_inst_result_gateway.json.services.controller.status == "good"
retries: 90
delay: 10
when:
- "'automationcontroller' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '>=')

- name: Wait for Automation Hub service to be running
ansible.builtin.uri: # use the first host from the list if no hostname is defined
url: https://{{ gateway_hostname }}/api/gateway/v1/status/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationgateway_admin_password | default(aap_setup_prep_inv_vars.all.automationgateway_admin_password) }}"
validate_certs: "{{ gateway_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_result_gateway
until: __aap_setup_inst_result_gateway.json.services.hub.status == "good"
retries: 90
delay: 10
when:
- "'automationhub' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '>=')

- name: Wait for EDA controller service to be running
ansible.builtin.uri: # use the first host from the list if no hostname is defined
url: https://{{ gateway_hostname }}/api/gateway/v1/status/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationgateway_admin_password | default(aap_setup_prep_inv_vars.all.automationgateway_admin_password) }}"
validate_certs: "{{ gateway_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_result_gateway
until: __aap_setup_inst_result_gateway.json.services.eda.status == "good"
retries: 90
delay: 10
when:
- "'automationedacontroller' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '>=')

- name: Wait for Automation Gateway service to be running
ansible.builtin.uri: # use the first host from the list if no hostname is defined
url: https://{{ gateway_hostname }}/api/gateway/v1/status/
method: GET
user: admin
password: "{{ aap_setup_prep_inv_secrets.all.automationgateway_admin_password | default(aap_setup_prep_inv_vars.all.automationgateway_admin_password) }}"
validate_certs: "{{ gateway_validate_certs | default('false') }}"
force_basic_auth: true
register: __aap_setup_inst_result_gateway
until: __aap_setup_inst_result_gateway.json.services.gateway.status == "good"
retries: 90
delay: 10
when:
- "'automationgateway' in aap_setup_prep_inv_nodes"
- aap_setup_down_version is version('2.5', '>=')
...
3 changes: 0 additions & 3 deletions roles/aap_setup_prepare/templates/inventory.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

{% for group_key in aap_setup_prep_inv_nodes %}

{%if group_key in groups %}
[{{ group_key }}]
{% for node_key in aap_setup_prep_inv_nodes[group_key] %}
{{ node_key }}{% if aap_setup_prep_inv_nodes[group_key][node_key] is defined %} {{ aap_setup_prep_inv_nodes[group_key][node_key] }}{% endif %}

{% endfor %}

{% endif %}

{% endfor %}

{# output all the variables and their groups #}
Expand Down

0 comments on commit 4b8d7d2

Please sign in to comment.