Adding tower_instance_group module

This commit is contained in:
John Westcott IV
2020-08-28 15:25:32 -04:00
parent e1095a0a94
commit 9e29dd08fb
4 changed files with 291 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
---
- name: Generate test id
set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Generate names
set_fact:
group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}"
group_name2: "AWX-Collection-tests-tower_instance_group-group2-{{ test_id }}"
cred_name1: "AWX-Collection-tests-tower_instance_group-cred1-{{ test_id }}"
- block:
- name: Create an OpenShift Credential
tower_credential:
name: "{{ cred_name1 }}"
organization: "Default"
credential_type: "OpenShift or Kubernetes API Bearer Token"
inputs:
host: "https://openshift.org"
bearer_token: "asdf1234"
verify_ssl: false
register: result
- assert:
that:
- "result is changed"
- name: Create an Instance Group
tower_instance_group:
name: "{{ group_name1 }}"
policy_instance_percentage: 34
policy_instance_minimum: 12
state: present
register: result
- assert:
that:
- "result is changed"
- name: Create a container group
tower_instance_group:
name: "{{ group_name2 }}"
credential: "{{ cred_name1 }}"
register: result
- assert:
that:
- "result is changed"
always:
- name: Delete the instance groups
tower_instance_group:
name: "{{ item }}"
state: absent
loop:
- "{{ group_name1 }}"
- "{{ group_name2 }}"
- name: Delete the credential
tower_credential:
name: "{{ cred_name1 }}"
organization: "Default"
credential_type: "OpenShift or Kubernetes API Bearer Token"