GithubHelp home page GithubHelp logo

ansible-letsencrypt's Introduction

Ansible Galaxy License

Ansible LetsEncrypt

A role to automate LetsEncrypt certificates.

Stability: beta.

What does it do?

This role will pull in the official Certbot client, install it and issue or renew a certificate with your chosen domain.

Functionality as follows:

  • Tested on Ubuntu 14.04 and Debian 8
  • One domain per role include only
  • Runs in certonly mode only

PR's are welcome to include more functionality.

More detail

  • The client will be installed in /opt/certbot as root

  • Each run will pull in the Certbot client code from a proven release version. You can set a specific Certbot version using the variable letsencrypt_certbot_version.

  • A list of services to be stopped before and (re-)started after obtaining a new certificate can be configured using the variable letsencrypt_pause_services.

  • certonly mode is used, which means no automatic web server installation

  • After cert issuing, you can find it in /etc/letsencrypt/live/<domainname>

    • Tip, use this in your Apache2 config, for example, in your main role. Just make sure not to try and start Apache2 with the virtualhost active without the LetsEncrypt role running first!

      SSLCertificateFile /etc/letsencrypt/live/{{ hostname }}/cert.pem
      SSLCertificateKeyFile /etc/letsencrypt/live/{{ hostname }}/privkey.pem
      SSLCertificateChainFile /etc/letsencrypt/live/{{ hostname }}/chain.pem
      
  • Note! If this role fails in the cert request part, you might have stopped services - take care!

  • If the cert has been requested before, this role will automatically try to renew it, if possible. Disable this functionality by setting letsencrypt_force_renew to false. No renewal will be attempted in this case if cert is not due for renewal.

  • A www. subdomain will automatically be requested along with the certificate.

    • To disable this behaviour, set letsencrypt_request_www to false in your vars.

Requirements

Tested with the following:

  • Ubuntu 14.04 and Debian 8
  • Apache2 and Nginx
  • Ansible 1.9 / 2.x

Role Variables

Required

  • letsencrypt_domain - Domain the certificate is for.
  • letsencrypt_email - Your email as certificate owner.

Optional

  • letsencrypt_certbot_args - Additional command line args to Certbot.
  • letsencrypt_certbot_verbose - Make Certbot output to console (default true).
  • letsencrypt_certbot_version - Set specific Certbot version, for example a git tag or branch. Note that the lowest version of Certbot we support is 0.6.0.
  • letsencrypt_force_renew - Whether to attempt renewal always, default to true.
  • letsencrypt_pause_services - List of services to stop/start while calling Certbot.
  • letsencrypt_request_www - Request www. automatically (default true).

Example Playbook

This role works best when included just before your main site role, for example. Or it can be used in an individual playbook, for example as below.

This role should become root on the target host.

---
- hosts: myhost
  become: yes
  become_user: root
  roles:
    - role: ansible-letsencrypt
      letsencrypt_email: [email protected]
      letsencrypt_domain: example.com
      letsencrypt_pause_services:
        - apache2

License

MIT

Author Information

Jason Robinson (@jaywink) - [email protected] - https://iliketoast.net/u/jaywink - https://twitter.com/jaywink

Special thanks to Stefan Grönke (@gronke) for his work on expanding this role.

See CONTRIBUTORS for a full list of contributors.

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.