java_cert role pkcs12 import (#24616)

* java_cert pkcs12 import

* documentation and formatting

* update examples

* update examples #2

* integration tests

* integration tests #2

* added aliases.txt

* renamed aliases

* bugfix

* empty it alieses
This commit is contained in:
tmarlok88 2017-08-22 09:45:30 +02:00 committed by Dag Wieers
commit 982e322287
5 changed files with 144 additions and 27 deletions

View file

@ -0,0 +1,3 @@
---
test_pkcs12_path: testpkcs.p12
test_keystore_path: keystore.jks

Binary file not shown.

View file

@ -0,0 +1,56 @@
---
- name: prep pkcs12 file
copy: src="{{ test_pkcs12_path }}" dest="{{output_dir}}/{{ test_pkcs12_path }}"
- name: import pkcs12
local_action:
module: java_cert
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
pkcs12_password: changeit
pkcs12_alias: default
cert_alias: default
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
keystore_create: yes
state: present
register: result_success
- name: verify success
assert:
that:
- result_success|success
- name: import pkcs12 with wrong password
local_action:
module: java_cert
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
pkcs12_password: wrong_pass
pkcs12_alias: default
cert_alias: default_new
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
keystore_create: yes
state: present
ignore_errors: true
register: result_wrong_pass
- name: verify fail with wrong import password
assert:
that:
- result_wrong_pass|failed
- name: test fail on mutually exclusive params
local_action:
module: java_cert
cert_path: ca.crt
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
cert_alias: default
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
keystore_create: yes
state: present
ignore_errors: true
register: result_excl_params
- name: verify failed exclusive params
assert:
that:
- result_excl_params|failed