update playbooks to use fqcn

Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
Adam Miller
2024-03-25 14:33:37 -05:00
committed by Chris Meyers
parent 0b5e59d9cb
commit 2034cca3a9
13 changed files with 132 additions and 132 deletions

View File

@@ -3,5 +3,5 @@
hosts: all hosts: all
tasks: tasks:
- name: Hello Message - name: Hello Message
debug: ansible.builtin.debug:
msg: "Hello World!" msg: "Hello World!"

View File

@@ -1,63 +1,63 @@
--- ---
- name: Generate a random string for test - name: Generate a random string for test
set_fact: ansible.builtin.set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined when: test_id is not defined
- name: Generate names - name: Generate names
set_fact: ansible.builtin.set_fact:
inv_name: "AWX-Collection-tests-ad_hoc_command_cancel-inventory-{{ test_id }}" inv_name: "AWX-Collection-tests-ad_hoc_command_cancel-inventory-{{ test_id }}"
ssh_cred_name: "AWX-Collection-tests-ad_hoc_command_cancel-ssh-cred-{{ test_id }}" ssh_cred_name: "AWX-Collection-tests-ad_hoc_command_cancel-ssh-cred-{{ test_id }}"
org_name: "AWX-Collection-tests-ad_hoc_command_cancel-org-{{ test_id }}" org_name: "AWX-Collection-tests-ad_hoc_command_cancel-org-{{ test_id }}"
- name: Create a New Organization - name: Create a New Organization
organization: awx.awx.organization:
name: "{{ org_name }}" name: "{{ org_name }}"
- name: Create an Inventory - name: Create an Inventory
inventory: awx.awx.inventory:
name: "{{ inv_name }}" name: "{{ inv_name }}"
organization: "{{ org_name }}" organization: "{{ org_name }}"
state: present state: present
- name: Add localhost to the Inventory - name: Add localhost to the Inventory
host: awx.awx.host:
name: localhost name: localhost
inventory: "{{ inv_name }}" inventory: "{{ inv_name }}"
variables: variables:
ansible_connection: local ansible_connection: local
- name: Create a Credential - name: Create a Credential
credential: awx.awx.credential:
name: "{{ ssh_cred_name }}" name: "{{ ssh_cred_name }}"
organization: "{{ org_name }}" organization: "{{ org_name }}"
credential_type: 'Machine' credential_type: 'Machine'
state: present state: present
- name: Launch an Ad Hoc Command - name: Launch an Ad Hoc Command
ad_hoc_command: awx.awx.ad_hoc_command:
inventory: "{{ inv_name }}" inventory: "{{ inv_name }}"
credential: "{{ ssh_cred_name }}" credential: "{{ ssh_cred_name }}"
module_name: "command" module_name: "command"
module_args: "sleep 100" module_args: "sleep 100"
register: command register: command
- assert: - ansible.builtin.assert:
that: that:
- "command is changed" - "command is changed"
- name: Cancel the command - name: Cancel the command
ad_hoc_command_cancel: awx.awx.ad_hoc_command_cancel:
command_id: "{{ command.id }}" command_id: "{{ command.id }}"
request_timeout: 60 request_timeout: 60
register: results register: results
- assert: - ansible.builtin.assert:
that: that:
- results is changed - results is changed
- name: "Wait for up to a minute until the job enters the can_cancel: False state" - name: "Wait for up to a minute until the job enters the can_cancel: False state"
debug: ansible.builtin.debug:
msg: "The job can_cancel status has transitioned into False, we can proceed with testing" msg: "The job can_cancel status has transitioned into False, we can proceed with testing"
until: not job_status until: not job_status
retries: 6 retries: 6
@@ -66,51 +66,51 @@
job_status: "{{ lookup('awx.awx.controller_api', 'ad_hoc_commands/'+ command.id | string +'/cancel')['can_cancel'] }}" 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 - name: Cancel the command with hard error if it's not running
ad_hoc_command_cancel: awx.awx.ad_hoc_command_cancel:
command_id: "{{ command.id }}" command_id: "{{ command.id }}"
fail_if_not_running: true fail_if_not_running: true
register: results register: results
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- results is failed - results is failed
- name: Cancel an already canceled command (assert failure) - name: Cancel an already canceled command (assert failure)
ad_hoc_command_cancel: awx.awx.ad_hoc_command_cancel:
command_id: "{{ command.id }}" command_id: "{{ command.id }}"
fail_if_not_running: true fail_if_not_running: true
register: results register: results
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- results is failed - results is failed
- name: Check module fails with correct msg - name: Check module fails with correct msg
ad_hoc_command_cancel: awx.awx.ad_hoc_command_cancel:
command_id: 9999999999 command_id: 9999999999
register: result register: result
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- "result.msg == 'Unable to find command with id 9999999999'" - "result.msg == 'Unable to find command with id 9999999999'"
- name: Delete the Credential - name: Delete the Credential
credential: awx.awx.credential:
name: "{{ ssh_cred_name }}" name: "{{ ssh_cred_name }}"
organization: "{{ org_name }}" organization: "{{ org_name }}"
credential_type: 'Machine' credential_type: 'Machine'
state: absent state: absent
- name: Delete the Inventory - name: Delete the Inventory
inventory: awx.awx.inventory:
name: "{{ inv_name }}" name: "{{ inv_name }}"
organization: "{{ org_name }}" organization: "{{ org_name }}"
state: absent state: absent
- name: Remove the Organization - name: Remove the Organization
organization: awx.awx.organization:
name: "{{ org_name }}" name: "{{ org_name }}"
state: absent state: absent

