ACI: Fix tests and add signature-based authentication test (#34758)
This commit is contained in:
parent
32ba02b626
commit
79d2f8a93a
1 changed files with 12 additions and 18 deletions
|
@ -2,11 +2,11 @@
|
||||||
# Copyright: (c) 2017, Dag Wieers (dagwieers) <dag@wieers.com>
|
# Copyright: (c) 2017, Dag Wieers (dagwieers) <dag@wieers.com>
|
||||||
#
|
#
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
|
||||||
- name: Test that we have an ACI APIC host, ACI username and ACI password
|
- name: Test that we have an ACI APIC host, ACI username and ACI password
|
||||||
fail:
|
fail:
|
||||||
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
|
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
|
||||||
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
|
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
|
||||||
|
|
||||||
|
|
||||||
# CLEAN ENVIRONMENT
|
# CLEAN ENVIRONMENT
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
user: admin
|
user: admin
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
|
|
||||||
# ADD USER CERTIFICATE
|
# ADD USER CERTIFICATE
|
||||||
|
@ -36,23 +35,19 @@
|
||||||
certificate: "{{ lookup('file', 'pki/admin.crt') }}"
|
certificate: "{{ lookup('file', 'pki/admin.crt') }}"
|
||||||
state: present
|
state: present
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
delegate_to: localhost
|
|
||||||
register: cm_add_cert
|
register: cm_add_cert
|
||||||
|
|
||||||
- name: Add user certificate (normal mode)
|
- name: Add user certificate (normal mode)
|
||||||
aci_aaa_user_certificate: *cert_present
|
aci_aaa_user_certificate: *cert_present
|
||||||
delegate_to: localhost
|
|
||||||
register: nm_add_cert
|
register: nm_add_cert
|
||||||
|
|
||||||
- name: Add user certificate again (check mode)
|
- name: Add user certificate again (check mode)
|
||||||
aci_aaa_user_certificate: *cert_present
|
aci_aaa_user_certificate: *cert_present
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
delegate_to: localhost
|
|
||||||
register: cm_add_cert_again
|
register: cm_add_cert_again
|
||||||
|
|
||||||
- name: Add user certificate again (normal mode)
|
- name: Add user certificate again (normal mode)
|
||||||
aci_aaa_user_certificate: *cert_present
|
aci_aaa_user_certificate: *cert_present
|
||||||
delegate_to: localhost
|
|
||||||
register: nm_add_cert_again
|
register: nm_add_cert_again
|
||||||
|
|
||||||
- name: Verify add_cert
|
- name: Verify add_cert
|
||||||
|
@ -63,22 +58,21 @@
|
||||||
|
|
||||||
|
|
||||||
# QUERY ALL USER CERTIFICATES
|
# QUERY ALL USER CERTIFICATES
|
||||||
- name: Query all user certificates (check_mode)
|
- name: Query all user certificates using signature-based authentication (check_mode)
|
||||||
aci_aaa_user_certificate: &cert_query
|
aci_aaa_user_certificate: &cert_query
|
||||||
hostname: '{{ aci_hostname }}'
|
hostname: '{{ aci_hostname }}'
|
||||||
username: '{{ aci_username }}'
|
username: '{{ aci_username }}'
|
||||||
password: '{{ aci_password }}'
|
#password: '{{ aci_password }}'
|
||||||
|
private_key: '{{ role_path }}/pki/admin.key'
|
||||||
use_proxy: no
|
use_proxy: no
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
user: admin
|
user: admin
|
||||||
state: query
|
state: query
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
delegate_to: localhost
|
|
||||||
register: cm_query_all_certs
|
register: cm_query_all_certs
|
||||||
|
|
||||||
- name: Query all user certificates (normal mode)
|
- name: Query all user certificates using signature-based authentication (normal mode)
|
||||||
aci_aaa_user_certificate: *cert_query
|
aci_aaa_user_certificate: *cert_query
|
||||||
delegate_to: localhost
|
|
||||||
register: nm_query_all_certs
|
register: nm_query_all_certs
|
||||||
|
|
||||||
- name: Verify query_all_certs
|
- name: Verify query_all_certs
|
||||||
|
@ -90,14 +84,14 @@
|
||||||
|
|
||||||
|
|
||||||
# QUERY OUR USER CERTIFICATE
|
# QUERY OUR USER CERTIFICATE
|
||||||
- name: Query our certificate (check_mode)
|
- name: Query our certificate using signature-based authentication (check_mode)
|
||||||
aci_aaa_user_certificate:
|
aci_aaa_user_certificate:
|
||||||
<<: *cert_query
|
<<: *cert_query
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: cm_query_cert
|
register: cm_query_cert
|
||||||
|
|
||||||
- name: Query our certificate (normal mode)
|
- name: Query our certificate using signature-based authentication (normal mode)
|
||||||
aci_aaa_user_certificate:
|
aci_aaa_user_certificate:
|
||||||
<<: *cert_query
|
<<: *cert_query
|
||||||
certificate_name: admin
|
certificate_name: admin
|
||||||
|
@ -112,21 +106,21 @@
|
||||||
|
|
||||||
# REMOVE CERTIFICATE
|
# REMOVE CERTIFICATE
|
||||||
- name: Remove certificate (check_mode)
|
- name: Remove certificate (check_mode)
|
||||||
aci_tenant: *cert_absent
|
aci_aaa_user_certificate: *cert_absent
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: cm_remove_cert
|
register: cm_remove_cert
|
||||||
|
|
||||||
- name: Remove certificate (normal mode)
|
- name: Remove certificate (normal mode)
|
||||||
aci_tenant: *cert_absent
|
aci_aaa_user_certificate: *cert_absent
|
||||||
register: nm_remove_cert
|
register: nm_remove_cert
|
||||||
|
|
||||||
- name: Remove certificate again (check_mode)
|
- name: Remove certificate again (check_mode)
|
||||||
aci_tenant: *cert_absent
|
aci_aaa_user_certificate: *cert_absent
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: cm_remove_cert_again
|
register: cm_remove_cert_again
|
||||||
|
|
||||||
- name: Remove certificate again (normal mode)
|
- name: Remove certificate again (normal mode)
|
||||||
aci_tenant: *cert_absent
|
aci_aaa_user_certificate: *cert_absent
|
||||||
register: nm_remove_cert_again
|
register: nm_remove_cert_again
|
||||||
|
|
||||||
- name: Verify remove_cert
|
- name: Verify remove_cert
|
||||||
|
|
Loading…
Reference in a new issue