mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 02:01:01 -03:30
Make state exists universal in collection (#13890)
Make state: exists available for all API modules Make state:exists return the ID just like it would if it created the resource
This commit is contained in:
@@ -24,6 +24,43 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Run an application with exists
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
authorization_grant_type: "password"
|
||||
client_type: "public"
|
||||
organization: "Default"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete our application
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
organization: "Default"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Run an application with exists
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
authorization_grant_type: "password"
|
||||
client_type: "public"
|
||||
organization: "Default"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete our application
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
|
||||
@@ -47,6 +47,42 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an Org-specific credential with an ID with exists
|
||||
credential:
|
||||
name: "{{ ssh_cred_name1 }}"
|
||||
organization: Default
|
||||
credential_type: Machine
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete an Org-specific credential with an ID
|
||||
credential:
|
||||
name: "{{ ssh_cred_name1 }}"
|
||||
organization: Default
|
||||
credential_type: Machine
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an Org-specific credential with an ID with exists
|
||||
credential:
|
||||
name: "{{ ssh_cred_name1 }}"
|
||||
organization: Default
|
||||
credential_type: Machine
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete a Org-specific credential
|
||||
credential:
|
||||
name: "{{ ssh_cred_name1 }}"
|
||||
|
||||
@@ -54,6 +54,51 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add credential Input Source with exists
|
||||
credential_input_source:
|
||||
input_field_name: password
|
||||
target_credential: "{{ target_cred_result.id }}"
|
||||
source_credential: "{{ src_cred_result.id }}"
|
||||
metadata:
|
||||
object_query: "Safe=MY_SAFE;Object=AWX-user"
|
||||
object_query_format: "Exact"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete credential Input Source
|
||||
credential_input_source:
|
||||
input_field_name: password
|
||||
target_credential: "{{ target_cred_result.id }}"
|
||||
source_credential: "{{ src_cred_result.id }}"
|
||||
metadata:
|
||||
object_query: "Safe=MY_SAFE;Object=AWX-user"
|
||||
object_query_format: "Exact"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add credential Input Source with exists
|
||||
credential_input_source:
|
||||
input_field_name: password
|
||||
target_credential: "{{ target_cred_result.id }}"
|
||||
source_credential: "{{ src_cred_result.id }}"
|
||||
metadata:
|
||||
object_query: "Safe=MY_SAFE;Object=AWX-user"
|
||||
object_query_format: "Exact"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add Second credential Lookup
|
||||
credential:
|
||||
description: Credential for Testing Source Change
|
||||
|
||||
@@ -22,6 +22,48 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add Tower credential type with exists
|
||||
credential_type:
|
||||
description: Credential type for Test
|
||||
name: "{{ cred_type_name }}"
|
||||
kind: cloud
|
||||
inputs: {"fields": [{"type": "string", "id": "username", "label": "Username"}, {"secret": true, "type": "string", "id": "password", "label": "Password"}], "required": ["username", "password"]}
|
||||
injectors: {"extra_vars": {"test": "foo"}}
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete the credential type
|
||||
credential_type:
|
||||
description: Credential type for Test
|
||||
name: "{{ cred_type_name }}"
|
||||
kind: cloud
|
||||
inputs: {"fields": [{"type": "string", "id": "username", "label": "Username"}, {"secret": true, "type": "string", "id": "password", "label": "Password"}], "required": ["username", "password"]}
|
||||
injectors: {"extra_vars": {"test": "foo"}}
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add Tower credential type with exists
|
||||
credential_type:
|
||||
description: Credential type for Test
|
||||
name: "{{ cred_type_name }}"
|
||||
kind: cloud
|
||||
inputs: {"fields": [{"type": "string", "id": "username", "label": "Username"}, {"secret": true, "type": "string", "id": "password", "label": "Password"}], "required": ["username", "password"]}
|
||||
injectors: {"extra_vars": {"test": "foo"}}
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Rename Tower credential type
|
||||
credential_type:
|
||||
name: "{{ cred_type_name }}"
|
||||
|
||||
@@ -22,6 +22,48 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add an EE with exists
|
||||
execution_environment:
|
||||
name: "{{ ee_name }}"
|
||||
description: "EE for Testing"
|
||||
image: quay.io/ansible/awx-ee
|
||||
pull: always
|
||||
organization: Default
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete an EE
|
||||
execution_environment:
|
||||
name: "{{ ee_name }}"
|
||||
description: "EE for Testing"
|
||||
image: quay.io/ansible/awx-ee
|
||||
pull: always
|
||||
organization: Default
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Add an EE with exists
|
||||
execution_environment:
|
||||
name: "{{ ee_name }}"
|
||||
description: "EE for Testing"
|
||||
image: quay.io/ansible/awx-ee
|
||||
pull: always
|
||||
organization: Default
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Associate the Test EE with Default Org (this should fail)
|
||||
execution_environment:
|
||||
name: "{{ ee_name }}"
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
name: "{{ inv_name }}"
|
||||
organization: Default
|
||||
state: present
|
||||
register: result
|
||||
registuer: result
|
||||
|
||||
- name: Create a Group
|
||||
- name: Create Group 1
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ result.id }}"
|
||||
@@ -34,7 +34,46 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a Group
|
||||
- name: Create Group 1 with exists
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: exists
|
||||
variables:
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete Group 1
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: absent
|
||||
variables:
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create Group 1 with exists
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: exists
|
||||
variables:
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create Group 2
|
||||
group:
|
||||
name: "{{ group_name2 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
@@ -47,7 +86,7 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a Group
|
||||
- name: Create Group 3
|
||||
group:
|
||||
name: "{{ group_name3 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
@@ -69,7 +108,7 @@
|
||||
- "{{ host_name2 }}"
|
||||
- "{{ host_name3 }}"
|
||||
|
||||
- name: Create a Group with hosts and sub group
|
||||
- name: Create Group 1 with hosts and sub group of Group 2
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
@@ -83,7 +122,7 @@
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- name: Create a Group with hosts and sub group
|
||||
- name: Create Group 1 with hosts and sub group
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
@@ -104,18 +143,7 @@
|
||||
that:
|
||||
- group1_host_count == "3"
|
||||
|
||||
- name: Delete a Group
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete a Group
|
||||
- name: Delete Group 2
|
||||
group:
|
||||
name: "{{ group_name2 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
@@ -127,7 +155,7 @@
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete a Group
|
||||
- name: Delete Group 3
|
||||
group:
|
||||
name: "{{ group_name3 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
@@ -136,7 +164,19 @@
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
- "result is changed"
|
||||
|
||||
# If we delete group 1 first it will delete group 2 and 3
|
||||
- name: Delete Group 1
|
||||
group:
|
||||
name: "{{ group_name1 }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Check module fails with correct msg
|
||||
group:
|
||||
|
||||
@@ -29,6 +29,45 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a Host with exists
|
||||
host:
|
||||
name: "{{ host_name }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: exists
|
||||
variables:
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete a Host
|
||||
host:
|
||||
name: "{{ host_name }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: absent
|
||||
variables:
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a Host with exists
|
||||
host:
|
||||
name: "{{ host_name }}"
|
||||
inventory: "{{ inv_name }}"
|
||||
state: exists
|
||||
variables:
|
||||
foo: bar
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete a Host
|
||||
host:
|
||||
name: "{{ result.id }}"
|
||||
|
||||
@@ -38,6 +38,42 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an Instance Group with exists
|
||||
instance_group:
|
||||
name: "{{ group_name1 }}"
|
||||
policy_instance_percentage: 34
|
||||
policy_instance_minimum: 12
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete an Instance Group
|
||||
instance_group:
|
||||
name: "{{ group_name1 }}"
|
||||
policy_instance_percentage: 34
|
||||
policy_instance_minimum: 12
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an Instance Group with exists
|
||||
instance_group:
|
||||
name: "{{ group_name1 }}"
|
||||
policy_instance_percentage: 34
|
||||
policy_instance_minimum: 12
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Update an Instance Group
|
||||
instance_group:
|
||||
name: "{{ result.id }}"
|
||||
|
||||
@@ -51,6 +51,45 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an Inventory with exists
|
||||
inventory:
|
||||
name: "{{ inv_name1 }}"
|
||||
organization: Default
|
||||
instance_groups:
|
||||
- "{{ group_name1 }}"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete an Inventory
|
||||
inventory:
|
||||
name: "{{ inv_name1 }}"
|
||||
organization: Default
|
||||
instance_groups:
|
||||
- "{{ group_name1 }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an Inventory with exists
|
||||
inventory:
|
||||
name: "{{ inv_name1 }}"
|
||||
organization: Default
|
||||
instance_groups:
|
||||
- "{{ group_name1 }}"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Test Inventory module idempotency
|
||||
inventory:
|
||||
name: "{{ result.id }}"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
organization: Default
|
||||
name: "{{ openstack_inv }}"
|
||||
|
||||
- name: Create a source inventory
|
||||
- name: Create an source inventory
|
||||
inventory_source:
|
||||
name: "{{ openstack_inv_source }}"
|
||||
description: Source for Test inventory
|
||||
@@ -47,6 +47,60 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an source inventory with exists
|
||||
inventory_source:
|
||||
name: "{{ openstack_inv_source }}"
|
||||
description: Source for Test inventory
|
||||
inventory: "{{ openstack_inv }}"
|
||||
credential: "{{ credential_result.id }}"
|
||||
overwrite: true
|
||||
update_on_launch: true
|
||||
source_vars:
|
||||
private: false
|
||||
source: openstack
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete an source inventory
|
||||
inventory_source:
|
||||
name: "{{ openstack_inv_source }}"
|
||||
description: Source for Test inventory
|
||||
inventory: "{{ openstack_inv }}"
|
||||
credential: "{{ credential_result.id }}"
|
||||
overwrite: true
|
||||
update_on_launch: true
|
||||
source_vars:
|
||||
private: false
|
||||
source: openstack
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an source inventory with exists
|
||||
inventory_source:
|
||||
name: "{{ openstack_inv_source }}"
|
||||
description: Source for Test inventory
|
||||
inventory: "{{ openstack_inv }}"
|
||||
credential: "{{ credential_result.id }}"
|
||||
overwrite: true
|
||||
update_on_launch: true
|
||||
source_vars:
|
||||
private: false
|
||||
source: openstack
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete the inventory source with an invalid cred and source_project specified
|
||||
inventory_source:
|
||||
name: "{{ result.id }}"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
cred1: "AWX-Collection-tests-job_template-cred1-{{ test_id }}"
|
||||
cred2: "AWX-Collection-tests-job_template-cred2-{{ test_id }}"
|
||||
cred3: "AWX-Collection-tests-job_template-cred3-{{ test_id }}"
|
||||
inv1: "AWX-Collection-tests-job_template-inv-{{ test_id }}"
|
||||
proj1: "AWX-Collection-tests-job_template-proj-{{ test_id }}"
|
||||
jt1: "AWX-Collection-tests-job_template-jt1-{{ test_id }}"
|
||||
jt2: "AWX-Collection-tests-job_template-jt2-{{ test_id }}"
|
||||
@@ -25,6 +26,11 @@
|
||||
- Ansible Galaxy
|
||||
register: result
|
||||
|
||||
- name: Create an inventory
|
||||
inventory:
|
||||
name: "{{ inv1 }}"
|
||||
organization: "{{ org_name }}"
|
||||
|
||||
- name: Create a Demo Project
|
||||
project:
|
||||
name: "{{ proj1 }}"
|
||||
@@ -104,7 +110,7 @@
|
||||
job_template:
|
||||
name: "{{ jt1 }}"
|
||||
project: "{{ proj1 }}"
|
||||
inventory: Demo Inventory
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credentials:
|
||||
- "{{ cred1 }}"
|
||||
@@ -119,6 +125,63 @@
|
||||
that:
|
||||
- "jt1_result is changed"
|
||||
|
||||
- name: Create Job Template 1 with exists
|
||||
job_template:
|
||||
name: "{{ jt1 }}"
|
||||
project: "{{ proj1 }}"
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credentials:
|
||||
- "{{ cred1 }}"
|
||||
- "{{ cred2 }}"
|
||||
instance_groups:
|
||||
- "{{ group_name1 }}"
|
||||
job_type: run
|
||||
state: exists
|
||||
register: jt1_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "jt1_result is not changed"
|
||||
|
||||
- name: Delete Job Template 1
|
||||
job_template:
|
||||
name: "{{ jt1 }}"
|
||||
project: "{{ proj1 }}"
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credentials:
|
||||
- "{{ cred1 }}"
|
||||
- "{{ cred2 }}"
|
||||
instance_groups:
|
||||
- "{{ group_name1 }}"
|
||||
job_type: run
|
||||
state: absent
|
||||
register: jt1_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "jt1_result is changed"
|
||||
|
||||
- name: Create Job Template 1 with exists
|
||||
job_template:
|
||||
name: "{{ jt1 }}"
|
||||
project: "{{ proj1 }}"
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credentials:
|
||||
- "{{ cred1 }}"
|
||||
- "{{ cred2 }}"
|
||||
instance_groups:
|
||||
- "{{ group_name1 }}"
|
||||
job_type: run
|
||||
state: exists
|
||||
register: jt1_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "jt1_result is changed"
|
||||
|
||||
- name: Add a credential to this JT
|
||||
job_template:
|
||||
name: "{{ jt1 }}"
|
||||
@@ -218,7 +281,7 @@
|
||||
name: "{{ jt2 }}"
|
||||
organization: Default
|
||||
project: "{{ proj1 }}"
|
||||
inventory: Demo Inventory
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credential: "{{ cred3 }}"
|
||||
job_type: run
|
||||
@@ -236,7 +299,7 @@
|
||||
name: "{{ jt2 }}"
|
||||
organization: Default
|
||||
project: "{{ proj1 }}"
|
||||
inventory: Demo Inventory
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credential: "{{ cred3 }}"
|
||||
job_type: run
|
||||
@@ -384,7 +447,7 @@
|
||||
job_template:
|
||||
name: "{{ jt2 }}"
|
||||
project: "{{ proj1 }}"
|
||||
inventory: Demo Inventory
|
||||
inventory: "{{ inv1 }}"
|
||||
playbook: hello_world.yml
|
||||
credential: "{{ cred3 }}"
|
||||
job_type: run
|
||||
@@ -444,6 +507,12 @@
|
||||
organization: Default
|
||||
state: absent
|
||||
|
||||
- name: Delete an inventory
|
||||
inventory:
|
||||
name: "{{ inv1 }}"
|
||||
organization: "{{ org_name }}"
|
||||
state: absent
|
||||
|
||||
- name: "Remove the organization"
|
||||
organization:
|
||||
name: "{{ org_name }}"
|
||||
|
||||
@@ -13,6 +13,22 @@
|
||||
name: "{{ label_name }}"
|
||||
organization: Default
|
||||
state: present
|
||||
register: results
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "results is changed"
|
||||
|
||||
- name: Create a Label with exists
|
||||
label:
|
||||
name: "{{ label_name }}"
|
||||
organization: Default
|
||||
state: exists
|
||||
register: results
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "results is not changed"
|
||||
|
||||
- name: Check module fails with correct msg
|
||||
label:
|
||||
|
||||
@@ -36,6 +36,75 @@
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Create Slack notification with custom messages with exists
|
||||
notification_template:
|
||||
name: "{{ slack_not }}"
|
||||
organization: Default
|
||||
notification_type: slack
|
||||
notification_configuration:
|
||||
token: a_token
|
||||
channels:
|
||||
- general
|
||||
messages:
|
||||
started:
|
||||
message: "{{ '{{' }} job_friendly_name {{' }}' }} {{ '{{' }} job.id {{' }}' }} started"
|
||||
success:
|
||||
message: "{{ '{{' }} job_friendly_name {{ '}}' }} completed in {{ '{{' }} job.elapsed {{ '}}' }} seconds"
|
||||
error:
|
||||
message: "{{ '{{' }} job_friendly_name {{ '}}' }} FAILED! Please look at {{ '{{' }} job.url {{ '}}' }}"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Delete Slack notification with custom messages
|
||||
notification_template:
|
||||
name: "{{ slack_not }}"
|
||||
organization: Default
|
||||
notification_type: slack
|
||||
notification_configuration:
|
||||
token: a_token
|
||||
channels:
|
||||
- general
|
||||
messages:
|
||||
started:
|
||||
message: "{{ '{{' }} job_friendly_name {{' }}' }} {{ '{{' }} job.id {{' }}' }} started"
|
||||
success:
|
||||
message: "{{ '{{' }} job_friendly_name {{ '}}' }} completed in {{ '{{' }} job.elapsed {{ '}}' }} seconds"
|
||||
error:
|
||||
message: "{{ '{{' }} job_friendly_name {{ '}}' }} FAILED! Please look at {{ '{{' }} job.url {{ '}}' }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Create Slack notification with custom messages with exists
|
||||
notification_template:
|
||||
name: "{{ slack_not }}"
|
||||
organization: Default
|
||||
notification_type: slack
|
||||
notification_configuration:
|
||||
token: a_token
|
||||
channels:
|
||||
- general
|
||||
messages:
|
||||
started:
|
||||
message: "{{ '{{' }} job_friendly_name {{' }}' }} {{ '{{' }} job.id {{' }}' }} started"
|
||||
success:
|
||||
message: "{{ '{{' }} job_friendly_name {{ '}}' }} completed in {{ '{{' }} job.elapsed {{ '}}' }} seconds"
|
||||
error:
|
||||
message: "{{ '{{' }} job_friendly_name {{ '}}' }} FAILED! Please look at {{ '{{' }} job.url {{ '}}' }}"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Delete Slack notification
|
||||
notification_template:
|
||||
name: "{{ slack_not }}"
|
||||
|
||||
@@ -25,6 +25,39 @@
|
||||
- assert:
|
||||
that: "result is changed"
|
||||
|
||||
- name: "Create a new organization with exists"
|
||||
organization:
|
||||
name: "{{ org_name }}"
|
||||
galaxy_credentials:
|
||||
- Ansible Galaxy
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that: "result is not changed"
|
||||
|
||||
- name: "Delete a new organization"
|
||||
organization:
|
||||
name: "{{ org_name }}"
|
||||
galaxy_credentials:
|
||||
- Ansible Galaxy
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that: "result is changed"
|
||||
|
||||
- name: "Create a new organization with exists"
|
||||
organization:
|
||||
name: "{{ org_name }}"
|
||||
galaxy_credentials:
|
||||
- Ansible Galaxy
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that: "result is changed"
|
||||
|
||||
- name: "Make sure making the same org is not a change"
|
||||
organization:
|
||||
name: "{{ org_name }}"
|
||||
|
||||
@@ -39,6 +39,48 @@
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Create a git project without credentials and wait with exists
|
||||
project:
|
||||
name: "{{ project_name1 }}"
|
||||
organization: Default
|
||||
scm_type: git
|
||||
scm_url: https://github.com/ansible/test-playbooks
|
||||
wait: true
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Delete a git project without credentials and wait
|
||||
project:
|
||||
name: "{{ project_name1 }}"
|
||||
organization: Default
|
||||
scm_type: git
|
||||
scm_url: https://github.com/ansible/test-playbooks
|
||||
wait: true
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Create a git project without credentials and wait with exists
|
||||
project:
|
||||
name: "{{ project_name1 }}"
|
||||
organization: Default
|
||||
scm_type: git
|
||||
scm_url: https://github.com/ansible/test-playbooks
|
||||
wait: true
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Recreate the project to validate not changed
|
||||
project:
|
||||
name: "{{ project_name1 }}"
|
||||
|
||||
@@ -76,6 +76,42 @@
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Build a real schedule with exists
|
||||
schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: exists
|
||||
unified_job_template: "Demo Job Template"
|
||||
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Delete a real schedule
|
||||
schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: absent
|
||||
unified_job_template: "Demo Job Template"
|
||||
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Build a real schedule with exists
|
||||
schedule:
|
||||
name: "{{ sched1 }}"
|
||||
state: exists
|
||||
unified_job_template: "Demo Job Template"
|
||||
rrule: "DTSTART:20191219T130551Z RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=1"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Rebuild the same schedule
|
||||
schedule:
|
||||
name: "{{ sched1 }}"
|
||||
|
||||
@@ -34,6 +34,39 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a team with exists
|
||||
team:
|
||||
name: "{{ team_name }}"
|
||||
organization: Default
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete a team
|
||||
team:
|
||||
name: "{{ team_name }}"
|
||||
organization: Default
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a team with exists
|
||||
team:
|
||||
name: "{{ team_name }}"
|
||||
organization: Default
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete a team
|
||||
team:
|
||||
name: "{{ team_name }}"
|
||||
|
||||
@@ -20,6 +20,42 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a User with exists
|
||||
user:
|
||||
username: "{{ username }}"
|
||||
first_name: Joe
|
||||
password: "{{ 65535 | random | to_uuid }}"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete a User
|
||||
user:
|
||||
username: "{{ username }}"
|
||||
first_name: Joe
|
||||
password: "{{ 65535 | random | to_uuid }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a User with exists
|
||||
user:
|
||||
username: "{{ username }}"
|
||||
first_name: Joe
|
||||
password: "{{ 65535 | random | to_uuid }}"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Change a User by ID
|
||||
user:
|
||||
username: "{{ result.id }}"
|
||||
|
||||
@@ -254,6 +254,65 @@
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a workflow job template with exists
|
||||
workflow_job_template:
|
||||
name: "{{ wfjt_name }}"
|
||||
organization: Default
|
||||
inventory: Demo Inventory
|
||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||
labels:
|
||||
- "{{ lab1 }}"
|
||||
ask_inventory_on_launch: true
|
||||
ask_scm_branch_on_launch: true
|
||||
ask_limit_on_launch: true
|
||||
ask_tags_on_launch: true
|
||||
ask_variables_on_launch: true
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete a workflow job template
|
||||
workflow_job_template:
|
||||
name: "{{ wfjt_name }}"
|
||||
organization: Default
|
||||
inventory: Demo Inventory
|
||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||
labels:
|
||||
- "{{ lab1 }}"
|
||||
ask_inventory_on_launch: true
|
||||
ask_scm_branch_on_launch: true
|
||||
ask_limit_on_launch: true
|
||||
ask_tags_on_launch: true
|
||||
ask_variables_on_launch: true
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a workflow job template with exists
|
||||
workflow_job_template:
|
||||
name: "{{ wfjt_name }}"
|
||||
organization: Default
|
||||
inventory: Demo Inventory
|
||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||
# We don't try with the label here because after we delete the first WFJT the label is delete with it because it has no references
|
||||
ask_inventory_on_launch: true
|
||||
ask_scm_branch_on_launch: true
|
||||
ask_limit_on_launch: true
|
||||
ask_tags_on_launch: true
|
||||
ask_variables_on_launch: true
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a workflow job template with bad label
|
||||
workflow_job_template:
|
||||
name: "{{ wfjt_name }}"
|
||||
|
||||
Reference in New Issue
Block a user