Skip to content

Is openssl_csr_pipe check mode working as intended? #712

Open
@yann-soubeyrand

Description

@yann-soubeyrand

Hi,

When referencing an openssl_csr_pipe in an openssl_tls_certificate (see below), the check mode fails because the csr_content is empty. Looking at the code, shouldn’t this check be removed in order to always generate the CSR (since it’s a pipe resource)?

- name: "Create TLS certificate signing request"
  community.crypto.openssl_csr_pipe:
    common_name: "{{ ansible_fqdn }}"
    privatekey_path: "{{ postgresql_tls_key.filename }}"
    use_common_name_for_san: true
    subject_alt_name_critical: true
    basic_constraints:
      - "CA:FALSE"
    basic_constraints_critical: true
    key_usage:
      - "digitalSignature"
      - "keyEncipherment"
    key_usage_critical: true
  register: "postgresql_tls_csr"
  changed_when: "postgresql_tls_key is changed"

- name: "Create TLS certificate"
  community.crypto.x509_certificate:
    path: "{{ postgresql_tls_cert_path }}"
    state: "present"
    provider: "selfsigned"
    csr_content: "{{ postgresql_tls_csr.csr }}"
    privatekey_path: "{{ postgresql_tls_key.filename }}"
    owner: "root"
    group: "root"
    mode: "u=rw,g=r,o=r"
    return_content: true
  register: "postgresql_tls_cert"
  notify: "postgresql_service"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions