mirror of
https://github.com/ansible/awx-operator.git
synced 2026-04-27 17:06:45 +00:00
86 lines
2.5 KiB
YAML
86 lines
2.5 KiB
YAML
---
|
|
- name: Create the awx.ansible.com/v1alpha1.AWX
|
|
k8s:
|
|
state: present
|
|
namespace: '{{ namespace }}'
|
|
definition: "{{ lookup('template', 'awx_cr_molecule.yml.j2') | from_yaml }}"
|
|
wait: yes
|
|
wait_timeout: 900
|
|
wait_condition:
|
|
type: Running
|
|
reason: Successful
|
|
status: "True"
|
|
|
|
- name: Obtain generated admin password
|
|
k8s_info:
|
|
namespace: '{{ namespace }}'
|
|
kind: Secret
|
|
name: example-awx-admin-password
|
|
register: admin_pw_secret
|
|
|
|
- block:
|
|
- name: Get pod details
|
|
k8s_info:
|
|
namespace: '{{ namespace }}'
|
|
kind: Pod
|
|
label_selectors:
|
|
- app.kubernetes.io/name = example-awx
|
|
register: awx_pod
|
|
when: not awx_version
|
|
|
|
- name: Exract tags from images
|
|
set_fact:
|
|
image_tags: |
|
|
{{ awx_pod.resources[0].spec.containers |
|
|
map(attribute='image') |
|
|
map('regex_search', default_awx_version) }}
|
|
when: not awx_version
|
|
|
|
- fail:
|
|
msg: |
|
|
It looks like you may have broken the DEFAULT_AWX_VERSION functionality.
|
|
This is an environment variable that is set via build arg when releasing awx-operator.
|
|
when:
|
|
- not awx_version
|
|
- default_awx_version not in image_tags
|
|
|
|
- name: Launch Demo Job Template
|
|
awx.awx.job_launch:
|
|
name: Demo Job Template
|
|
wait: yes
|
|
validate_certs: no
|
|
controller_host: localhost
|
|
controller_username: admin
|
|
controller_password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
|
rescue:
|
|
- name: Get list of project updates and jobs
|
|
uri:
|
|
url: "http://localhost/api/v2/{{ resource }}/"
|
|
user: admin
|
|
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
|
force_basic_auth: yes
|
|
register: job_lists
|
|
loop:
|
|
- project_updates
|
|
- jobs
|
|
loop_control:
|
|
loop_var: resource
|
|
|
|
- name: Get all job and project details
|
|
uri:
|
|
url: "http://localhost{{ endpoint }}"
|
|
user: admin
|
|
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
|
|
force_basic_auth: yes
|
|
loop: |
|
|
{{ job_lists.results | map(attribute='json') | map(attribute='results') | flatten | map(attribute='url') }}
|
|
loop_control:
|
|
loop_var: endpoint
|
|
|
|
- name: Re-emit failure
|
|
vars:
|
|
failed_task:
|
|
result: '{{ ansible_failed_result }}'
|
|
fail:
|
|
msg: '{{ failed_task }}'
|