From 4f61bb06a8e4be7808c381c56328d8ceec0c936e Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 10 Mar 2022 16:26:48 -0500 Subject: [PATCH] remove need for job-launch.yml; inmem-test.yml updated to use a random host if none defined; add notes for lab re-creation --- inmem-test.yml | 16 +++- notes/aap_lab_notes.txt | 161 ++++++++++++++++++++++++++++++++++ utils/provision_tower_test.sh | 4 +- 3 files changed, 175 insertions(+), 6 deletions(-) create mode 100644 notes/aap_lab_notes.txt diff --git a/inmem-test.yml b/inmem-test.yml index 8457d09..4217492 100644 --- a/inmem-test.yml +++ b/inmem-test.yml @@ -1,16 +1,24 @@ --- -- name: Create inventory based on passed extra_vars +- name: Run a series of tasks, with exception handling, on a given host hosts: localhost gather_facts: no become: no + vars_files: + - vars/defaults.yml + vars: - provision_host: "{{ tower_provision_host | default('localhost') }}" + lab_tower_hosts: + - lab-dev-1 + - lab-dev-2 + - lab-prod-1 + - lab-prod-2 + provision_host : "{{ tower_provision_host | default(lab_tower_hosts | random) }}" tasks: - - name : "Create in-memory inventory for {{ provision_host }}" + - name : "Create in-memory inventory to run against" add_host : name : "{{ provision_host }}" groups : @@ -59,7 +67,7 @@ - name : Return job data to originating source - no_log : no + no_log : yes uri : url : "{{ gitlab_commit_url }}" headers : diff --git a/notes/aap_lab_notes.txt b/notes/aap_lab_notes.txt new file mode 100644 index 0000000..92b1652 --- /dev/null +++ b/notes/aap_lab_notes.txt @@ -0,0 +1,161 @@ +------------------------------------------------------------------------------- +WEBHOOK TOKENS +------------------------------------------------------------------------------- +https://tower2.thezengarden.net/api/v2/job_templates/10/gitlab/ - job_launch_test +HqaER9o3nZ3Uwp1iNSQbEGXx9BB0HmqqmJ2M60RVE8nGHMEgLP + + +https://tower2.thezengarden.net/api/v2/job_templates/11/gitlab/ - inmem_test +HOiDakG06mXKMTVybMCITf23CFu2Hp06ZVgj3sbnFaDT7shhh3 + + +https://tower2.thezengarden.net/api/v2/job_templates/12/gitlab/ - file_creation_test +Elv8XPQ1QGf4hcRcnFDF7yvV3iGe1Vbup0ASInVtyWpnZxA83m + + +https://tower2.thezengarden.net/api/v2/job_templates/13/gitlab/ - file_removal_test +Rdyn9S8Eccj4gmJgMxKngYMf5zouOH8OqIecQpEWWbzJpx980v + + +------------------------------------------------------------------------------- +CREDENTIALS +------------------------------------------------------------------------------- +Private Automation Hub - Community +9674d157d148c894c96563c57308ef7f9717da29 +https://hub.thezengarden.net/api/galaxy/content/community/ + + +Private Automation Hub - RH Certified +9674d157d148c894c96563c57308ef7f9717da29 +https://hub.thezengarden.net/api/galaxy/content/rh-certified/ + + +tower_tests_machine_cred +Machine +root + +tower_tests_tower_cred +Red Hat Ansible Automation Platform +https://tower2.thezengarden.net +admin + + +------------------------------------------------------------------------------- +PROJECTS +------------------------------------------------------------------------------- +tower_tests +Git +https://github.com/theZ3Ngarden/tower-tests.git +Clean/Delete + + + +------------------------------------------------------------------------------- +INVENTORIES +------------------------------------------------------------------------------- +tower_tests_inv + tower_tests_inv_src + Sourced from a Project + tower_tests + inventory/hosts + Overwrite/Overwrite variables/Update on project update + + +------------------------------------------------------------------------------- +ORGANIZATIONS +------------------------------------------------------------------------------- +Red Hat Consulting + Ansible Galaxy + Private Automation Hub - Community + Private Automation Hub - RH Certified + + +------------------------------------------------------------------------------- +NOTIFICATIONS +------------------------------------------------------------------------------- +gitlab_commit +Gitlab Project: tower-provision-status +Webhook +https://git.thezengarden.net/api/v4/projects/119/repository/commits +HTTP Method: POST + + HTTP Headers + ============ + { + "Content-type": "application/json", + "PRIVATE-TOKEN": "glpat-CyjgoyCBexN-gYrhpg6-" + } + + + Success message body + ==================== + { + "id": "119", + "branch": "main", + "commit_message": "Job {{ job.id }} - {{ job.name }} - completed in {{ job.elapsed }} seconds; Status: {{ job.status }}", + "author_name" : "Ansible Deploy - Test", + "author_email" : "naye.jokopuwo@thezengarden.net", + "actions": [{ + "action": "create", + "file_path": "successful_jobs/{{ job.id }}_{{ job.name }}.txt", + "content": "{{ job.status }}\n" + }] + } + + + Error message body + ================== + { + "id": "119", + "branch": "main", + "commit_message": "Job {{ job.id }} - {{ job.name }} - completed in {{ job.elapsed }} seconds; Status: {{ job.status }}", + "author_name" : "Ansible Deploy - Test", + "author_email" : "naye.jokopuwo@thezengarden.net", + "actions": [{ + "action": "create", + "file_path": "failed_jobs/{{ job.id }}_{{ job.name }}.txt", + "content": "{{ job.status }}\n" + }] + } + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + +tower_test +Webhook +admin/redhat +https://tower2.thezengarden.net/api/v2/job_templates/13/launch/ +HTTP Method: POST + + HTTP Headers + ============ + { + "Content-type": "application/json" + } + + + Success message body + ==================== + { + "extra_vars": { + "tower_provision_host": "lab-dev-1", + "tower_provision_rc" : "0", + "tower_provision_stdout" : "something or other", + "tower_provision_stderr" : "nah", + "tower_provision_msg" : "wut?" + } + } + + + Error message body + ================== + { + "extra_vars": { + "tower_provision_host": "lab-dev-1", + "tower_provision_rc" : "1", + "tower_provision_stdout" : "something or other", + "tower_provision_stderr" : "nah", + "tower_provision_msg" : "wut?" + } + } diff --git a/utils/provision_tower_test.sh b/utils/provision_tower_test.sh index 0076a3b..27c67e0 100755 --- a/utils/provision_tower_test.sh +++ b/utils/provision_tower_test.sh @@ -1,7 +1,7 @@ #!/bin/bash -CONC="20" -REQU="20" +CONC="50" +REQU="100" BASE_URL="tower2.thezengarden.net" AAP_JOB_ID="10"