View File

@@ -1,23 +1,23 @@
--- ---
- name: Generate a test ID - name: Generate a test ID
set_fact: ansible.builtin.set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined when: test_id is not defined
- name: Generate hostnames - name: Generate hostnames
set_fact: ansible.builtin.set_fact:
hostname1: "AWX-Collection-tests-instance1.{{ test_id }}.example.com" hostname1: "AWX-Collection-tests-instance1.{{ test_id }}.example.com"
hostname2: "AWX-Collection-tests-instance2.{{ test_id }}.example.com" hostname2: "AWX-Collection-tests-instance2.{{ test_id }}.example.com"
hostname3: "AWX-Collection-tests-instance3.{{ test_id }}.example.com" hostname3: "AWX-Collection-tests-instance3.{{ test_id }}.example.com"
register: facts register: facts
- name: Get the k8s setting - name: Get the k8s setting
set_fact: ansible.builtin.set_fact:
IS_K8S: "{{ controller_settings['IS_K8S'] | default(False) }}" IS_K8S: "{{ controller_settings['IS_K8S'] | default(False) }}"
vars: vars:
controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/all') }}" controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/all') }}"
- debug: - ansible.builtin.debug:
msg: "Skipping instance test since this is instance is not running on a K8s platform" msg: "Skipping instance test since this is instance is not running on a K8s platform"
when: not IS_K8S when: not IS_K8S
@@ -32,7 +32,7 @@
- "{{ hostname2 }}" - "{{ hostname2 }}"
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed
@@ -44,7 +44,7 @@
capacity_adjustment: 0.4 capacity_adjustment: 0.4
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed
@@ -54,7 +54,7 @@
capacity_adjustment: 0.7 capacity_adjustment: 0.7
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed
@@ -78,7 +78,7 @@
node_state: installed node_state: installed
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed
@@ -89,7 +89,7 @@
node_state: installed node_state: installed
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed
@@ -103,7 +103,7 @@
- "{{ hostname2 }}" - "{{ hostname2 }}"
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed
@@ -115,7 +115,7 @@
peers: [] peers: []
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is changed - result is changed

View File

