Skip to content

Commit

Permalink
ACI: Fix tests and add signature-based authentication test (ansible#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers authored Jan 11, 2018
1 parent 32ba02b commit 79d2f8a
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions test/integration/targets/aci_aaa_user_certificate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +20,6 @@
user: admin
certificate_name: admin
state: absent
delegate_to: localhost


# ADD USER CERTIFICATE
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 79d2f8a

Please sign in to comment.