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
tasks:
- name: Hello Message
debug:
ansible.builtin.debug:
msg: "Hello World!"

View File

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

View File

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

View File

@ -1,11 +1,11 @@
---
- name: Generate a random string for test
set_fact:
ansible.builtin.set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined
- name: Generate usernames
set_fact:
ansible.builtin.set_fact:
usernames:
- "AWX-Collection-tests-api_lookup-user1-{{ test_id }}"
- "AWX-Collection-tests-api_lookup-user2-{{ test_id }}"
@ -20,7 +20,7 @@
register: controller_meta
- name: Generate the name of our plugin
set_fact:
ansible.builtin.set_fact:
plugin_name: "{{ controller_meta.prefix }}.controller_api"
- name: Create all of our users
@ -38,7 +38,7 @@
register: results
ignore_errors: true
- assert:
- ansible.builtin.assert:
that:
- "'dne' in (results.msg | lower)"
@ -49,48 +49,48 @@
loop: "{{ hosts }}"
- name: Test too many params (failure from validation of terms)
set_fact:
ansible.builtin.set_fact:
junk: "{{ query(plugin_name, 'users', 'teams', query_params={}, ) }}"
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- result is failed
- "'You must pass exactly one endpoint to query' in result.msg"
- name: Try to load invalid endpoint
set_fact:
ansible.builtin.set_fact:
junk: "{{ query(plugin_name, 'john', query_params={}, ) }}"
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- result is failed
- "'The requested object could not be found at' in result.msg"
- 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) }}"
- assert:
- ansible.builtin.assert:
that:
- users_list['results'] | length() == 1
- users_list['count'] == 1
- users_list['results'][0]['id'] == user_creation_results['results'][0]['id']
- 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 ) }}"
- assert:
- ansible.builtin.assert:
that:
- user_objects | length() == 1
- users_list['results'][0]['id'] == user_objects[0]['id']
- name: Loop over one user with the loop syntax
assert:
ansible.builtin.assert:
that:
- item['id'] == user_creation_results['results'][0]['id']
loop: "{{ query(plugin_name, 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] } ) }}"
@ -98,91 +98,91 @@
label: "{{ item.id }}"
- 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 ) }}"
- debug:
msg: "{{ users }}"
- name: Assert that user list has 2 ids only and that they are strings, not ints
assert:
- name: assert that user list has 2 ids only and that they are strings, not ints
ansible.builtin.assert:
that:
- users | length() == 2
- user_creation_results['results'][0]['id'] not in users
- user_creation_results['results'][0]['id'] | string in users
- 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 ) }}"
- assert:
- ansible.builtin.assert:
that:
- users | length() >= 3
- 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 ) }}"
ignore_errors: true
register: max_user_errors
- assert:
- ansible.builtin.assert:
that:
- 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"
- 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"
- 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) }}"
register: result
ignore_errors: true
- assert:
- ansible.builtin.assert:
that:
- result is failed
- "'Expected one object from endpoint users' in result['msg']"
- 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) }}"
register: results
ignore_errors: true
- assert:
- ansible.builtin.assert:
that:
- results is failed
- "'Expected one object from endpoint users, but obtained 3' in results['msg']"
- name: Get the ping page
set_fact:
ansible.builtin.set_fact:
ping_data: "{{ lookup(plugin_name, 'ping' ) }}"
register: results
- assert:
- ansible.builtin.assert:
that:
- results is succeeded
- "'active_node' in ping_data"
- 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) }}"
ignore_errors: true
register: results
- assert:
- ansible.builtin.assert:
that:
- 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"
# DOCS Example Tests
- name: Load the UI settings
set_fact:
ansible.builtin.set_fact:
controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/ui') }}"
- assert:
- ansible.builtin.assert:
that:
- "'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(', ') }}"
register: results
- assert:
- ansible.builtin.assert:
that:
- "'admin' in results.msg"
@ -211,7 +211,7 @@
register: role_revoke
when: "query('awx.awx.controller_api', 'users', query_params={ 'username': 'DNE_TESTING' }) | length == 1"
- assert:
- ansible.builtin.assert:
that:
- role_revoke is skipped
@ -227,7 +227,7 @@
) | map(attribute='name') | list }}
register: group_creation
- assert:
- ansible.builtin.assert:
that: group_creation is changed
always:

View File