@@ -1,11 +1,11 @@
--- ---
- name: Generate a random string for test - name: Generate a random string for test
set_fact: ansible.builtin.set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined when: test_id is not defined
- name: Generate usernames - name: Generate usernames
set_fact: ansible.builtin.set_fact:
usernames: usernames:
- "AWX-Collection-tests-api_lookup-user1-{{ test_id }}" - "AWX-Collection-tests-api_lookup-user1-{{ test_id }}"
- "AWX-Collection-tests-api_lookup-user2-{{ test_id }}" - "AWX-Collection-tests-api_lookup-user2-{{ test_id }}"
@@ -20,7 +20,7 @@
register: controller_meta register: controller_meta
- name: Generate the name of our plugin - name: Generate the name of our plugin
set_fact: ansible.builtin.set_fact:
plugin_name: "{{ controller_meta.prefix }}.controller_api" plugin_name: "{{ controller_meta.prefix }}.controller_api"
- name: Create all of our users - name: Create all of our users
@@ -38,7 +38,7 @@
register: results register: results
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- "'dne' in (results.msg | lower)" - "'dne' in (results.msg | lower)"
@@ -49,48 +49,48 @@
loop: "{{ hosts }}" loop: "{{ hosts }}"
- name: Test too many params (failure from validation of terms) - name: Test too many params (failure from validation of terms)
set_fact: ansible.builtin.set_fact:
junk: "{{ query(plugin_name, 'users', 'teams', query_params={}, ) }}" junk: "{{ query(plugin_name, 'users', 'teams', query_params={}, ) }}"
ignore_errors: true ignore_errors: true
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is failed - result is failed
- "'You must pass exactly one endpoint to query' in result.msg" - "'You must pass exactly one endpoint to query' in result.msg"
- name: Try to load invalid endpoint - name: Try to load invalid endpoint
set_fact: ansible.builtin.set_fact:
junk: "{{ query(plugin_name, 'john', query_params={}, ) }}" junk: "{{ query(plugin_name, 'john', query_params={}, ) }}"
ignore_errors: true ignore_errors: true
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is failed - result is failed
- "'The requested object could not be found at' in result.msg" - "'The requested object could not be found at' in result.msg"
- name: Load user of a specific name without promoting objects - name: Load user of a specific name without promoting objects
set_fact: ansible.builtin.set_fact:
users_list: "{{ lookup(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }, return_objects=False) }}" users_list: "{{ lookup(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }, return_objects=False) }}"
- assert: - ansible.builtin.assert:
that: that:
- users_list['results'] | length() == 1 - users_list['results'] | length() == 1
- users_list['count'] == 1 - users_list['count'] == 1
- users_list['results'][0]['id'] == user_creation_results['results'][0]['id'] - users_list['results'][0]['id'] == user_creation_results['results'][0]['id']
- name: Load user of a specific name with promoting objects - name: Load user of a specific name with promoting objects
set_fact: ansible.builtin.set_fact:
user_objects: "{{ query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }, return_objects=True ) }}" user_objects: "{{ query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }, return_objects=True ) }}"
- assert: - ansible.builtin.assert:
that: that:
- user_objects | length() == 1 - user_objects | length() == 1
- users_list['results'][0]['id'] == user_objects[0]['id'] - users_list['results'][0]['id'] == user_objects[0]['id']
- name: Loop over one user with the loop syntax - name: Loop over one user with the loop syntax
assert: ansible.builtin.assert:
that: that:
- item['id'] == user_creation_results['results'][0]['id'] - item['id'] == user_creation_results['results'][0]['id']
loop: "{{ query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] } ) }}" loop: "{{ query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] } ) }}"
@@ -98,91 +98,91 @@
label: "{{ item.id }}" label: "{{ item.id }}"
- name: Get a page of users as just ids - name: Get a page of users as just ids
set_fact: ansible.builtin.set_fact:
users: "{{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 2 }, return_ids=True ) }}" users: "{{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 2 }, return_ids=True ) }}"
- debug: - debug:
msg: "{{ users }}" msg: "{{ users }}"
- name: Assert that user list has 2 ids only and that they are strings, not ints - name: assert that user list has 2 ids only and that they are strings, not ints
assert: ansible.builtin.assert:
that: that:
- users | length() == 2 - users | length() == 2
- user_creation_results['results'][0]['id'] not in users - user_creation_results['results'][0]['id'] not in users
- user_creation_results['results'][0]['id'] | string in users - user_creation_results['results'][0]['id'] | string in users
- name: Get all users of a system through next attribute - name: Get all users of a system through next attribute
set_fact: ansible.builtin.set_fact:
users: "{{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 1 }, return_all=true ) }}" users: "{{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 1 }, return_all=true ) }}"
- assert: - ansible.builtin.assert:
that: that:
- users | length() >= 3 - users | length() >= 3
- name: Get all of the users created with a max_objects of 1 - name: Get all of the users created with a max_objects of 1
set_fact: ansible.builtin.set_fact:
users: "{{ lookup(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 1 }, return_all=true, max_objects=1 ) }}" users: "{{ lookup(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 1 }, return_all=true, max_objects=1 ) }}"
ignore_errors: true ignore_errors: true
register: max_user_errors register: max_user_errors
- assert: - ansible.builtin.assert:
that: that:
- max_user_errors is failed - max_user_errors is failed
- "'List view at users returned 3 objects, which is more than the maximum allowed by max_objects' in max_user_errors.msg" - "'List view at users returned 3 objects, which is more than the maximum allowed by max_objects' in max_user_errors.msg"
- name: Get the ID of the first user created and verify that it is correct - name: Get the ID of the first user created and verify that it is correct
assert: ansible.builtin.assert:
that: "query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }, return_ids=True)[0] == user_creation_results['results'][0]['id'] | string" that: "query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }, return_ids=True)[0] == user_creation_results['results'][0]['id'] | string"
- name: Try to get an ID of someone who does not exist - name: Try to get an ID of someone who does not exist
set_fact: ansible.builtin.set_fact:
failed_user_id: "{{ query(plugin_name, 'users', query_params={ 'username': 'john jacob jingleheimer schmidt' }, expect_one=True) }}" failed_user_id: "{{ query(plugin_name, 'users', query_params={ 'username': 'john jacob jingleheimer schmidt' }, expect_one=True) }}"
register: result register: result
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- result is failed - result is failed
- "'Expected one object from endpoint users' in result['msg']" - "'Expected one object from endpoint users' in result['msg']"
- name: Lookup too many users - name: Lookup too many users
set_fact: ansible.builtin.set_fact:
too_many_user_ids: " {{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id }, expect_one=True) }}" too_many_user_ids: " {{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id }, expect_one=True) }}"
register: results register: results
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- results is failed - results is failed
- "'Expected one object from endpoint users, but obtained 3' in results['msg']" - "'Expected one object from endpoint users, but obtained 3' in results['msg']"
- name: Get the ping page - name: Get the ping page
set_fact: ansible.builtin.set_fact:
ping_data: "{{ lookup(plugin_name, 'ping' ) }}" ping_data: "{{ lookup(plugin_name, 'ping' ) }}"
register: results register: results
- assert: - ansible.builtin.assert:
that: that:
- results is succeeded - results is succeeded
- "'active_node' in ping_data" - "'active_node' in ping_data"
- name: "Make sure that expect_objects fails on an API page" - name: "Make sure that expect_objects fails on an API page"
set_fact: ansible.builtin.set_fact:
my_var: "{{ lookup(plugin_name, 'settings/ui', expect_objects=True) }}" my_var: "{{ lookup(plugin_name, 'settings/ui', expect_objects=True) }}"
ignore_errors: true ignore_errors: true
register: results register: results
- assert: - ansible.builtin.assert:
that: that:
- results is failed - results is failed
- "'Did not obtain a list or detail view at settings/ui, and expect_objects or expect_one is set to True' in results.msg" - "'Did not obtain a list or detail view at settings/ui, and expect_objects or expect_one is set to True' in results.msg"
# DOCS Example Tests # DOCS Example Tests
- name: Load the UI settings - name: Load the UI settings
set_fact: ansible.builtin.set_fact:
controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}" controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}"
- assert: - ansible.builtin.assert:
that: that:
- "'CUSTOM_LOGO' in controller_settings" - "'CUSTOM_LOGO' in controller_settings"
@@ -191,7 +191,7 @@
msg: "Admin users: {{ query('awx.awx.controller_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}" msg: "Admin users: {{ query('awx.awx.controller_api', 'users', query_params={ 'is_superuser': true }) | map(attribute='username') | join(', ') }}"
register: results register: results
- assert: - ansible.builtin.assert:
that: that:
- "'admin' in results.msg" - "'admin' in results.msg"
@@ -211,7 +211,7 @@
register: role_revoke register: role_revoke
when: "query('awx.awx.controller_api', 'users', query_params={ 'username': 'DNE_TESTING' }) | length == 1" when: "query('awx.awx.controller_api', 'users', query_params={ 'username': 'DNE_TESTING' }) | length == 1"
- assert: - ansible.builtin.assert:
that: that:
- role_revoke is skipped - role_revoke is skipped
@@ -227,7 +227,7 @@
) | map(attribute='name') | list }} ) | map(attribute='name') | list }}
register: group_creation register: group_creation
- assert: - ansible.builtin.assert:
that: group_creation is changed that: group_creation is changed
always: always:

