Skip to content

Commit 199d5ae

Browse files
committed
feat(deps): switch Cloudflare plugin install to pip
1 parent 26fab7f commit 199d5ae

File tree

10 files changed

+28
-56
lines changed

10 files changed

+28
-56
lines changed

.ansible-lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
2-
warn_list
2+
warn_list:
33
- yaml[line-length]

.yamllint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
line-length:
6+
max: 120
7+
level: warning

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ Your Cloudflare Global API Key, optionally encrypted `ansible-vault encrypt_stri
2323
- domains:
2424
- "*.example3.com"
2525

26-
The wildcard domain to create the cert for. For non-wildcard domains, I recommend using [geerlingguy.certbot](https://github.com/geerlingguy/ansible-role-certbot)
26+
The wildcard domain to create the cert for. For non-wildcard domains, I recommend using [geerlingguy.certbot](https://github.com/geerlingguy/ansible-role-certbot):
2727

2828
certbot_cloudflare_acme_server: "{{ certbot_cloudflare_acme_test }}"
2929

30-
or
30+
or:
3131

3232
certbot_cloudflare_acme_server: "{{ certbot_cloudflare_acme_live }}"
3333

@@ -53,12 +53,12 @@ Including an example of how to use your role (for instance, with variables passe
5353
- "*.example3.com"
5454

5555
roles:
56-
- michaelpporter.certbot_cloudflare
56+
- nikolay.certbot_cloudflare
5757

5858
## License
5959

6060
MIT / BSD
6161

6262
## Author Information
6363

64-
This role was created in 2018 by [Michael Porter](https://www.michaelpporter.com/).
64+
This role was created in 2018 by [Michael Porter](https://www.michaelpporter.com/), and continued in 2022 by [Nikolay Kolev](https://nikolay.com).

defaults/main.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
---
2-
# defaults file for certbot-cloudflare
3-
4-
# Email address for Cloudflare Global API Key
2+
# Email address for Cloudflare API key
53
certbot_cloudflare_email: "cloudflare@example.com"
6-
# Your Global API Key from your account
7-
# ansible-vault encrypt_string 'cloudflareAPIKey' --name 'certbot_cloudflare_api_key'
4+
# Your Cloudflare API key
5+
# ansible-vault encrypt_string 'CLOUDFLARE_API_KEY' --name 'certbot_cloudflare_api_key'
86
certbot_cloudflare_api_key: ""
97

10-
certbot_create_standalone_stop_services: []
11-
certbot_create_if_missing: true
12-
13-
certbot_dir: /opt/certbot
14-
158
# Use the ACME v2 staging URI for testing things
169
certbot_cloudflare_acme_test: "https://acme-staging-v02.api.letsencrypt.org/directory"
1710
# Production ACME v2 API endpoint

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
galaxy_info:
23
role_name: certbot_cloudflare
34
author: Michael Porter

tasks/main.yml

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,10 @@
11
---
2-
# tasks file for certbot-cloudflare
3-
4-
- name: Get software for APT repository management
5-
ansible.builtin.apt: name={{ item }} state=present
6-
with_items:
7-
- build-essential
8-
- curl
9-
- libffi-dev
10-
- libssl-dev
11-
- python-apt
12-
- python-dev
13-
- python-pycurl
14-
15-
- name: Check if certbot-dns-cloudflare plugin is installed
16-
ansible.builtin.shell: certbot plugins | grep dns-cloudflare
17-
register: cf_check
18-
ignore_errors: true
19-
changed_when: "cf_check is failed"
20-
21-
- name: Install certbot-dns-cloudflare
22-
ansible.builtin.shell: "cd {{ certbot_dir }}/certbot-dns-cloudflare && python setup.py install"
23-
when: "cf_check is failed"
24-
25-
- name: Create Certbot folder - sudouser
26-
ansible.builtin.file:
27-
path: /etc/letsencrypt
28-
state: directory
29-
owner: root
30-
group: root
31-
mode: 0700
2+
- name: Install certbot-dns-cloudflare plugin
3+
ansible.builtin.include_role:
4+
name: geerlingguy.pip
5+
vars:
6+
pip_install_packages:
7+
- name: certbot-dns-cloudflare
328

339
- name: Certbot template
3410
ansible.builtin.template:
@@ -38,9 +14,9 @@
3814
group: root
3915
mode: 0600
4016
with_items:
41-
- src: "templates/confcloudflare.ini.j2"
42-
dest: "/etc/letsencrypt/dnscloudflare.ini"
43-
- src: "templates/letsencrypt_cli.ini.j2"
17+
- src: "templates/dns-cloudflare.ini.j2"
18+
dest: "/etc/letsencrypt/dns-cloudflare.ini"
19+
- src: "templates/certbot-cli.ini.j2"
4420
dest: "/etc/letsencrypt/cli.ini"
4521

4622
- name: Create certs

templates/certbot-cli.ini.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dns-cloudflare-credentials = /etc/letsencrypt/dns-cloudflare.ini
2+
server = {{ certbot_cloudflare_acme_server }}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
# Cloudflare API credentials used by Certbot
21
dns_cloudflare_email = {{ certbot_cloudflare_email }}
32
dns_cloudflare_api_key = {{ certbot_cloudflare_api_key }}

templates/letsencrypt_cli.ini.j2

Lines changed: 0 additions & 3 deletions
This file was deleted.

vars/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
---
22
certbot_create_command: "certbot certonly --noninteractive --dns-cloudflare --agree-tos --email {{ cert_item.email | default(certbot_admin_email) }} -d {{ cert_item.domains | join(',') }}"
33
certbot_create_method: standalone
4-
certbot_install_from_source: true
5-
certbot_repo: https://github.com/certbot/certbot.git
6-
certbot_version: master
7-
certbot_keep_updated: true
4+
certbot_install_from_source: false

0 commit comments

Comments
 (0)