Skip to content

Commit

Permalink
[WIP] adding aap2.5 config (#8843)
Browse files Browse the repository at this point in the history
* adding aap2.5 config

* fixed yamllint error

* fixed yamllint error
  • Loading branch information
miteshget authored Nov 19, 2024
1 parent e3af9b9 commit ce6655c
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
become_override: false
silent: false

# Available options legacy/2.5
ocp4_workload_ansible_automation_platform_version: legacy

ocp4_workload_ansible_automation_platform_tmp_dir: /tmp/{{ guid }}
ocp4_workload_ansible_automation_platform_tmp_kubeconfig: >-
{{ ocp4_workload_ansible_automation_platform_tmp_dir }}/.kube/config
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---

- name: Deploy Ansible Automation Platform 2 (AAP2)
block:
- name: Create Ansilbe Automation Platform
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'aap-2.5.j2') }}"

- name: Retrieve created route
kubernetes.core.k8s_info:
api_version: "route.openshift.io/v1"
kind: Route
name: "{{ ocp4_workload_ansible_automation_platform_app_name }}"
namespace: "{{ ocp4_workload_ansible_automation_platform_project }}"
register: r_route
until: r_route.resources[0].spec.host is defined
retries: 30
delay: 45

- name: Get automation_controller route hostname
ansible.builtin.set_fact:
automation_controller_hostname: "{{ r_route.resources[0].spec.host }}"

- name: Wait for automation_controller to be running
ansible.builtin.uri:
url: http://{{ automation_controller_hostname }}/api/controller/v2/ping/
status_code: 200
register: r_result
until: r_result.json.version is defined
retries: 60
delay: 45

- name: Inject AAP2 Manifest if provided
when: ocp4_workload_ansible_automation_platform_manifest.inject | default(false) | bool
block:

- name: Fetch Automation Controller manifest file
ansible.builtin.get_url:
url: https://d3s3zqyaz8cp2d.cloudfront.net/aap/manifest.zip
dest: /tmp/aap-manifest.zip
username: "{{ ocp4_workload_ansible_automation_platform_manifest.username | default(omit) }}"
password: "{{ ocp4_workload_ansible_automation_platform_manifest.password | default(omit) }}"

- name: Inject AAP2 Controller manifest
ansible.controller.license:
manifest: /tmp/aap-manifest.zip
controller_host: "{{ automation_controller_hostname }}"
controller_username: admin
controller_password: "{{ ocp4_workload_ansible_automation_platform_admin_password }}"
validate_certs: true
register: r_aap_license
until: not r_aap_license.failed
retries: 30
delay: 30

- name: Remove AAP manifest
ansible.builtin.file:
path: /tmp/aap-manifest.zip
state: absent
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---

- name: Deploy Ansible Automation Platform 2 (AAP2)
block:
- name: Create Automation Controller
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'aap-legacy.j2') }}"

- name: Retrieve created route
kubernetes.core.k8s_info:
api_version: "route.openshift.io/v1"
kind: Route
name: "{{ ocp4_workload_ansible_automation_platform_app_name }}"
namespace: "{{ ocp4_workload_ansible_automation_platform_project }}"
register: r_route
until: r_route.resources[0].spec.host is defined
retries: 30
delay: 45

- name: Get automation_controller route hostname
ansible.builtin.set_fact:
automation_controller_hostname: "{{ r_route.resources[0].spec.host }}"

- name: Wait for automation_controller to be running
ansible.builtin.uri:
url: http://{{ automation_controller_hostname }}/api/v2/ping/
status_code: 200
register: r_result
until: r_result.json.version is defined
retries: 60
delay: 45

- name: Inject AAP2 Manifest if provided
when: ocp4_workload_ansible_automation_platform_manifest.inject | default(false) | bool
block:

- name: Fetch Automation Controller manifest file
ansible.builtin.get_url:
url: https://d3s3zqyaz8cp2d.cloudfront.net/aap/manifest.zip
dest: /tmp/aap-manifest.zip
username: "{{ ocp4_workload_ansible_automation_platform_manifest.username | default(omit) }}"
password: "{{ ocp4_workload_ansible_automation_platform_manifest.password | default(omit) }}"

- name: Inject AAP2 Controller manifest
awx.awx.license:
manifest: /tmp/aap-manifest.zip
controller_host: "{{ automation_controller_hostname }}"
controller_username: admin
controller_password: "{{ ocp4_workload_ansible_automation_platform_admin_password }}"
validate_certs: true
register: r_aap_license
until: not r_aap_license.failed
retries: 30
delay: 30

- name: Remove AAP manifest
ansible.builtin.file:
path: /tmp/aap-manifest.zip
state: absent
Original file line number Diff line number Diff line change
Expand Up @@ -93,65 +93,69 @@
retries: 30
delay: 10

