L-P.acmetool

ansible-role-acmetool

安装、配置并运行 acmetool 以生成 Let's Encrypt TLS 证书。

acmetool 将配置为使用其 redirector 模式。它将在 80 端口上监听,并将任何非挑战请求重定向到其他位置(HTTP 308)。

有关详细信息,请查看 GitHub 上的 acme

要求

  • 需要 become: true,因为大多数操作需要以 root 身份运行,其余操作在角色创建的 acme 用户下运行。

  • 需要开放 80/TCP 端口,以便 acmetool 能够提供挑战请求。

  • 由于默认使用 redirector 模式,因此不需要运行 HTTP 服务器。您可以在运行此角色 之后 安装任何您想要的服务器,这样它可以使用生成的证书。

  • 选择您的提供商,并在 acmetool_server 中设置其 API 端点,详见下文。

  • 需要 cron 包用于自动续期。

角色变量

必需

# 注册域名时使用的邮箱地址。
acmetool_email: "[email protected]"
# 要注册的域名列表(以空格分隔)。
acmetool_domains: "www.example.com example.com"

其他

# CA 服务器。默认使用用于测试的 acme-staging 服务器。
# 您需要将其更改为生产服务器:
# https://acme-v01.api.letsencrypt.org/directory
acmetool_server: "https://acme.example.com/directory"

# 如果您的服务器不支持 EC 密钥(例如 murmur),请将其更改为 RSA。
acmetool_key_type: "ecdsa"

# 如果您不信任 acmetool 以 root 身份(sudo)运行钩子,请将此设置为 false。
acmetool_enable_hooks: false

请查看 默认值 获取完整列表。

示例剧本

- hosts: all
  roles:
    - { role: "L-P.acmetool", become: true }

由于在 Debian 上安装服务时会自动启用并启动其默认配置,nginx 安装失败,并使 dpkg 处于半损坏状态。
为避免这种情况,您可以在安装 acmetool 和 nginx 之间运行以下剧本。它仅在 nginx 尚未配置时运行。

- hosts: all
    become: true
    tasks:
    - name: 停止 acmetool
      tags: "nginx"
      command: "service acmetool stop"
      args:
        creates: "/etc/nginx/nginx.conf"

您可以根据任何其他以相同方式失败的服务进行调整。

许可证

MIT

关于项目

Install acmetool on Ubuntu 16.04

安装
ansible-galaxy install L-P.acmetool
许可证
mit
下载
355
拥有者