View File

@@ -1,50 +1,50 @@
--- ---
- name: Get our collection package - name: Get our collection package
controller_meta: awx.awx.controller_meta:
register: controller_meta register: controller_meta
- name: Generate the name of our plugin - name: Generate the name of our plugin
set_fact: ansible.builtin.set_fact:
plugin_name: "{{ controller_meta.prefix }}.schedule_rrule" plugin_name: "{{ controller_meta.prefix }}.schedule_rrule"
- name: Test too many params (failure from validation of terms) - name: Test too many params (failure from validation of terms)
debug: ansible.builtin.debug:
msg: "{{ query(plugin_name | string, 'none', 'weekly', start_date='2020-4-16 03:45:07') }}" msg: "{{ query(plugin_name | string, 'none', 'weekly', start_date='2020-4-16 03:45:07') }}"
ignore_errors: true ignore_errors: true
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is failed - result is failed
- "'You may only pass one schedule type in at a time' in result.msg" - "'You may only pass one schedule type in at a time' in result.msg"
- name: Test invalid frequency (failure from validation of term) - name: Test invalid frequency (failure from validation of term)
debug: ansible.builtin.debug:
msg: "{{ query(plugin_name, 'john', start_date='2020-4-16 03:45:07') }}" msg: "{{ query(plugin_name, 'john', start_date='2020-4-16 03:45:07') }}"
ignore_errors: true ignore_errors: true
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is failed - result is failed
- "'Frequency of john is invalid' in result.msg" - "'Frequency of john is invalid' in result.msg"
- name: Test an invalid start date (generic failure case from get_rrule) - name: Test an invalid start date (generic failure case from get_rrule)
debug: ansible.builtin.debug:
msg: "{{ query(plugin_name, 'none', start_date='invalid') }}" msg: "{{ query(plugin_name, 'none', start_date='invalid') }}"
ignore_errors: true ignore_errors: true
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result is failed - result is failed
- "'Parameter start_date must be in the format YYYY-MM-DD' in result.msg" - "'Parameter start_date must be in the format YYYY-MM-DD' in result.msg"
- name: Test end_on as count (generic success case) - name: Test end_on as count (generic success case)
debug: ansible.builtin.debug:
msg: "{{ query(plugin_name, 'minute', start_date='2020-4-16 03:45:07', end_on='2') }}" msg: "{{ query(plugin_name, 'minute', start_date='2020-4-16 03:45:07', end_on='2') }}"
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- result.msg == 'DTSTART;TZID=America/New_York:20200416T034507 RRULE:FREQ=MINUTELY;COUNT=2;INTERVAL=1' - result.msg == 'DTSTART;TZID=America/New_York:20200416T034507 RRULE:FREQ=MINUTELY;COUNT=2;INTERVAL=1'

