-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iam_server_certificates - initial integration tests
- Loading branch information
Showing
3 changed files
with
311 additions
and
4 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
tests/integration/targets/iam_server_certificate/defaults/main.yml
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
--- | ||
cert_name: 'ansible-test-{{ tiny_prefix }}' |
65 changes: 65 additions & 0 deletions
65
tests/integration/targets/iam_server_certificate/tasks/generate-certs.yml
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
################################################ | ||
# Setup SSL certs to store in IAM | ||
################################################ | ||
- name: 'Generate SSL Keys' | ||
community.crypto.openssl_privatekey: | ||
path: '{{ remote_tmp_dir }}/{{ item }}-key.pem' | ||
size: 2048 | ||
loop: | ||
- 'ca' | ||
- 'cert1' | ||
- 'cert2' | ||
|
||
- name: 'Generate CSRs' | ||
community.crypto.openssl_csr: | ||
path: '{{ remote_tmp_dir }}/{{ item }}.csr' | ||
privatekey_path: '{{ remote_tmp_dir }}/{{ item }}-key.pem' | ||
common_name: '{{ item }}.ansible.test' | ||
subject_alt_name: 'DNS:{{ item }}.ansible.test' | ||
basic_constraints: | ||
- 'CA:TRUE' | ||
loop: | ||
- 'ca' | ||
- 'cert1' | ||
- 'cert2' | ||
|
||
- name: 'Self-sign the "root"' | ||
community.crypto.x509_certificate: | ||
provider: selfsigned | ||
path: '{{ remote_tmp_dir }}/ca.pem' | ||
privatekey_path: '{{ remote_tmp_dir }}/ca-key.pem' | ||
csr_path: '{{ remote_tmp_dir }}/ca.csr' | ||
|
||
- name: 'Sign the intermediate cert' | ||
community.crypto.x509_certificate: | ||
provider: ownca | ||
path: '{{ remote_tmp_dir }}/cert1.pem' | ||
csr_path: '{{ remote_tmp_dir }}/cert1.csr' | ||
ownca_path: '{{ remote_tmp_dir }}/ca.pem' | ||
ownca_privatekey_path: '{{ remote_tmp_dir }}/ca-key.pem' | ||
|
||
- name: 'Sign the end-cert' | ||
community.crypto.x509_certificate: | ||
provider: ownca | ||
path: '{{ remote_tmp_dir }}/cert2.pem' | ||
csr_path: '{{ remote_tmp_dir }}/cert2.csr' | ||
ownca_path: '{{ remote_tmp_dir }}/cert1.pem' | ||
ownca_privatekey_path: '{{ remote_tmp_dir }}/cert1-key.pem' | ||
|
||
- name: 'Re-Sign the end-cert' | ||
community.crypto.x509_certificate: | ||
provider: ownca | ||
path: '{{ remote_tmp_dir }}/cert2-new.pem' | ||
csr_path: '{{ remote_tmp_dir }}/cert2.csr' | ||
ownca_path: '{{ remote_tmp_dir }}/cert1.pem' | ||
ownca_privatekey_path: '{{ remote_tmp_dir }}/cert1-key.pem' | ||
|
||
- set_fact: | ||
path_ca_cert: '{{ remote_tmp_dir }}/ca.pem' | ||
path_ca_key: '{{ remote_tmp_dir }}/ca-key.pem' | ||
path_intermediate_cert: '{{ remote_tmp_dir }}/cert1.pem' | ||
path_intermediate_key: '{{ remote_tmp_dir }}/cert1-key.pem' | ||
# Same key, updated cert | ||
path_cert_a: '{{ remote_tmp_dir }}/cert2.pem' | ||
path_cert_b: '{{ remote_tmp_dir }}/cert2-new.pem' | ||
path_cert_key: '{{ remote_tmp_dir }}/cert2-key.pem' |
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