netapp.ontap.na_ontap_security_certificates – NetApp ONTAP manage security certificates.
Note
This plugin is part of the netapp.ontap collection (version 21.14.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install netapp.ontap
.
To use it in a playbook, specify: netapp.ontap.na_ontap_security_certificates
.
New in version 20.7.0: of netapp.ontap
Synopsis
Install or delete security certificates on ONTAP. (Create and sign will come in a second iteration)
Requirements
The below requirements are needed on the host that executes this module.
Ansible 2.9
Python3 netapp-lib (2018.11.13) or later. Install using ‘pip install netapp-lib’
netapp-lib 2020.3.12 is strongly recommended as it provides better error reporting for connection issues.
A physical or virtual clustered Data ONTAP system. The modules support Data ONTAP 9.1 and onward.
REST support requires ONTAP 9.6 or later.
To enable http on the cluster you must run the following commands ‘set -privilege advanced;’ ‘system services web modify -http-enabled true;’
Parameters
Parameter |
Comments |
---|---|
path to SSL client cert file (.pem). not supported with python 2.6. |
|
Common name of the certificate. Required for create and install. If name is present, ignored for sign and delete. If name is absent or ignored, required for sign and delete. |
|
Certificate expiration time. Specifying an expiration time is recommended when creating a certificate. Can be provided when signing a certificate. |
|
Enable or disable a new feature. This can be used to enable an experimental feature or disable a new feature that breaks backward compatibility. Supported keys and values are subject to change without notice. Unknown keys are ignored. |
|
Hashing function. Can be provided when creating a self-signed certificate or when signing a certificate. Allowed values for create and sign are sha256, sha224, sha384, sha512. |
|
The hostname or IP address of the ONTAP instance. |
|
Override the default port (80 or 443) with this port |
|
Enable and disable https. Ignored when using REST as only https is supported. Ignored when using SSL certificate authentication as it requires SSL. Choices:
|
|
ONTAP 9.6 and 9.7 REST API does not support name. If set to true, no error is reported if name is present, and name is not used. Choices:
|
|
Chain of intermediate Certificates in PEM format. Only valid when installing a certificate. |
|
path to SSL client key file. |
|
Key size of the certificate in bits. Specifying a strong key size is recommended when creating a certificate. Ignored for sign and delete. |
|
The unique name of the security certificate per SVM. This parameter is not supported for ONTAP 9.6 or 9.7, as the REST API does not support it. If present with ONTAP 9.6 or 9.7, it is ignored by default, see ignore_name_if_not_supported. It is strongly recommended to use name for newer releases of ONTAP. |
|
The ontap api version to use |
|
Password for the specified user. |
|
Private key certificate in PEM format. Required when installing a CA-signed certificate. Ignored otherwise. |
|
Public key certificate in PEM format. Required when installing a certificate. Ignored otherwise. |
|
If present, the certificate identified by name and svm is used to sign the request. A signed certificate is returned. |
|
Whether the specified security certificate should exist or not. Choices:
|
|
The name of the SVM (vserver). If present, the certificate is installed in the SVM. If absent, the certificate is installed in the cluster. |
|
Type of certificate Required for create and install. If name is present, ignored for sign and delete. If name is absent or ignored, required for sign and delete. Choices:
|
|
REST API if supported by the target system for all the resources and attributes the module requires. Otherwise will revert to ZAPI. always – will always use the REST API never – will always use the ZAPI auto – will try to use the REST Api Default: “auto” |
|
This can be a Cluster-scoped or SVM-scoped account, depending on whether a Cluster-level or SVM-level API is required. For more information, please read the documentation https://mysupport.netapp.com/NOW/download/software/nmsdk/9.4/. Two authentication methods are supported
To use a certificate, the certificate must have been installed in the ONTAP cluster, and cert authentication must have been enabled. |
|
If set to This should only set to Choices:
|
Examples
- name: install certificate
na_ontap_security_certificates:
# <<: *cert_login
common_name: "{{ ontap_cert_common_name }}"
name: "{{ ontap_cert_name }}"
public_certificate: "{{ ssl_certificate }}"
type: client_ca
svm: "{{ vserver }}"
- name: create certificate
na_ontap_security_certificates:
# <<: *cert_login
common_name: "{{ ontap_cert_root_common_name }}"
name: "{{ ontap_cert_name }}"
type: root_ca
svm: "{{ vserver }}"
expiry_time: P365DT # one year
- name: sign certificate using newly create certificate
tags: sign_request
na_ontap_security_certificates:
# <<: *login
name: "{{ ontap_cert_name }}"
svm: "{{ vserver }}"
signing_request: |
-----BEGIN CERTIFICATE REQUEST-----
MIIChDCCAWwCAQAwPzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQH
DAlTdW5ueXZhbGUxDzANBgNVBAoMBk5ldEFwcDCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBALgXCj6Si/I4xLdV7wjWYTbt8jY20fQOjk/4E7yBT1vFBflE
ks6YDc6dhC2G18cnoj9E3DiR8lIHPoAlFB/VmBNDev3GZkbFlrbV7qYmf8OEx2H2
tAefgSP0jLmCHCN1yyhJoCG6FsAiD3tf6yoyFF6qS9ureGL0tCJJ/osx64WzUz+Q
EN8lx7VSxriEFMSjreXZDhUFaCdIYKKRENuEWyYvdy5cbBmczhuM8EP6peOVv5Hm
BJzPUDkq7oTtEHmttpATq2Y92qzNzETO0bXN5X/93AWri8/yEXdX+HEw1C/omtsE
jGsCXrCrIJ+DgUdT/GHNdBWlXl/cWGtEgEQ4vrUCAwEAAaAAMA0GCSqGSIb3DQEB
CwUAA4IBAQBjZNoQgr/JDm1T8zyRhLkl3zw4a16qKNu/MS7prqZHLVQgrptHRegU
Hbz11XoHfVOdbyuvtzEe95QsDd6FYCZ4qzZRF3se4IjMeqwdQZ5WP0/GFiwM8Uln
/0TCWjt759XMeUX7+wgOg5NRjJ660eWMXzu/UJf+vZO0Q2FiPIr13JvvY3TjT+9J
UUtK4r9PaUuOPN2YL9IQqSD3goh8302Qr3nBXUgjeUGLkgfUM5S39apund2hyTX2
JCLQsKr88pwU9iDho2tHLv/2QgLwNZLPu8V+7IGu6G4vB28lN4Uy7xbhxFOKtyWu
fK4sEdTw3B/aDN0tB8MHFdPYycNZsEac
-----END CERTIFICATE REQUEST-----
expiry_time: P180DT
- name: delete certificate
na_ontap_security_certificates:
# <<: *cert_login
state: absent
name: "{{ ontap_cert_name }}"
svm: "{{ vserver }}"
# For ONTAP 9.6 or 9.7, use common_name and type, in addition to, or in lieu of name
- name: install certificate
na_ontap_security_certificates:
# <<: *cert_login
common_name: "{{ ontap_cert_common_name }}"
public_certificate: "{{ ssl_certificate }}"
type: client_ca
svm: "{{ vserver }}"
- name: create certificate
na_ontap_security_certificates:
# <<: *cert_login
common_name: "{{ ontap_cert_root_common_name }}"
type: root_ca
svm: "{{ vserver }}"
expiry_time: P365DT # one year
- name: sign certificate using newly create certificate
tags: sign_request
na_ontap_security_certificates:
# <<: *login
common_name: "{{ ontap_cert_root_common_name }}"
type: root_ca
svm: "{{ vserver }}"
signing_request: |
-----BEGIN CERTIFICATE REQUEST-----
MIIChDCCAWwCAQAwPzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQH
DAlTdW5ueXZhbGUxDzANBgNVBAoMBk5ldEFwcDCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBALgXCj6Si/I4xLdV7wjWYTbt8jY20fQOjk/4E7yBT1vFBflE
ks6YDc6dhC2G18cnoj9E3DiR8lIHPoAlFB/VmBNDev3GZkbFlrbV7qYmf8OEx2H2
tAefgSP0jLmCHCN1yyhJoCG6FsAiD3tf6yoyFF6qS9ureGL0tCJJ/osx64WzUz+Q
EN8lx7VSxriEFMSjreXZDhUFaCdIYKKRENuEWyYvdy5cbBmczhuM8EP6peOVv5Hm
BJzPUDkq7oTtEHmttpATq2Y92qzNzETO0bXN5X/93AWri8/yEXdX+HEw1C/omtsE
jGsCXrCrIJ+DgUdT/GHNdBWlXl/cWGtEgEQ4vrUCAwEAAaAAMA0GCSqGSIb3DQEB
CwUAA4IBAQBjZNoQgr/JDm1T8zyRhLkl3zw4a16qKNu/MS7prqZHLVQgrptHRegU
Hbz11XoHfVOdbyuvtzEe95QsDd6FYCZ4qzZRF3se4IjMeqwdQZ5WP0/GFiwM8Uln
/0TCWjt759XMeUX7+wgOg5NRjJ660eWMXzu/UJf+vZO0Q2FiPIr13JvvY3TjT+9J
UUtK4r9PaUuOPN2YL9IQqSD3goh8302Qr3nBXUgjeUGLkgfUM5S39apund2hyTX2
JCLQsKr88pwU9iDho2tHLv/2QgLwNZLPu8V+7IGu6G4vB28lN4Uy7xbhxFOKtyWu
fK4sEdTw3B/aDN0tB8MHFdPYycNZsEac
-----END CERTIFICATE REQUEST-----
expiry_time: P180DT
- name: delete certificate
na_ontap_security_certificates:
# <<: *cert_login
state: absent
common_name: "{{ ontap_cert_root_common_name }}"
type: root_ca
name: "{{ ontap_cert_name }}"
svm: "{{ vserver }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Returns public_certificate when signing, empty for create, install, and delete. Returned: always Sample: “{ \”ontap_info\”: { \”public_certificate\”: \”—–BEGIN CERTIFICATE—– ……..—–END CERTIFICATE—– \” } }” |
Authors
NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>