View File

@@ -11,7 +11,7 @@
register: result register: result
- name: Changing setting to true should have changed the value - name: Changing setting to true should have changed the value
assert: ansible.builtin.assert:
that: that:
- "result is changed" - "result is changed"
@@ -22,7 +22,7 @@
register: result register: result
- name: Changing setting to true again should not change the value - name: Changing setting to true again should not change the value
assert: ansible.builtin.assert:
that: that:
- "result is not changed" - "result is not changed"
@@ -33,17 +33,17 @@
register: result register: result
- name: Changing setting back to false should have changed the value - name: Changing setting back to false should have changed the value
assert: ansible.builtin.assert:
that: that:
- "result is changed" - "result is changed"
- name: Set the value of AWX_ISOLATION_SHOW_PATHS to a baseline - name: Set the value of AWX_ISOLATION_SHOW_PATHS to a baseline
settings: awx.awx.settings:
name: AWX_ISOLATION_SHOW_PATHS name: AWX_ISOLATION_SHOW_PATHS
value: '["/var/lib/awx/projects/"]' value: '["/var/lib/awx/projects/"]'
- name: Set the value of AWX_ISOLATION_SHOW_PATHS to get an error back from the controller - name: Set the value of AWX_ISOLATION_SHOW_PATHS to get an error back from the controller
settings: awx.awx.settings:
settings: settings:
AWX_ISOLATION_SHOW_PATHS: AWX_ISOLATION_SHOW_PATHS:
'not': 'a valid' 'not': 'a valid'
@@ -51,75 +51,75 @@
register: result register: result
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- "result is failed" - "result is failed"
- name: Set the value of AWX_ISOLATION_SHOW_PATHS - name: Set the value of AWX_ISOLATION_SHOW_PATHS
settings: awx.awx.settings:
name: AWX_ISOLATION_SHOW_PATHS name: AWX_ISOLATION_SHOW_PATHS
value: '["/var/lib/awx/projects/", "/tmp"]' value: '["/var/lib/awx/projects/", "/tmp"]'
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- "result is changed" - "result is changed"
- name: Attempt to set the value of AWX_ISOLATION_BASE_PATH to what it already is - name: Attempt to set the value of AWX_ISOLATION_BASE_PATH to what it already is
settings: awx.awx.settings:
name: AWX_ISOLATION_BASE_PATH name: AWX_ISOLATION_BASE_PATH
value: /tmp value: /tmp
register: result register: result
- debug: - ansible.builtin.debug:
msg: "{{ result }}" msg: "{{ result }}"
- assert: - ansible.builtin.assert:
that: that:
- "result is not changed" - "result is not changed"
- name: Apply a single setting via settings - name: Apply a single setting via settings
settings: awx.awx.settings:
name: AWX_ISOLATION_SHOW_PATHS name: AWX_ISOLATION_SHOW_PATHS
value: '["/var/lib/awx/projects/", "/var/tmp"]' value: '["/var/lib/awx/projects/", "/var/tmp"]'
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- "result is changed" - "result is changed"
- name: Apply multiple setting via settings with no change - name: Apply multiple setting via settings with no change
settings: awx.awx.settings:
settings: settings:
AWX_ISOLATION_BASE_PATH: /tmp AWX_ISOLATION_BASE_PATH: /tmp
AWX_ISOLATION_SHOW_PATHS: ["/var/lib/awx/projects/", "/var/tmp"] AWX_ISOLATION_SHOW_PATHS: ["/var/lib/awx/projects/", "/var/tmp"]
register: result register: result
- debug: - ansible.builtin.debug:
msg: "{{ result }}" msg: "{{ result }}"
- assert: - ansible.builtin.assert:
that: that:
- "result is not changed" - "result is not changed"
- name: Apply multiple setting via settings with change - name: Apply multiple setting via settings with change
settings: awx.awx.settings:
settings: settings:
AWX_ISOLATION_BASE_PATH: /tmp AWX_ISOLATION_BASE_PATH: /tmp
AWX_ISOLATION_SHOW_PATHS: [] AWX_ISOLATION_SHOW_PATHS: []
register: result register: result
- assert: - ansible.builtin.assert:
that: that:
- "result is changed" - "result is changed"
- name: Handle an omit value - name: Handle an omit value
settings: awx.awx.settings:
name: AWX_ISOLATION_BASE_PATH name: AWX_ISOLATION_BASE_PATH
value: '{{ junk_var | default(omit) }}' value: '{{ junk_var | default(omit) }}'
register: result register: result
ignore_errors: true ignore_errors: true
- assert: - ansible.builtin.assert:
that: that:
- "'Unable to update settings' in result.msg" - "'Unable to update settings' in result.msg"

