Caseraw / ansible_role_cacerts

Manage CA certs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ansible role CA Certs

Managing CA Certs.

License

MIT / BSD

Author Information

Requirements

  • Ensure a package manager is available and configured with the correct package sources and repositories.
  • Ensure privileged permissions are set for the user executing this role to:
    • Install packages.
    • Update system certificate files and trusts.

Dependencies

N/A

Compatibility

Compatible with the following list of operating systems:

  • CentOS 7
  • CentOS 8
  • RHEL 7.x
  • RHEL 8.x

Role Variables

Variable name Description
role_cacerts_required_package_list A per distribution package list.
role_cacerts_required_packages Rendered list of distribution package list.
role_cacerts_cert_list List of CA certificates to deploy or to remove.

Example Playbook

---
- name: Manage CA certs
  become: True
  gather_facts: True
  tasks:
    - import_role:
        name: ansible_role_cacerts
      vars:
        role_cacerts_required_package_list:
          RedHat_7:
            - ca-certificates
          RedHat_8:
            - ca-certificates
        role_cacerts_required_packages: '{{ role_cacerts_required_package_list[ansible_distribution + "_" + ansible_distribution_major_version] | default([]) }}'
        role_cacerts_cert_list:
          - src: 'example.crt'
            dest: '/etc/pki/ca-trust/source/anchors/example.crt'
            type: file
            state: pesent
          - src: 'https://certs.example.com/example.crt'
            dest: '/etc/pki/ca-trust/source/anchors/example.crt'
            type: url
            validate_certs: False
            state: pesent

...

Useful shell commands

N/A

Additional documentation resources

N/A

Testing with Molecule

This role is locally tested with the use of Molecule, the configuration is located at: molecule/default.
The Molecule tests are run (using the docker driver) on Dockerhub images built for this purpose:

CI/CD with Travis CI

This role uses Travis CI to run online tests with the use of Molecule and pushes notifications to import the role into Ansible Galaxy once the tests are successful. The Travis CI configuration is located at the root of the Ansible role .travis.yml

Useful links

About

Manage CA certs.