---
- name: Issue simple self-signed certificate
  hosts: all

  vars:
    certificate_requests:
      - name: mycert_basic_self_signed
        dns: www.example.com
        ca: self-sign
  roles:
    - redhat.rhel_system_roles.certificate

- name: Verify certificate
  hosts: all
  vars:
    certificates:
      - path: /etc/pki/tls/certs/mycert_basic_self_signed.crt
        key_path: /etc/pki/tls/private/mycert_basic_self_signed.key
        subject:
          - name: commonName
            oid: 2.5.4.3
            value: www.example.com
        subject_alt_name:
          - name: DNS
            value: www.example.com
  tasks:
    - name: Verify each certificate
      include_tasks: tasks/assert_certificate_parameters.yml
      loop: "{{ certificates }}"
      loop_control:
        loop_var: cert
