add instance groups

This commit is contained in:
sean-m-ssullivan
2021-04-03 14:00:56 -05:00
parent f35ce93fb1
commit f9d2db696b
6 changed files with 107 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
inv_name1: "AWX-Collection-tests-tower_inventory-inv1-{{ test_id }}"
inv_name2: "AWX-Collection-tests-tower_inventory-inv2-{{ test_id }}"
cred_name1: "AWX-Collection-tests-tower_inventory-cred1-{{ test_id }}"
group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}"
- block:
- name: Create an Insights Credential
@@ -25,17 +26,30 @@
that:
- "result is changed"
- name: Create an Inventory
tower_inventory:
name: "{{ inv_name1 }}"
organization: Default
insights_credential: "{{ result.id }}"
- name: Create an Instance Group
tower_instance_group:
name: "{{ group_name1 }}"
state: present
register: result
- assert:
that:
- "result is changed"
- name: Create an Inventory
tower_inventory:
name: "{{ inv_name1 }}"
organization: Default
insights_credential: "{{ result.id }}"
instance_groups:
- "{{ group_name1 }}"
state: present
register: result
- assert:
that:
- "result is changed"
- name: Test Inventory module idempotency
tower_inventory:
name: "{{ result.id }}"
@@ -158,6 +172,11 @@
- "{{ inv_name2 }}"
- "copy_{{ inv_name1 }}"
- name: Delete the instance groups
tower_instance_group:
name: "{{ group_name1 }}"
state: absent
- name: Delete Insights Credential
tower_credential:
name: "{{ cred_name1 }}"

View File

@@ -14,6 +14,7 @@
lab1: "AWX-Collection-tests-tower_job_template-lab1-{{ test_id }}"
email_not: "AWX-Collection-tests-tower_job_template-email-not-{{ test_id }}"
webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ test_id }}"
group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}"
- name: Create a Demo Project
tower_project:
@@ -48,6 +49,16 @@
name: "{{ lab1 }}"
organization: Default
- name: Create an Instance Group
tower_instance_group:
name: "{{ group_name1 }}"
state: present
register: result
- assert:
that:
- "result is changed"
- name: Add email notification
tower_notification_template:
name: "{{ email_not }}"
@@ -81,7 +92,11 @@
project: "{{ proj1 }}"
inventory: Demo Inventory
playbook: hello_world.yml
credentials: ["{{ cred1 }}", "{{ cred2 }}"]
credentials:
- "{{ cred1 }}"
- "{{ cred2 }}"
instance_groups:
- "{{ group_name1 }}"
job_type: run
state: present
register: jt1_result
@@ -384,6 +399,11 @@
organization: Default
state: absent
- name: Delete the instance groups
tower_instance_group:
name: "{{ group_name1 }}"
state: absent
- name: Delete webhook notification
tower_notification_template:
name: "{{ webhook_not }}"

View File

@@ -1,7 +1,12 @@
---
- name: Generate a test ID
set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Generate an org name
set_fact:
org_name: "AWX-Collection-tests-tower_organization-org-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
org_name: "AWX-Collection-tests-tower_organization-org-{{ test_id }}"
group_name1: "AWX-Collection-tests-tower_instance_group-group1-{{ test_id }}"
- name: Make sure {{ org_name }} is not there
tower_organization:
@@ -28,10 +33,22 @@
that:
- "result is not changed"
- name: Create an Instance Group
tower_instance_group:
name: "{{ group_name1 }}"
state: present
register: result
- assert:
that:
- "result is changed"
- name: "Pass in all parameters"
tower_organization:
name: "{{ org_name }}"
description: "A description"
instance_groups:
- "{{ group_name1 }}"
register: result
- assert:
@@ -48,6 +65,11 @@
that:
- "result is changed"
- name: Delete the instance groups
tower_instance_group:
name: "{{ group_name1 }}"
state: absent
- name: "Remove the organization"
tower_organization:
name: "{{ org_name }}"