View File

@@ -10,7 +10,7 @@
test: ad_hoc_command,host,role test: ad_hoc_command,host,role
tasks: tasks:
- name: DEBUG - make sure variables are what we expect - name: DEBUG - make sure variables are what we expect
debug: ansible.builtin.debug:
msg: | msg: |
Running tests at location: Running tests at location:
{{ loc_tests }} {{ loc_tests }}
@@ -18,7 +18,7 @@
{{ test | trim | split(',') }} {{ test | trim | split(',') }}
- name: "Include test targets" - name: "Include test targets"
include_tasks: "{{ loc_tests }}{{ test_name }}/tasks/main.yml" ansible.builtin.include_tasks: "{{ loc_tests }}{{ test_name }}/tasks/main.yml"
loop: "{{ test | trim | split(',') }}" loop: "{{ test | trim | split(',') }}"
loop_control: loop_control:
loop_var: test_name loop_var: test_name

View File

@@ -1,27 +1,27 @@
--- ---
- name: Include pre-flight checks - name: Include pre-flight checks
include_tasks: preflight.yml ansible.builtin.include_tasks: preflight.yml
- name: Create _sources directory - name: Create _sources directory
file: ansible.builtin.file:
path: "{{ sources_dest }}" path: "{{ sources_dest }}"
state: 'directory' state: 'directory'
mode: '0700' mode: '0700'
- name: debug minikube_setup - name: debug minikube_setup
debug: ansible.builtin.debug:
var: minikube_setup var: minikube_setup
# Linux block # Linux block
- block: - block:
- name: Download Minikube - name: Download Minikube
get_url: ansible.builtin.get_url:
url: "{{ minikube_url_linux }}" url: "{{ minikube_url_linux }}"
dest: "{{ sources_dest }}/minikube" dest: "{{ sources_dest }}/minikube"
mode: 0755 mode: 0755
- name: Download Kubectl - name: Download Kubectl
get_url: ansible.builtin.get_url:
url: "{{ kubectl_url_linux }}" url: "{{ kubectl_url_linux }}"
dest: "{{ sources_dest }}/kubectl" dest: "{{ sources_dest }}/kubectl"
mode: 0755 mode: 0755
@@ -33,13 +33,13 @@
# MacOS block # MacOS block
- block: - block:
- name: Download Minikube - name: Download Minikube
get_url: ansible.builtin.get_url:
url: "{{ minikube_url_macos }}" url: "{{ minikube_url_macos }}"
dest: "{{ sources_dest }}/minikube" dest: "{{ sources_dest }}/minikube"
mode: 0755 mode: 0755
- name: Download Kubectl - name: Download Kubectl
get_url: ansible.builtin.get_url:
url: "{{ kubectl_url_macos }}" url: "{{ kubectl_url_macos }}"
dest: "{{ sources_dest }}/kubectl" dest: "{{ sources_dest }}/kubectl"
mode: 0755 mode: 0755
@@ -50,18 +50,18 @@
- block: - block:
- name: Starting Minikube - name: Starting Minikube
shell: "{{ sources_dest }}/minikube start --driver={{ driver }} --install-addons=true --addons={{ addons | join(',') }}" ansible.builtin.shell: "{{ sources_dest }}/minikube start --driver={{ driver }} --install-addons=true --addons={{ addons | join(',') }}"
register: minikube_stdout register: minikube_stdout
- name: Enable Ingress Controller on Minikube - name: Enable Ingress Controller on Minikube
shell: "{{ sources_dest }}/minikube addons enable ingress" ansible.builtin.shell: "{{ sources_dest }}/minikube addons enable ingress"
when: when:
- minikube_stdout.rc == 0 - minikube_stdout.rc == 0
register: _minikube_ingress register: _minikube_ingress
ignore_errors: true ignore_errors: true
- name: Show Minikube Ingress known-issue 7332 warning - name: Show Minikube Ingress known-issue 7332 warning
pause: ansible.builtin.pause:
seconds: 5 seconds: 5
prompt: "The Minikube Ingress addon has been disabled since it looks like you are hitting https://github.com/kubernetes/minikube/issues/7332" prompt: "The Minikube Ingress addon has been disabled since it looks like you are hitting https://github.com/kubernetes/minikube/issues/7332"
when: when:
@@ -90,13 +90,13 @@
register: _service_account_secret register: _service_account_secret
- name: Load Minikube Bearer Token - name: Load Minikube Bearer Token
set_fact: ansible.builtin.set_fact:
service_account_token: '{{ _service_account_secret["resources"][0]["data"]["token"] | b64decode }}' service_account_token: '{{ _service_account_secret["resources"][0]["data"]["token"] | b64decode }}'
when: when:
- _service_account_secret["resources"][0]["data"] | length - _service_account_secret["resources"][0]["data"] | length
- name: Render minikube credential JSON template - name: Render minikube credential JSON template
template: ansible.builtin.template:
src: bootstrap_minikube.py.j2 src: bootstrap_minikube.py.j2
dest: "{{ sources_dest }}/bootstrap_minikube.py" dest: "{{ sources_dest }}/bootstrap_minikube.py"
mode: '0600' mode: '0600'

