Giter Site home page Giter Site logo

ansible_local_certificate_authority_role's Introduction

local_certificate_authority

This role implements a local, in ansible certificate authority, such that:

  • private keys and certificates reside on the local host from which the playbook gets executed

  • private keys are encrypted and in ansible vaults

  • keys and certificates can be commited to git into the same repository where ansible playbooks live

  • key management can be done entirely locally

  • keys and certificates can be simply copied to the hosts where they are required

Once created, both keys and certificates will not be changed even if templates or parameters change.

Thus to create new keys/certificates, you must first remove the existing ones.

Requirements

The openssl binary needs to be available locally.

Role Variables

See defaults/main.yml for the parameters that can be set.

Dependencies

None

Example Playbook

- hosts: localhost
  vars:
    ca_dir: files/example_org_CA
    server_name: server.example.org
  roles:
     - role: tpo.local_certificate_authority/ca
       # is using playbook variables:
       # ca_dir: ...
       ca_name: "Example Org CA"
       ca_subj: "/C=CH/ST=GR/L=Maladers/O=Example Org/CN=Example Org CA"
       # Root CA certificate should be valid for 10 years
       ca_days: 3650

  roles:
     - role: tpo.local_certificate_authority/server_cert
       # is using playbook variables:
       # ca_dir: ...
       # server_name: ...
       server_subj: "/C=CH/ST=GR/L=Maladers/O=Example Org/CN={{ server_name }}"
       # server_subjectAlternativeName:
       # * optional
       # * set to DNS:server_name by default
       # Server certificate should be valid for 10 years
       server_days: 3650

  tasks:
    - name: verify generated certificates
      shell: openssl verify -CAfile {{ ca_dir }}/certs/ca.cert.pem {{ ca_dir }}/certs/{{ server_name }}.cert.pem
      changed_when: false # doesn't change anything

License

BSD

Author Information

Tomáš Pospíšek [email protected], http://sourcepole.ch

ansible_local_certificate_authority_role's People

Contributors

tpo avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.