- name: Deploy Ansible Automation Platform 2 (AAP2)
block:

- name: Create Automation Controller
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'automationcontroller.j2') }}"

- name: Retrieve created route
kubernetes.core.k8s_info:
api_version: "route.openshift.io/v1"
kind: Route
name: "{{ ocp4_workload_ansible_automation_platform_app_name }}"
namespace: "{{ ocp4_workload_ansible_automation_platform_project }}"
register: r_route
until: r_route.resources[0].spec.host is defined
retries: 30
delay: 45

- name: Get automation_controller route hostname
ansible.builtin.set_fact:
automation_controller_hostname: "{{ r_route.resources[0].spec.host }}"

- name: Wait for automation_controller to be running
ansible.builtin.uri:
url: http://{{ automation_controller_hostname }}/api/v2/ping/
status_code: 200
register: r_result
until: r_result.json.version is defined
retries: 60
delay: 45

- name: Inject AAP2 Manifest if provided
when: ocp4_workload_ansible_automation_platform_manifest.inject | default(false) | bool
block:

- name: Fetch Automation Controller manifest file
ansible.builtin.get_url:
url: https://d3s3zqyaz8cp2d.cloudfront.net/aap/manifest.zip
dest: /tmp/aap-manifest.zip
username: "{{ ocp4_workload_ansible_automation_platform_manifest.username | default(omit) }}"
password: "{{ ocp4_workload_ansible_automation_platform_manifest.password | default(omit) }}"

- name: Inject AAP2 Controller manifest
awx.awx.license:
manifest: /tmp/aap-manifest.zip
controller_host: "{{ automation_controller_hostname }}"
controller_username: admin
controller_password: "{{ ocp4_workload_ansible_automation_platform_admin_password }}"
validate_certs: true
register: r_aap_license
until: not r_aap_license.failed
retries: 30
delay: 30

- name: Remove AAP manifest
ansible.builtin.file:
path: /tmp/aap-manifest.zip
state: absent
- name: Include AAP 2.x configuration tasks
ansible.builtin.include_tasks:
file: aap/aap-{{ ocp4_workload_ansible_automation_platform_version }}.yml

# - name: Deploy Ansible Automation Platform 2 (AAP2)
# block:

# - name: Create Automation Controller
# kubernetes.core.k8s:
# state: present
# definition: "{{ lookup('template', 'automationcontroller.j2') }}"

# - name: Retrieve created route
# kubernetes.core.k8s_info:
# api_version: "route.openshift.io/v1"
# kind: Route
# name: "{{ ocp4_workload_ansible_automation_platform_app_name }}"
# namespace: "{{ ocp4_workload_ansible_automation_platform_project }}"
# register: r_route
# until: r_route.resources[0].spec.host is defined
# retries: 30
# delay: 45

# - name: Get automation_controller route hostname
# ansible.builtin.set_fact:
# automation_controller_hostname: "{{ r_route.resources[0].spec.host }}"

# - name: Wait for automation_controller to be running
# ansible.builtin.uri:
# url: http://{{ automation_controller_hostname }}/api/v2/ping/
# status_code: 200
# register: r_result
# until: r_result.json.version is defined
# retries: 60
# delay: 45

# - name: Inject AAP2 Manifest if provided
# when: ocp4_workload_ansible_automation_platform_manifest.inject | default(false) | bool
# block:

# - name: Fetch Automation Controller manifest file
# ansible.builtin.get_url:
# url: https://d3s3zqyaz8cp2d.cloudfront.net/aap/manifest.zip
# dest: /tmp/aap-manifest.zip
# username: "{{ ocp4_workload_ansible_automation_platform_manifest.username | default(omit) }}"
# password: "{{ ocp4_workload_ansible_automation_platform_manifest.password | default(omit) }}"

# - name: Inject AAP2 Controller manifest
# awx.awx.license:
# manifest: /tmp/aap-manifest.zip
# controller_host: "{{ automation_controller_hostname }}"
# controller_username: admin
# controller_password: "{{ ocp4_workload_ansible_automation_platform_admin_password }}"
# validate_certs: true
# register: r_aap_license
# until: not r_aap_license.failed
# retries: 30
# delay: 30

# - name: Remove AAP manifest
# ansible.builtin.file:
# path: /tmp/aap-manifest.zip
# state: absent

- name: Display Version and credentials
when: not silent | bool
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: aap.ansible.com/v1alpha1
kind: AnsibleAutomationPlatform
metadata:
name: {{ ocp4_workload_ansible_automation_platform_app_name }}
namespace: {{ ocp4_workload_ansible_automation_platform_project }}
spec:
replicas: 1

0 comments on commit ce6655c

Please sign in to comment.