2018-03-16 18:28:19 +01:00
|
|
|
- name: Create an SCM Credential
|
|
|
|
tower_credential:
|
|
|
|
name: SCM Credential for JT
|
|
|
|
organization: Default
|
|
|
|
kind: scm
|
|
|
|
|
|
|
|
- name: Create a Demo Project
|
|
|
|
tower_project:
|
|
|
|
name: Job Template Test Project
|
|
|
|
organization: Default
|
|
|
|
state: present
|
|
|
|
scm_type: git
|
|
|
|
scm_url: https://github.com/ansible/ansible-tower-samples.git
|
|
|
|
scm_credential: SCM Credential for JT
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Update the project (to clone the git repo)
|
|
|
|
uri:
|
|
|
|
url: "https://{{ lookup('env', 'TOWER_HOST') }}/api/v2/projects/{{ result.id }}/update/"
|
|
|
|
method: POST
|
|
|
|
user: "{{ lookup('env', 'TOWER_USERNAME') }}"
|
|
|
|
password: "{{ lookup('env', 'TOWER_PASSWORD') }}"
|
|
|
|
validate_certs: false
|
|
|
|
status_code: 202
|
|
|
|
force_basic_auth: true
|
|
|
|
|
|
|
|
- name: Wait for the project to be status=successful
|
|
|
|
uri:
|
|
|
|
url: "https://{{ lookup('env', 'TOWER_HOST') }}/api/v2/projects/{{ result.id }}/"
|
|
|
|
method: GET
|
|
|
|
user: "{{ lookup('env', 'TOWER_USERNAME') }}"
|
|
|
|
password: "{{ lookup('env', 'TOWER_PASSWORD') }}"
|
|
|
|
validate_certs: false
|
|
|
|
force_basic_auth: true
|
|
|
|
return_content: true
|
|
|
|
register: result
|
|
|
|
until: result.json.status == "successful"
|
2018-11-05 17:56:19 +01:00
|
|
|
retries: 60
|
2018-03-16 18:28:19 +01:00
|
|
|
delay: 1
|
|
|
|
|
|
|
|
- name: Create a Job Template
|
|
|
|
tower_job_template:
|
|
|
|
name: hello-world
|
|
|
|
project: Job Template Test Project
|
|
|
|
inventory: Demo Inventory
|
|
|
|
playbook: hello_world.yml
|
2018-06-05 07:33:51 +02:00
|
|
|
credential: Demo Credential
|
2018-03-16 18:28:19 +01:00
|
|
|
job_type: run
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result is changed"
|