@ -1,50 +1,50 @@
---
- name: Get our collection package
controller_meta:
awx.awx.controller_meta:
register: controller_meta
- name: Generate the name of our plugin
set_fact:
ansible.builtin.set_fact:
plugin_name: "{{ controller_meta.prefix }}.schedule_rrule"
- 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') }}"
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- result is failed
- "'You may only pass one schedule type in at a time' in result.msg"
- 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') }}"
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- result is failed
- "'Frequency of john is invalid' in result.msg"
- name: Test an invalid start date (generic failure case from get_rrule)
debug:
ansible.builtin.debug:
msg: "{{ query(plugin_name, 'none', start_date='invalid') }}"
ignore_errors: true
register: result
- assert:
- ansible.builtin.assert:
that:
- result is failed
- "'Parameter start_date must be in the format YYYY-MM-DD' in result.msg"
- 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') }}"
register: result
- assert:
- ansible.builtin.assert:
that:
- result.msg == 'DTSTART;TZID=America/New_York:20200416T034507 RRULE:FREQ=MINUTELY;COUNT=2;INTERVAL=1'

View File

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

View File

@ -10,7 +10,7 @@
test: ad_hoc_command,host,role
tasks:
- name: DEBUG - make sure variables are what we expect
debug:
ansible.builtin.debug:
msg: |
Running tests at location:
{{ loc_tests }}
@ -18,7 +18,7 @@
{{ test | trim | split(',') }}
- 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_control:
loop_var: test_name

View File

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

View File

@ -13,12 +13,12 @@
cert_subject: "/C=US/ST=NC/L=Durham/O=awx/CN="
tasks:
- 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:
creates: "{{ public_key_file }}"
- name: Load certs, existing and new SAML settings
set_fact:
ansible.builtin.set_fact:
private_key: "{{ private_key_content }}"
public_key: "{{ public_key_content }}"
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') }}"
- name: Displauy existing SAML configuration
debug:
ansible.builtin.debug:
msg:
- "Here is your existing SAML configuration for reference:"
- "{{ existing_saml }}"
- "Here is your existing OIDC configuration for reference:"
- "{{ 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"
- name: Write out the existing content
copy:
ansible.builtin.copy:
dest: "../_sources/{{ item.filename }}"
content: "{{ item.content }}"
loop:
@ -65,7 +65,7 @@
validate_certs: False
- name: Get a keycloak token
uri:
ansible.builtin.uri:
url: "https://localhost:8443/auth/realms/master/protocol/openid-connect/token"
method: POST
body_format: form-urlencoded
@ -78,12 +78,12 @@
register: keycloak_response
- name: Template the AWX realm
template:
ansible.builtin.template:
src: keycloak.awx.realm.json.j2
dest: "{{ keycloak_realm_template }}"
- name: Create the AWX realm
uri:
ansible.builtin.uri:
url: "https://localhost:8443/auth/admin/realms"
method: POST
body_format: json

View File

@ -7,21 +7,21 @@
awx_host: "https://localhost:8043"
tasks:
- 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) }}"
new_ldap: "{{ lookup('template', 'ldap_settings.json.j2') }}"
- name: Display existing LDAP configuration
debug:
ansible.builtin.debug:
msg:
- "Here is your existing LDAP configuration for reference:"
- "{{ 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"
- name: Write out the existing content
copy:
ansible.builtin.copy:
dest: "../_sources/existing_ldap_adapter_settings.json"
content: "{{ existing_ldap }}"

View File

@ -26,21 +26,21 @@
ansible_connection: httpapi
- 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) }}"
new_logging: "{{ lookup('template', 'logging.json.j2') }}"
- name: Display existing Logging configuration
debug:
ansible.builtin.debug:
msg:
- "Here is your existing SAML configuration for reference:"
- "{{ existing_logging }}"
- 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
copy:
ansible.builtin.copy:
dest: "../_sources/existing_logging.json"
content: "{{ existing_logging }}"

View File

@ -7,21 +7,21 @@
awx_host: "https://localhost:8043"
tasks:
- 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) }}"
new_tacacs: "{{ lookup('template', 'tacacsplus_settings.json.j2') }}"
- name: Display existing tacacs+ configuration
debug:
ansible.builtin.debug:
msg:
- "Here is your existing tacacsplus configuration for reference:"
- "{{ 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"
- name: Write out the existing content
copy:
ansible.builtin.copy:
dest: "../_sources/existing_tacacsplus_adapter_settings.json"
content: "{{ existing_tacacs }}"

View File

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