Files
awx/awx_collection/tests/integration/targets/instance/tasks/main.yml
Seth Foster 69102cf265 Remove receptor_address module from collection
After removing CRUD from receptor addresses, we need
to remove the module.

- remove receptor_address module
- Add listener_port to instance module
- Add peers_from_control_nodes to instance module

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
2024-02-02 10:37:41 -05:00

134 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
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: "{{ hostname1 }}"
node_type: hop
node_state: installed
register: result
- assert:
that:
- result is changed
- name: Create hop node 2
awx.awx.instance:
hostname: "{{ hostname2 }}"
node_type: hop
node_state: installed
register: result
- assert:
that:
- result is changed
- name: Create execution node
awx.awx.instance:
hostname: "{{ hostname3 }}"
node_type: execution
node_state: installed
peers:
- "{{ hostname1 }}"
- "{{ hostname2 }}"
register: result
- assert:
that:
- result is changed
- name: Remove execution node peers
awx.awx.instance:
hostname: "{{ hostname3 }}"
node_type: execution
node_state: installed
peers: []
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