View File

@@ -13,12 +13,12 @@
cert_subject: "/C=US/ST=NC/L=Durham/O=awx/CN=" cert_subject: "/C=US/ST=NC/L=Durham/O=awx/CN="
tasks: tasks:
- name: Generate certificates for keycloak - name: Generate certificates for keycloak
command: 'openssl req -new -x509 -days 365 -nodes -out {{ public_key_file }} -keyout {{ private_key_file }} -subj "{{ cert_subject }}"' ansible.builtin.command: 'openssl req -new -x509 -days 365 -nodes -out {{ public_key_file }} -keyout {{ private_key_file }} -subj "{{ cert_subject }}"'
args: args:
creates: "{{ public_key_file }}" creates: "{{ public_key_file }}"
- name: Load certs, existing and new SAML settings - name: Load certs, existing and new SAML settings
set_fact: ansible.builtin.set_fact:
private_key: "{{ private_key_content }}" private_key: "{{ private_key_content }}"
public_key: "{{ public_key_content }}" public_key: "{{ public_key_content }}"
public_key_trimmed: "{{ public_key_content | regex_replace('-----BEGIN CERTIFICATE-----\\\\n', '') | regex_replace('\\\\n-----END CERTIFICATE-----', '') }}" public_key_trimmed: "{{ public_key_content | regex_replace('-----BEGIN CERTIFICATE-----\\\\n', '') | regex_replace('\\\\n-----END CERTIFICATE-----', '') }}"
@@ -32,18 +32,18 @@
private_key_content: "{{ lookup('file', private_key_file) | regex_replace('\n', '\\\\n') }}" private_key_content: "{{ lookup('file', private_key_file) | regex_replace('\n', '\\\\n') }}"
- name: Displauy existing SAML configuration - name: Displauy existing SAML configuration
debug: ansible.builtin.debug:
msg: msg:
- "Here is your existing SAML configuration for reference:" - "Here is your existing SAML configuration for reference:"
- "{{ existing_saml }}" - "{{ existing_saml }}"
- "Here is your existing OIDC configuration for reference:" - "Here is your existing OIDC configuration for reference:"
- "{{ existing_oidc }}" - "{{ existing_oidc }}"
- pause: - ansible.builtin.pause:
prompt: "Continuing to run this will replace your existing saml and OIDC settings (displayed above). They will all be captured except for your private key. Be sure that is backed up before continuing" prompt: "Continuing to run this will replace your existing saml and OIDC settings (displayed above). They will all be captured except for your private key. Be sure that is backed up before continuing"
- name: Write out the existing content - name: Write out the existing content
copy: ansible.builtin.copy:
dest: "../_sources/{{ item.filename }}" dest: "../_sources/{{ item.filename }}"
content: "{{ item.content }}" content: "{{ item.content }}"
loop: loop:
@@ -65,7 +65,7 @@
validate_certs: False validate_certs: False
- name: Get a keycloak token - name: Get a keycloak token
uri: ansible.builtin.uri:
url: "https://localhost:8443/auth/realms/master/protocol/openid-connect/token" url: "https://localhost:8443/auth/realms/master/protocol/openid-connect/token"
method: POST method: POST
body_format: form-urlencoded body_format: form-urlencoded
@@ -78,12 +78,12 @@
register: keycloak_response register: keycloak_response
- name: Template the AWX realm - name: Template the AWX realm
template: ansible.builtin.template:
src: keycloak.awx.realm.json.j2 src: keycloak.awx.realm.json.j2
dest: "{{ keycloak_realm_template }}" dest: "{{ keycloak_realm_template }}"
- name: Create the AWX realm - name: Create the AWX realm
uri: ansible.builtin.uri:
url: "https://localhost:8443/auth/admin/realms" url: "https://localhost:8443/auth/admin/realms"
method: POST method: POST
body_format: json body_format: json

View File

