Remove Collections module parameters deprecated in Controller 4.0.0

This commit is contained in:
beeankha
2021-08-03 12:35:11 -04:00
parent dae3f1a164
commit 9409dc0085
7 changed files with 201 additions and 767 deletions

View File

@@ -35,70 +35,24 @@
set_fact:
ssh_key_data: "{{ lookup('file', tempdir.stdout + '/id_rsa') }}"
- name: Test deprecation warnings
credential:
name: "{{ ssh_cred_name1 }}"
organization: Default
kind: ssh
authorize: false
authorize_password: 'test'
client: 'test'
security_token: 'test'
secret: 'test'
tenant: 'test'
subscription: 'test'
domain: 'test'
become_method: 'test'
become_username: 'test'
become_password: 'test'
vault_password: 'test'
project: 'test'
host: 'test'
username: 'test'
password: 'test'
ssh_key_data: 'test'
vault_id: 'test'
ssh_key_unlock: 'test'
state: absent
ignore_errors: true
register: result
- assert:
that:
- "'deprecations' in result"
# The 20 comes from the length of OLD_INPUT_NAMES + 1 for kind
- result['deprecations'] | length() == 20
- name: Create an Org-specific credential (old school)
- name: Create an Org-specific credential with an ID
credential:
name: "{{ ssh_cred_name1 }}"
organization: Default
credential_type: Machine
state: present
kind: ssh
register: result
- assert:
that:
- "result is changed"
- name: Re-create the Org-specific credential (new school) with an ID
credential:
name: "{{ result.id }}"
organization: Default
credential_type: 'Machine'
state: present
register: result
- assert:
that:
- "result is not changed"
- name: Delete a Org-specific credential
credential:
name: "{{ ssh_cred_name1 }}"
organization: Default
state: absent
kind: ssh
credential_type: Machine
register: result
- assert:
@@ -122,34 +76,14 @@
name: "{{ ssh_cred_name1 }}"
user: admin
state: absent
kind: ssh
credential_type: 'Machine'
register: result
- assert:
that:
- "result is changed"
- name: Create a valid SSH credential (old school)
credential:
name: "{{ ssh_cred_name2 }}"
organization: Default
state: present
kind: ssh
description: An example SSH credential
username: joe
password: secret
become_method: sudo
become_username: superuser
become_password: supersecret
ssh_key_data: "{{ ssh_key_data }}"
ssh_key_unlock: "passphrase"
register: result
- assert:
that:
- "result is changed"
- name: Create a valid SSH credential (new school)
- name: Create a valid SSH credential
credential:
name: "{{ ssh_cred_name2 }}"
organization: Default
@@ -166,13 +100,11 @@
ssh_key_unlock: "passphrase"
register: result
# This will be changed because we are setting ssh_key_data and ssh_key_unlock.
# These will come out as $encrypted$ which will always compare false to the values.
- assert:
that:
- result is changed
- name: Create a valid SSH credential (new school)
- name: Create a valid SSH credential
credential:
name: "{{ ssh_cred_name2 }}"
organization: Default
@@ -185,7 +117,6 @@
become_username: superuser
register: result
# This shows as "changed" because these listed inputs replace the existing inputs from the previous task
- assert:
that:
- result is changed
@@ -226,27 +157,7 @@
that:
- "result is changed"
- name: Create a valid SSH credential from lookup source (old school)
credential:
name: "{{ ssh_cred_name3 }}"
organization: Default
state: present
kind: ssh
description: An example SSH credential from lookup source
username: joe
password: secret
become_method: sudo
become_username: superuser
become_password: supersecret
ssh_key_data: "{{ lookup('file', tempdir.stdout + '/id_rsa') }}"
ssh_key_unlock: "passphrase"
register: result
- assert:
that:
- "result is changed"
- name: Create a valid SSH credential from lookup source (new school)
- name: Create a valid SSH credential from lookup source
credential:
name: "{{ ssh_cred_name3 }}"
organization: Default
@@ -263,42 +174,19 @@
ssh_key_unlock: "passphrase"
register: result
# This will be changed because we are passing in ssh_key_data and password
- assert:
that:
- result is changed
- name: Fail to create an SSH credential from a file source (old school format)
credential:
name: "{{ ssh_cred_name4 }}"
organization: Default
state: present
kind: ssh
description: An example SSH credential from file source
username: joe
password: secret
become_method: sudo
become_username: superuser
become_password: supersecret
ssh_key_data: "{{ tempdir.stdout }}/id_rsa"
ssh_key_unlock: "passphrase"
register: result
ignore_errors: true
- assert:
that:
- result is failed
- "'Unable to create credential {{ ssh_cred_name4 }}' in result.msg"
- "'Invalid certificate or key' in result.msg"
- name: Create an invalid SSH credential (passphrase required)
credential:
name: SSH Credential
organization: Default
state: present
kind: ssh
username: joe
ssh_key_data: "{{ ssh_key_data }}"
credential_type: Machine
inputs:
username: joe
ssh_key_data: "{{ ssh_key_data }}"
ignore_errors: true
register: result
@@ -312,8 +200,9 @@
name: SSH Credential
organization: Missing_Organization
state: present
kind: ssh
username: joe
credential_type: Machine
inputs:
username: joe
ignore_errors: true
register: result
@@ -329,7 +218,7 @@
name: "{{ ssh_cred_name2 }}"
organization: Default
state: absent
kind: ssh
credential_type: Machine
register: result
- assert:
@@ -341,7 +230,7 @@
name: "{{ ssh_cred_name3 }}"
organization: Default
state: absent
kind: ssh
credential_type: Machine
register: result
- assert:
@@ -353,7 +242,7 @@
name: "{{ ssh_cred_name4 }}"
organization: Default
state: absent
kind: ssh
credential_type: Machine
register: result
# This one was never really created so it shouldn't be deleted
@@ -366,9 +255,11 @@
name: "{{ vault_cred_name1 }}"
organization: Default
state: present
kind: vault
credential_type: Vault
description: An example Vault credential
vault_password: secret-vault
inputs:
vault_id: bar
vault_password: secret-vault
register: result
- assert:
@@ -380,7 +271,7 @@
name: "{{ vault_cred_name1 }}"
organization: Default
state: absent
kind: vault
credential_type: Vault
register: result
- assert:
@@ -392,7 +283,7 @@
name: "{{ vault_cred_name2 }}"
organization: Default
state: absent
kind: vault
credential_type: Vault
register: result
# The creation of vault_cred_name2 never worked so we shouldn't actually need to delete it
@@ -405,11 +296,12 @@
name: "{{ net_cred_name1 }}"
organization: Default
state: present
kind: net
username: joe
password: secret
authorize: true
authorize_password: authorize-me
credential_type: Network
inputs:
username: joe
password: secret
authorize: true
authorize_password: authorize-me
register: result
- assert:
@@ -421,7 +313,7 @@
name: "{{ net_cred_name1 }}"
organization: Default
state: absent
kind: net
credential_type: Network
register: result
- assert:
@@ -433,11 +325,12 @@
name: "{{ scm_cred_name1 }}"
organization: Default
state: present
kind: scm
username: joe
password: secret
ssh_key_data: "{{ ssh_key_data }}"
ssh_key_unlock: "passphrase"
credential_type: Source Control
inputs:
username: joe
password: secret
ssh_key_data: "{{ ssh_key_data }}"
ssh_key_unlock: "passphrase"
register: result
- assert:
@@ -449,7 +342,7 @@
name: "{{ scm_cred_name1 }}"
organization: Default
state: absent
kind: scm
credential_type: Source Control
register: result
- assert:
@@ -461,10 +354,11 @@
name: "{{ aws_cred_name1 }}"
organization: Default
state: present
kind: aws
username: joe
password: secret
security_token: aws-token
credential_type: Amazon Web Services
inputs:
username: joe
password: secret
security_token: aws-token
register: result
- assert:
@@ -476,7 +370,7 @@
name: "{{ aws_cred_name1 }}"
organization: Default
state: absent
kind: aws
credential_type: Amazon Web Services
register: result
- assert:
@@ -488,10 +382,11 @@
name: "{{ vmware_cred_name1 }}"
organization: Default
state: present
kind: vmware
host: https://example.org
username: joe
password: secret
credential_type: VMware vCenter
inputs:
host: https://example.org
username: joe
password: secret
register: result
- assert:
@@ -503,7 +398,7 @@
name: "{{ vmware_cred_name1 }}"
organization: Default
state: absent
kind: vmware
credential_type: VMware vCenter
register: result
- assert:
@@ -515,10 +410,11 @@
name: "{{ sat6_cred_name1 }}"
organization: Default
state: present
kind: satellite6
host: https://example.org
username: joe
password: secret
credential_type: Red Hat Satellite 6
inputs:
host: https://example.org
username: joe
password: secret
register: result
- assert:
@@ -530,7 +426,7 @@
name: "{{ sat6_cred_name1 }}"
organization: Default
state: absent
kind: satellite6
credential_type: Red Hat Satellite 6
register: result
- assert:
@@ -542,10 +438,11 @@
name: "{{ gce_cred_name1 }}"
organization: Default
state: present
kind: gce
username: joe
project: ABC123
ssh_key_data: "{{ ssh_key_data }}"
credential_type: Google Compute Engine
inputs:
username: joe
project: ABC123
ssh_key_data: "{{ ssh_key_data }}"
register: result
- assert:
@@ -557,7 +454,7 @@
name: "{{ gce_cred_name1 }}"
organization: Default
state: absent
kind: gce
credential_type: Google Compute Engine
register: result
- assert:
@@ -569,10 +466,11 @@
name: "{{ azurerm_cred_name1 }}"
organization: Default
state: present
kind: azure_rm
username: joe
password: secret
subscription: some-subscription
credential_type: Microsoft Azure Resource Manager
inputs:
username: joe
password: secret
subscription: some-subscription
register: result
- assert:
@@ -584,11 +482,12 @@
name: "{{ azurerm_cred_name1 }}"
organization: Default
state: present
kind: azure_rm
client: some-client
secret: some-secret
tenant: some-tenant
subscription: some-subscription
credential_type: Microsoft Azure Resource Manager
inputs:
client: some-client
secret: some-secret
tenant: some-tenant
subscription: some-subscription
register: result
- assert:
@@ -600,7 +499,7 @@
name: "{{ azurerm_cred_name1 }}"
organization: Default
state: absent
kind: azure_rm
credential_type: Microsoft Azure Resource Manager
register: result
- assert:
@@ -612,12 +511,13 @@
name: "{{ openstack_cred_name1 }}"
organization: Default
state: present
kind: openstack
host: https://keystone.example.org
username: joe
password: secret
project: tenant123
domain: some-domain
credential_type: OpenStack
inputs:
host: https://keystone.example.org
username: joe
password: secret
project: tenant123
domain: some-domain
register: result
- assert:
@@ -629,7 +529,7 @@
name: "{{ openstack_cred_name1 }}"
organization: Default
state: absent
kind: openstack
credential_type: OpenStack
register: result
- assert:
@@ -641,10 +541,11 @@
name: "{{ rhv_cred_name1 }}"
organization: Default
state: present
kind: rhv
host: https://example.org
username: joe
password: secret
credential_type: Red Hat Virtualization
inputs:
host: https://example.org
username: joe
password: secret
register: result
- assert:
@@ -656,7 +557,7 @@
name: "{{ rhv_cred_name1 }}"
organization: Default
state: absent
kind: rhv
credential_type: Red Hat Virtualization
register: result
- assert:
@@ -668,9 +569,10 @@
name: "{{ insights_cred_name1 }}"
organization: Default
state: present
kind: insights
username: joe
password: secret
credential_type: Insights
inputs:
username: joe
password: secret
register: result
- assert:
@@ -682,7 +584,7 @@
name: "{{ insights_cred_name1 }}"
organization: Default
state: absent
kind: insights
credential_type: Insights
register: result
- assert:
@@ -694,10 +596,11 @@
name: "{{ tower_cred_name1 }}"
organization: Default
state: present
kind: tower
host: https://controller.example.org
username: joe
password: secret
credential_type: Red Hat Ansible Automation Platform
inputs:
host: https://controller.example.org
username: joe
password: secret
register: result
- assert:
@@ -709,7 +612,7 @@
name: "{{ tower_cred_name1 }}"
organization: Default
state: absent
kind: tower
credential_type: Red Hat Ansible Automation Platform
register: result
- assert:
@@ -720,7 +623,7 @@
credential:
name: test-credential
description: Credential Description
kind: ssh
credential_type: Machine
organization: test-non-existing-org
state: present
register: result