digital_ocean_certificate – Manage certificates in DigitalOcean — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# digital_ocean_certificate – Manage certificates in DigitalOcean

New in version 2.5.

- Synopsis
- Parameters
- Notes
- Examples
- Status

## Synopsis

- Create, Retrieve and remove certificates DigitalOcean.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
certificate_chain - |  | The full PEM-formatted trust chain between the certificate authority's certificate and your domain's SSL certificate.
leaf_certificate - |  | A PEM-formatted public SSL Certificate.
name - / required |  | The name of the certificate.
oauth_token string |  | DigitalOcean OAuth token. There are several other environment variables which can be used to provide this value. i.e., - 'DO_API_TOKEN', 'DO_API_KEY', 'DO_OAUTH_TOKEN' and 'OAUTH_TOKEN' aliases: api_token
private_key - |  | A PEM-formatted private key content of SSL Certificate.
state - | Choices: present ← absent | Whether the certificate should be present or absent.
timeout integer | Default: 30 | The timeout in seconds used for polling DigitalOcean's API.
validate_certs boolean | Choices: no yes ← | If set to `no`, the SSL certificates will not be validated. This should only set to `no` used on personally controlled sites using self-signed certificates.

## Notes

Note

- Two environment variables can be used, DO_API_KEY, DO_OAUTH_TOKEN and DO_API_TOKEN. They both refer to the v2 token.

## Examples

    - name: create a certificate
      digital_ocean_certificate:
        name: production
        state: present
        private_key: "-----BEGIN PRIVATE KEY-----
    MIIEvgIBADANBgkqhkM8OI7pRpgyj1I
    -----END PRIVATE KEY-----"
        leaf_certificate: "-----BEGIN CERTIFICATE-----
    MIIFDmg2Iaw==
    -----END CERTIFICATE-----"
        oauth_token: b7d03a6947b217efb6f3ec3bd365652

    - name: create a certificate using file lookup plugin
      digital_ocean_certificate:
        name: production
        state: present
        private_key: "{{ lookup('file', 'test.key') }}"
        leaf_certificate: "{{ lookup('file', 'test.cert') }}"
        oauth_token: "{{ oauth_token }}"

    - name: create a certificate with trust chain
      digital_ocean_certificate:
        name: production
        state: present
        private_key: "{{ lookup('file', 'test.key') }}"
        leaf_certificate: "{{ lookup('file', 'test.cert') }}"
        certificate_chain: "{{ lookup('file', 'chain.cert') }}"
        oauth_token: "{{ oauth_token }}"

    - name: remove a certificate
      digital_ocean_certificate:
        name: production
        state: absent
        oauth_token: "{{ oauth_token }}"

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Abhijeet Kasurde (@Akasurde)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.