@@ -7,21 +7,21 @@
awx_host: "https://localhost:8043" awx_host: "https://localhost:8043"
tasks: tasks:
- name: Load existing and new LDAP settings - name: Load existing and new LDAP settings
set_fact: ansible.builtin.set_fact:
existing_ldap: "{{ lookup('awx.awx.controller_api', 'settings/ldap', host=awx_host, verify_ssl=false) }}" existing_ldap: "{{ lookup('awx.awx.controller_api', 'settings/ldap', host=awx_host, verify_ssl=false) }}"
new_ldap: "{{ lookup('template', 'ldap_settings.json.j2') }}" new_ldap: "{{ lookup('template', 'ldap_settings.json.j2') }}"
- name: Display existing LDAP configuration - name: Display existing LDAP configuration
debug: ansible.builtin.debug:
msg: msg:
- "Here is your existing LDAP configuration for reference:" - "Here is your existing LDAP configuration for reference:"
- "{{ existing_ldap }}" - "{{ existing_ldap }}"
- pause: - ansible.builtin.pause:
prompt: "Continuing to run this will replace your existing ldap settings (displayed above). They will all be captured. Be sure that is backed up before continuing" prompt: "Continuing to run this will replace your existing ldap settings (displayed above). They will all be captured. Be sure that is backed up before continuing"
- name: Write out the existing content - name: Write out the existing content
copy: ansible.builtin.copy:
dest: "../_sources/existing_ldap_adapter_settings.json" dest: "../_sources/existing_ldap_adapter_settings.json"
content: "{{ existing_ldap }}" content: "{{ existing_ldap }}"

View File

@@ -26,21 +26,21 @@
ansible_connection: httpapi ansible_connection: httpapi
- name: Load existing and new Logging settings - name: Load existing and new Logging settings
set_fact: ansible.builtin.set_fact:
existing_logging: "{{ lookup('awx.awx.controller_api', 'settings/logging', host=awx_host, verify_ssl=false) }}" existing_logging: "{{ lookup('awx.awx.controller_api', 'settings/logging', host=awx_host, verify_ssl=false) }}"
new_logging: "{{ lookup('template', 'logging.json.j2') }}" new_logging: "{{ lookup('template', 'logging.json.j2') }}"
- name: Display existing Logging configuration - name: Display existing Logging configuration
debug: ansible.builtin.debug:
msg: msg:
- "Here is your existing SAML configuration for reference:" - "Here is your existing SAML configuration for reference:"
- "{{ existing_logging }}" - "{{ existing_logging }}"
- pause: - pause:
prompt: "Continuing to run this will replace your existing logging settings (displayed above). They will all be captured except for your connection password. Be sure that is backed up before continuing" ansible.builtin.prompt: "Continuing to run this will replace your existing logging settings (displayed above). They will all be captured except for your connection password. Be sure that is backed up before continuing"
- name: Write out the existing content - name: Write out the existing content
copy: ansible.builtin.copy:
dest: "../_sources/existing_logging.json" dest: "../_sources/existing_logging.json"
content: "{{ existing_logging }}" content: "{{ existing_logging }}"

View File

@@ -7,21 +7,21 @@
awx_host: "https://localhost:8043" awx_host: "https://localhost:8043"
tasks: tasks:
- name: Load existing and new tacacs+ settings - name: Load existing and new tacacs+ settings
set_fact: ansible.builtin.set_fact:
existing_tacacs: "{{ lookup('awx.awx.controller_api', 'settings/tacacsplus', host=awx_host, verify_ssl=false) }}" existing_tacacs: "{{ lookup('awx.awx.controller_api', 'settings/tacacsplus', host=awx_host, verify_ssl=false) }}"
new_tacacs: "{{ lookup('template', 'tacacsplus_settings.json.j2') }}" new_tacacs: "{{ lookup('template', 'tacacsplus_settings.json.j2') }}"
- name: Display existing tacacs+ configuration - name: Display existing tacacs+ configuration
debug: ansible.builtin.debug:
msg: msg:
- "Here is your existing tacacsplus configuration for reference:" - "Here is your existing tacacsplus configuration for reference:"
- "{{ existing_tacacs }}" - "{{ existing_tacacs }}"
- pause: - ansible.builtin.pause:
prompt: "Continuing to run this will replace your existing tacacs settings (displayed above). They will all be captured. Be sure that is backed up before continuing" prompt: "Continuing to run this will replace your existing tacacs settings (displayed above). They will all be captured. Be sure that is backed up before continuing"
- name: Write out the existing content - name: Write out the existing content
copy: ansible.builtin.copy:
dest: "../_sources/existing_tacacsplus_adapter_settings.json" dest: "../_sources/existing_tacacsplus_adapter_settings.json"
content: "{{ existing_tacacs }}" content: "{{ existing_tacacs }}"

View File

@@ -4,10 +4,10 @@
gather_facts: False gather_facts: False
tasks: tasks:
- name: Unseal the vault - name: Unseal the vault
include_role: ansible.builtin.include_role:
name: vault name: vault
tasks_from: unseal tasks_from: unseal
- name: Display root token - name: Display root token
debug: ansible.builtin.debug:
var: Initial_Root_Token var: Initial_Root_Token