pescobar.dehydrated

Estado de Construcción Ansible Galaxy

ansible-role-dehydrated

Instala el cliente letsencrypt/acme dehydrated

Variables del Rol

dehydrated_config_dir: "/etc/dehydrated"

dehydrated_wellknown_dir: "/var/www/dehydrated/"

dehydrated_certs_dir: "{{ dehydrated_config_dir }}/certs"

dehydrated_version: "master"

dehydrated_install_dir: "/usr/local/bin"

dehydrated_contact_email: "[email protected]"

dehydrated_domains:
  - "{{ ansible_fqdn }}"

dehydrated_hook_script_path: "{{ dehydrated_config_dir }}/hook.sh"

# este es el comando que se ejecuta cuando se despliega un nuevo certificado
# este comando está definido en la función deploy_cert() en
# el script hook de dehydrated
dehydrated_hook_deploy_cert_cmd: |
  systemctl reload httpd

Ejemplo de playbook (usando geerlingguy.apache)

- name: Configurar servidor web con ssl
  hosts: webserver
  gather_facts: True
  remote_user: root

  vars:

    dehydrated_contact_email: "[email protected]"

    vhost_public_domain: mycoolweb.com

    apache_global_vhost_settings: |
      DirectoryIndex index.php index.html
      Alias /.well-known/acme-challenge/ {{ dehydrated_wellknown_dir }}
      <Directory {{ dehydrated_wellknown_dir }} >
          Require all granted
      </Directory>

    apache_vhosts:
      - servername: "{{ vhost_public_domain }}"
        serveralias: "www.{{ vhost_public_domain }}"
        serveradmin: "{{ dehydrated_contact_email }}"
        documentroot: "/var/www/{{ vhost_public_domain }}"
        extra_parameters: |

          # redirigir todo el tráfico a https excepto las solicitudes de letsencrypt
          RewriteEngine On
          RewriteCond %{HTTPS} off
      RewriteCond %{REQUEST_URI} !^/.well-known/
          RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    apache_vhosts_ssl:
      - servername: "{{ vhost_public_domain }}"
        serveralias: "www.{{ vhost_public_domain }}"
        serveradmin: "{{ dehydrated_contact_email }}"
        documentroot: "/var/www/{{ vhost_public_domain }}"
        certificate_file: "{{ dehydrated_certs_dir }}/{{ vhost_public_domain }}/cert.pem"
        certificate_key_file: "{{ dehydrated_certs_dir }}/{{ vhost_public_domain }}/privkey.pem"
        certificate_chain_file: "{{ dehydrated_certs_dir }}/{{ vhost_public_domain }}/fullchain.pem"

    # esta var es requerida por el rol "geerlingguy.apache" para que
    # los vhosts ssl se configuren solo cuando existe el certificado ssl.
    apache_ignore_missing_ssl_certificate: false

  tasks:

    - name: Instalar y configurar el servidor web apache (sin ssl aún)
      import_role:
        name: geerlingguy.apache

    - name: Instalar el cliente letsencrypt/acme dehydrated
      import_role:
        name: ansible-role-dehydrated

    # ejecutar manejadores para habilitar la carpeta .well-known en apache y
    # dehydrated solicita los certificados ssl
    - meta: flush_handlers

    - name: Instalar y configurar el servidor web apache nuevamente (configurar vhosts ssl)
      import_role:
        name: geerlingguy.apache

Licencia

GPLv3

Información del Autor

Pablo Escobar

Acerca del proyecto

Install the dehydrated letsencrypt/acme client

Instalar
ansible-galaxy install pescobar.dehydrated
Licencia
Unknown
Descargas
1.4k
Propietario
Systems engineer. Linux/HPC/Cloud/BioInfo