Update integration test playbooks to work with most current Collections modules

This commit is contained in:
beeankha
2021-08-17 13:29:33 -04:00
parent c58fef949d
commit c89296e76d
11 changed files with 93 additions and 69 deletions

View File

@@ -58,6 +58,16 @@
- results is failed
- "results['msg'] == 'Monitoring of ad hoc command aborted due to timeout'"
- block:
- name: "Wait for up to a minute until the job enters the can_cancel: False state"
debug:
msg: "The job can_cancel status has transitioned into False, we can proveed with testing"
until: not job_status
retries: 6
delay: 10
vars:
job_status: "{{ lookup('awx.awx.controller_api', 'ad_hoc_commands/'+ command.id | string +'/cancel')['can_cancel'] }}"
- name: Cancel the command with hard error if it's not running
ad_hoc_command_cancel:
command_id: "{{ command.id }}"

View File

@@ -26,7 +26,7 @@
credential:
name: "{{ cred_name1 }}"
organization: Default
kind: insights
credential_type: Insights
inputs:
username: joe
password: secret
@@ -180,5 +180,5 @@
credential:
name: "{{ cred_name1 }}"
organization: "Default"
kind: insights
credential_type: Insights
state: absent

View File

@@ -9,13 +9,14 @@
credential:
description: Credentials for Openstack Test project
name: "{{ openstack_cred }}"
kind: openstack
credential_type: OpenStack
organization: Default
project: Test
username: admin
host: https://example.org:5000
password: passw0rd
domain: test
inputs:
project: Test
username: admin
host: https://example.org:5000
password: passw0rd
domain: test
register: credential_result
- name: Add an inventory
@@ -57,13 +58,14 @@
credential:
description: Credentials for Openstack Test project
name: "{{ openstack_cred }}"
kind: openstack
credential_type: OpenStack
organization: Default
project: Test
username: admin
host: https://example.org:5000
password: passw0rd
domain: test
inputs:
project: Test
username: admin
host: https://example.org:5000
password: passw0rd
domain: test
state: absent
- assert:

View File

@@ -18,7 +18,7 @@
- name: Wait for a job template to complete
job_wait:
job_id: "{{ result.id }}"
max_interval: 10
interval: 10
timeout: 120
register: result
@@ -173,7 +173,7 @@
- name: Wait for a job template to complete
job_wait:
job_id: "{{ result.id }}"
max_interval: 10
interval: 10
timeout: 120
register: result

View File

@@ -37,20 +37,20 @@
credential:
name: "{{ cred1 }}"
organization: Default
kind: tower
credential_type: Red Hat Ansible Automation Platform
register: cred1_result
- name: Create Credential2
credential:
name: "{{ cred2 }}"
organization: Default
kind: ssh
credential_type: Machine
- name: Create Credential3
credential:
name: "{{ cred3 }}"
organization: Default
kind: ssh
credential_type: Machine
- name: Create Labels
label:
@@ -75,15 +75,16 @@
name: "{{ email_not }}"
organization: Default
notification_type: email
username: user
password: s3cr3t
sender: tower@example.com
recipients:
- user1@example.com
host: smtp.example.com
port: 25
use_tls: false
use_ssl: false
notification_configuration:
username: user
password: s3cr3t
sender: tower@example.com
recipients:
- user1@example.com
host: smtp.example.com
port: 25
use_tls: false
use_ssl: false
state: present
- name: Add webhook notification
@@ -91,9 +92,10 @@
name: "{{ webhook_not }}"
organization: Default
notification_type: webhook
url: http://www.example.com/hook
headers:
X-Custom-Header: value123
notification_configuration:
url: http://www.example.com/hook
headers:
X-Custom-Header: value123
state: present
register: result
@@ -386,21 +388,21 @@
credential:
name: "{{ cred1 }}"
organization: Default
kind: tower
credential_type: Red Hat Ansible Automation Platform
state: absent
- name: Delete Credential2
credential:
name: "{{ cred2 }}"
organization: Default
kind: ssh
credential_type: Machine
state: absent
- name: Delete Credential3
credential:
name: "{{ cred3 }}"
organization: Default
kind: ssh
credential_type: Machine
state: absent
# You can't delete a label directly so no cleanup needed

