ACI: Fix tests and add signature-based authentication test (#34758)

This commit is contained in:
Dag Wieers 2018-01-11 21:28:42 +01:00 committed by GitHub
parent 32ba02b626
commit 79d2f8a93a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
# 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)
#
- name: Test that we have an ACI APIC host, ACI username and ACI password
fail:
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
@ -20,7 +20,6 @@
user: admin
certificate_name: admin
state: absent
delegate_to: localhost
# ADD USER CERTIFICATE
@ -36,23 +35,19 @@
certificate: "{{ lookup('file', 'pki/admin.crt') }}"
state: present
check_mode: yes
delegate_to: localhost
register: cm_add_cert
- name: Add user certificate (normal mode)
aci_aaa_user_certificate: *cert_present
delegate_to: localhost
register: nm_add_cert
- name: Add user certificate again (check mode)
aci_aaa_user_certificate: *cert_present
check_mode: yes
delegate_to: localhost
register: cm_add_cert_again
- name: Add user certificate again (normal mode)
aci_aaa_user_certificate: *cert_present
delegate_to: localhost
register: nm_add_cert_again
- name: Verify add_cert
@ -63,22 +58,21 @@
# 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
hostname: '{{ aci_hostname }}'
username: '{{ aci_username }}'
password: '{{ aci_password }}'
#password: '{{ aci_password }}'
private_key: '{{ role_path }}/pki/admin.key'
use_proxy: no
validate_certs: no
user: admin
state: query
check_mode: yes
delegate_to: localhost
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
delegate_to: localhost
register: nm_query_all_certs
- name: Verify query_all_certs
@ -90,14 +84,14 @@
# QUERY OUR USER CERTIFICATE
- name: Query our certificate (check_mode)
- name: Query our certificate using signature-based authentication (check_mode)
aci_aaa_user_certificate:
<<: *cert_query
certificate_name: admin
check_mode: yes
register: cm_query_cert
- name: Query our certificate (normal mode)
- name: Query our certificate using signature-based authentication (normal mode)
aci_aaa_user_certificate:
<<: *cert_query
certificate_name: admin
@ -112,21 +106,21 @@
# REMOVE CERTIFICATE
- name: Remove certificate (check_mode)
aci_tenant: *cert_absent
aci_aaa_user_certificate: *cert_absent
check_mode: yes
register: cm_remove_cert
- name: Remove certificate (normal mode)
aci_tenant: *cert_absent
aci_aaa_user_certificate: *cert_absent
register: nm_remove_cert
- name: Remove certificate again (check_mode)
aci_tenant: *cert_absent
aci_aaa_user_certificate: *cert_absent
check_mode: yes
register: cm_remove_cert_again
- name: Remove certificate again (normal mode)
aci_tenant: *cert_absent
aci_aaa_user_certificate: *cert_absent
register: nm_remove_cert_again
- name: Verify remove_cert