Skip to content

Commit

Permalink
crypto collections and slurp.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdebock committed Jun 1, 2021
1 parent 556d839 commit 5fa0d00
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
collections:
- name: community.docker
- name: community.general
- name: community.crypto
1 change: 1 addition & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ roles:
- name: robertdebock.python_pip
collections:
- name: ansible.posix
- name: community.crypto
8 changes: 4 additions & 4 deletions tasks/generate_ca_certs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ca_root_path: "{{ ca_path }}/rootCA"

- name: generate root ca certificate signing request
openssl_csr:
community.crypto.openssl_csr:
path: "{{ ca_root_path }}/{{ ca_root_csr_path }}"
privatekey_path: "{{ ca_root_path }}/{{ ca_root_privatekey_path }}"
privatekey_passphrase: "{{ ca_passphrase }}"
Expand All @@ -22,12 +22,12 @@
creates: "{{ ca_root_path }}/{{ ca_root_certificate_path }}"

- name: save root ca certificate
slurp:
ansible.builtin.slurp:
src: "{{ ca_root_path }}/{{ ca_root_certificate_path }}"
register: _cacert_root

- name: generate ca certificate signing request
openssl_csr:
community.crypto.openssl_csr:
path: "{{ ca_root_path }}/{{ ca_csr_path }}"
privatekey_path: "{{ ca_path }}/{{ ca_privatekey_path }}"
privatekey_passphrase: "{{ ca_passphrase }}"
Expand All @@ -45,7 +45,7 @@
creates: "{{ ca_root_path }}/{{ ca_certificate_path }}"

- name: save ca certificate
slurp:
ansible.builtin.slurp:
src: "{{ ca_root_path }}/{{ ca_certificate_path }}"
register: _cacert

Expand Down
2 changes: 1 addition & 1 deletion tasks/init_ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
mode: "0644"

- name: generate ca key
openssl_privatekey:
community.crypto.openssl_privatekey:
path: "{{ ca_path }}/{{ ca_privatekey_path }}"
passphrase: "{{ ca_passphrase }}"
cipher: auto
4 changes: 2 additions & 2 deletions tasks/requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- request.keyfile_path is defined

- name: generate requested key
openssl_privatekey:
community.crypto.openssl_privatekey:
path: "{{ ca_path }}/{{ ca_subject_keys_path }}/{{ request.name | default(request) }}.pem"
passphrase: "{{ request.passphrase | default(omit) }}"
cipher: "{{ request.cipher | default(omit) }}"
Expand All @@ -28,7 +28,7 @@
- request.keyfile_path is not defined

- name: generate requested certificate signing request
openssl_csr:
community.crypto.openssl_csr:
path: "{{ ca_path }}/{{ ca_requests_path }}/{{ request.name | default(request) }}.csr"
privatekey_path: "{{ ca_path }}/{{ ca_subject_keys_path }}/{{ request.name | default(request) }}.pem"
privatekey_passphrase: "{{ request.passphrase | default(omit) }}"
Expand Down

0 comments on commit 5fa0d00

Please sign in to comment.