Skip to content

Commit

Permalink
added support for installing AAP 2.5 (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
snagoor authored Oct 28, 2024
1 parent a6c2117 commit 142108a
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 12 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/add_aap25_support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Added support to install latest AAP 2.5 version
2 changes: 1 addition & 1 deletion roles/aap_setup_download/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The following input variables are required:

* `aap_setup_down_offline_token` contains your offline token as described in the requirements.
It has no default value and _must_ be defined.
* `aap_setup_down_version` defines the minor version to download (e.g. `2.1`)
* `aap_setup_down_version` defines the minor version to download (e.g. `2.5`). Defaults to current latest `2.5` version.
The default is the latest version available at time of writing.
* `aap_setup_down_dest_dir` is the directory to where you want to download the tarball.
It is by default the working directory `aap_setup_working_dir` also used by other roles of the collection, or ultimately `/var/tmp`.
Expand Down
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', '>=')
...

0 comments on commit 142108a

Please sign in to comment.