Files
awx/awx_collection/tests/integration/targets/instance/tasks/main.yml
Lila Yasin 54894c14dc Hop node AWX Collection Updates (#14153)
Add hop node support to awx collections
- add peers and peers_from_control_nodes fields
- show new node_type "hop"
- add tests for adding hop nodes via collections

Co-authored-by: Seth Foster <fosterseth@users.noreply.github.com>
2023-08-29 13:06:54 -04:00

130 lines
3.0 KiB
YAML

---
- name: Generate a test ID
set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined
- name: Generate hostnames
set_fact:
hostname1: "AWX-Collection-tests-instance1.{{ test_id }}.example.com"
hostname2: "AWX-Collection-tests-instance2.{{ test_id }}.example.com"
hostname3: "AWX-Collection-tests-instance3.{{ test_id }}.example.com"
register: facts
- name: Get the k8s setting
set_fact:
IS_K8S: "{{ controller_settings['IS_K8S'] | default(False) }}"
vars:
controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/all') }}"
- debug:
msg: "Skipping instance test since this is instance is not running on a K8s platform"
when: not IS_K8S
- block:
- name: Create an instance
awx.awx.instance:
hostname: "{{ item }}"
node_type: execution
node_state: installed
with_items:
- "{{ hostname1 }}"
- "{{ hostname2 }}"
register: result
- assert:
that:
- result is changed
- name: Create an instance with non-default config
awx.awx.instance:
hostname: "{{ hostname3 }}"
node_type: execution
node_state: installed
capacity_adjustment: 0.4
listener_port: 31337
register: result
- assert:
that:
- result is changed
- name: Update an instance
awx.awx.instance:
hostname: "{{ hostname1 }}"
capacity_adjustment: 0.7
register: result
- assert:
that:
- result is changed
always:
- name: Deprovision the instances
awx.awx.instance:
hostname: "{{ item }}"
node_state: deprovisioning
with_items:
- "{{ hostname1 }}"
- "{{ hostname2 }}"
- "{{ hostname3 }}"
when: IS_K8S
- block:
- name: Create hop node 1
awx.awx.instance:
hostname: hopnode1
node_type: hop
node_state: installed
listener_port: 27199
peers_from_control_nodes: True
register: result
- assert:
that:
- result is changed
- name: Create hop node 2
awx.awx.instance:
hostname: hopnode2
node_type: hop
node_state: installed
listener_port: 27199
peers_from_control_nodes: True
register: result
- assert:
that:
- result is changed
- name: Create execution node
awx.awx.instance:
hostname: executionnode
node_type: execution
node_state: installed
listener_port: 27199
peers:
- "hopnode1"
- "hopnode2"
register: result
- assert:
that:
- result is changed
- name: Remove execution node peers
awx.awx.instance:
hostname: executionnode
node_type: execution
node_state: installed
listener_port: 27199
peers: []
register: result
- assert:
that:
- result is changed
when: IS_K8S