-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Nguyen <[email protected]>
- Loading branch information
Showing
2 changed files
with
132 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
############################################################################### | ||
# © Copyright IBM Corporation 2024 | ||
############################################################################### | ||
|
||
- hosts: all | ||
collections: | ||
- ibm.ibm_zos_core | ||
gather_facts: false | ||
environment: "{{ environment_vars }}" | ||
vars: | ||
owner_id: 'STCUSR' | ||
cert_label: 'concertCertificateTest' | ||
sign_label: 'IBM CA' | ||
cn: 'share.centers.ihost.com:19999' | ||
altname: 'IP(192.148.8.225)' | ||
ou: 'Concert for Z' | ||
country: 'US' | ||
expiry_date: '2024-11-08' | ||
expiry_time: '10:06:00' # UTC time | ||
keyring: 'Keyring.CONCERT' | ||
check_name: 'IBMRACF,RACF_CERTIFICATE_EXPIRATION' | ||
|
||
tasks: | ||
- block: | ||
- name: Clean up certs and keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT ADDRING({{keyring}}) ID({{owner_id}}) | ||
- RACDCERT LISTRING({{keyring}}) ID({{ owner_id}}) | ||
register: tso_cmd_output | ||
ignore_errors: true | ||
|
||
- name: Create new self-signed USER cert and connect to keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT GENCERT ID({{owner_id}}) SUBJECTSDN(CN('{{cn}}') OU('{{ou}}') C('{{country}}')) WITHLABEL('{{cert_label}}') NOTAFTER(DATE({{expiry_date}}) TIME({{expiry_time}}) ) ALTNAME({{altname}}) | ||
- RACDCERT ID({{owner_id}}) CONNECT(LABEL('{{cert_label}}') RING({{keyring}}) DEFAULT) | ||
- RACDCERT LISTRING({{keyring}}) ID({{owner_id}}) | ||
- RACDCERT ID({{owner_id}}) ALTER(LABEL('{{cert_label}}')) TRUST | ||
- RACDCERT LISTCHAIN(LABEL('{{cert_label}}')) ID({{owner_id}}) | ||
when: sign_label == ' ' and not expiry_date == '' | ||
register: tso_cmd_output | ||
|
||
- name: Create new local-CA-signed USER cert and connect to keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT GENCERT ID({{owner_id}}) SUBJECTSDN(CN('{{cn}}') OU('{{ou}}') C('{{country}}')) WITHLABEL('{{cert_label}}') SIGNWITH(CERTAUTH LABEL('{{sign_label}}')) NOTAFTER(DATE({{expiry_date}}) TIME({{expiry_time}}) ) ALTNAME({{altname}}) | ||
- RACDCERT ID({{owner_id}}) CONNECT(LABEL('{{cert_label}}') RING({{keyring}}) DEFAULT) | ||
- RACDCERT LISTRING({{keyring}}) ID({{owner_id}}) | ||
- RACDCERT ID({{owner_id}}) ALTER(LABEL('{{cert_label}}')) TRUST | ||
- RACDCERT LISTCHAIN(LABEL('{{cert_label}}')) ID({{owner_id}}) | ||
when: not sign_label == ' ' and not expiry_date == '' | ||
register: tso_cmd_output | ||
|
||
- name: Create new self-signed USER cert and connect to keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT GENCERT ID({{owner_id}}) SUBJECTSDN(CN('{{cn}}') OU('{{ou}}') C('{{country}}')) WITHLABEL('{{cert_label}}') ALTNAME({{altname}}) | ||
- RACDCERT ID({{owner_id}}) CONNECT(LABEL('{{cert_label}}') RING({{keyring}}) DEFAULT) | ||
- RACDCERT LISTRING({{keyring}}) ID({{owner_id}}) | ||
- RACDCERT ID({{owner_id}}) ALTER(LABEL('{{cert_label}}')) TRUST | ||
- RACDCERT LISTCHAIN(LABEL('{{cert_label}}')) ID({{owner_id}}) | ||
when: sign_label == ' ' and expiry_date == '' | ||
register: tso_cmd_output | ||
|
||
- name: Create new local-CA-signed USER cert and connect to keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT GENCERT ID({{owner_id}}) SUBJECTSDN(CN('{{cn}}') OU('{{ou}}') C('{{country}}')) WITHLABEL('{{cert_label}}') SIGNWITH(CERTAUTH LABEL('{{sign_label}}')) ALTNAME({{altname}}) | ||
- RACDCERT ID({{owner_id}}) CONNECT(LABEL('{{cert_label}}') RING({{keyring}}) DEFAULT) | ||
- RACDCERT LISTRING({{keyring}}) ID({{owner_id}}) | ||
- RACDCERT ID({{owner_id}}) ALTER(LABEL('{{cert_label}}')) TRUST | ||
- RACDCERT LISTCHAIN (LABEL('{{cert_label}}')) ID({{owner_id}}) | ||
when: not sign_label == ' ' and expiry_date == '' | ||
register: tso_cmd_output | ||
|
||
- name: List keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT LISTRING({{keyring}}) ID({{ owner_id}}) | ||
ignore_errors: true | ||
register: tso_cmd_output |
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,50 @@ | ||
############################################################################### | ||
# © Copyright IBM Corporation 2024 | ||
############################################################################### | ||
|
||
- hosts: all | ||
collections: | ||
- ibm.ibm_zos_core | ||
gather_facts: false | ||
environment: "{{ environment_vars }}" | ||
vars: | ||
owner_id: 'STCUSR' | ||
cert_type: 'USER' | ||
cert_label: 'concertCertificateTest' | ||
keyring: 'Keyring.CONCERT' | ||
|
||
check_name: 'IBMRACF,RACF_CERTIFICATE_EXPIRATION' | ||
|
||
tasks: | ||
- name: Deleting cert {{cert_label}} | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT ID({{ owner_id}}) DELETE(LABEL('{{cert_label}}')) | ||
when: cert_type == 'USER' | ||
register: tso_cmd_output | ||
|
||
- name: Deleting cert {{cert_label}} | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT CERTAUTH DELETE(LABEL('{{cert_label}}')) | ||
when: cert_type == 'CERTAUTH' | ||
register: tso_cmd_output | ||
|
||
- name: Deleting cert {{cert_label}} | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT SITE DELETE(LABEL('{{cert_label}}')) | ||
when: cert_type == 'SITE' | ||
register: tso_cmd_output | ||
|
||
- name: Issue setropts refresh | ||
tags: refresh | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: SETROPTS RACLIST(DIGTCERT) REFRESH | ||
|
||
- name: Display keyring | ||
ibm.ibm_zos_core.zos_tso_command: | ||
commands: | ||
- RACDCERT LISTRING({{keyring}}) ID({{ owner_id}}) | ||
ignore_errors: true | ||
register: tso_cmd_output |