-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_cert.yml
29 lines (25 loc) · 1.19 KB
/
list_cert.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
###############################################################################
# © Copyright IBM Corporation 2020, 2021
###############################################################################
- name: List certificates via TSO commands.
hosts: all
gather_facts: false
environment: "{{ environment_vars }}"
tasks:
- ansible.builtin.set_fact:
cert_type: "{{ cert_type | default('USER') }}" # CERTAUTH, SITE or USER
cert_label: "{{ cert_label | default('zosConnectServerCert2') }}"
owner_id: "{{ owner_id | default('STCUSR') }}" # Only required if cert_type is USER
- name: List cert, print results whether it exists or not.
block:
- name: 'Displaying cert {{ cert_label }}.'
vars:
format_cert_type: "{{ 'ID(' + owner_id + ')' if cert_type == 'USER' else cert_type }}"
ibm.ibm_zos_core.zos_tso_command:
commands: "RACDCERT {{ format_cert_type }} LIST(LABEL('{{ cert_label }}'))"
register: list_cert
failed_when: list_cert.output[0].rc > 4
always:
- name: Print results from list cert command.
ansible.builtin.debug:
var: list_cert.output[0].content