View File

@@ -14,7 +14,7 @@
credential:
name: "{{ scm_cred_name }}"
organization: Default
kind: scm
credential_type: Source Control
register: result
- assert:
@@ -59,7 +59,7 @@
- name: Create credential
credential:
kind: scm
credential_type: Source Control
name: "{{ cred_name }}"
organization: "{{ org_name }}"
register: result
@@ -207,7 +207,7 @@
credential:
name: "{{ scm_cred_name }}"
organization: Default
kind: scm
credential_type: Source Control
state: absent
register: result
@@ -228,7 +228,7 @@
- name: Delete credential
credential:
kind: scm
credential_type: Source Control
name: "{{ cred_name }}"
organization: "{{ org_name }}"
state: absent

View File

@@ -15,16 +15,17 @@
variables:
ansible_connection: local
- name: create an unused SSH / Machine credential
- name: Create an unused SSH / Machine credential
credential:
name: dummy
kind: ssh
ssh_key_data: |
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIUl6R1xgzR6siIUArz4XBPtGZ09aetma2eWf1v3uYymoAoGCCqGSM49
AwEHoUQDQgAENJNjgeZDAh/+BY860s0yqrLDprXJflY0GvHIr7lX3ieCtrzOMCVU
QWzw35pc5tvuP34SSi0ZE1E+7cVMDDOF3w==
-----END EC PRIVATE KEY-----
credential_type: Machine
inputs:
ssh_key_data: |
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIUl6R1xgzR6siIUArz4XBPtGZ09aetma2eWf1v3uYymoAoGCCqGSM49
AwEHoUQDQgAENJNjgeZDAh/+BY860s0yqrLDprXJflY0GvHIr7lX3ieCtrzOMCVU
QWzw35pc5tvuP34SSi0ZE1E+7cVMDDOF3w==
-----END EC PRIVATE KEY-----
organization: Default
- block:
@@ -51,5 +52,5 @@
- name: Delete dummy credential
credential:
name: dummy
kind: ssh
credential_type: Machine
state: absent

View File

@@ -1,16 +1,17 @@
---
- name: generate random string for project
- name: Generate random string for project
set_fact:
rand_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Generate manual project dir name
- name: Generate manual project name
set_fact:
project_name: "manual project {{ rand_string }}"
project_name: "Manual_Project_{{ rand_string }}"
- name: Generate manual project dir name
set_fact:
project_dir_name: "proj_{{ rand_string }}"
- name: create a project directory for manual project
- name: Create a project directory for manual project
import_tasks: create_project_dir.yml
- name: Create a manual project

View File

@@ -29,7 +29,7 @@
credential:
name: "{{ scm_cred_name }}"
organization: Default
kind: scm
credential_type: Source Control
register: result
- assert:
@@ -41,15 +41,16 @@
name: "{{ email_not }}"
organization: Default
notification_type: email
username: user
password: s3cr3t
sender: tower@example.com
recipients:
- user1@example.com
host: smtp.example.com
port: 25
use_tls: false
use_ssl: false
notification_configuration:
username: user
password: s3cr3t
sender: tower@example.com
recipients:
- user1@example.com
host: smtp.example.com
port: 25
use_tls: false
use_ssl: false
state: present
- name: Add webhook notification
@@ -57,9 +58,10 @@
name: "{{ webhook_not }}"
organization: Default
notification_type: webhook
url: http://www.example.com/hook
headers:
X-Custom-Header: value123
notification_configuration:
url: http://www.example.com/hook
headers:
X-Custom-Header: value123
state: present
register: result
@@ -664,7 +666,7 @@
credential:
name: "{{ scm_cred_name }}"
organization: Default
kind: scm
credential_type: Source Control
state: absent
register: result