forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ACI: Fix tests and add signature-based authentication test (ansible#3…
- Loading branch information
Showing
1 changed file
with
12 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
# Copyright: (c) 2017, Dag Wieers (dagwieers) <[email protected]> | ||
# | ||
# 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.' | ||
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 | ||
|
@@ -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 | ||
|