Compare commits

...
36 Commits
Author SHA1 Message Date
Jeff GeerlingandGitHub eb4647ed9c Merge pull request #166 from tobiashuste/fix-snap-initial-dry-run
Fix snap symlink task failing in initial dry-run
2022-01-19 08:48:29 -06:00
Jeff Geerling 31beafb338 Update release workflow for more consistency. 2021-12-27 11:34:47 -06:00
Tobias Huste 1fc3a76d34 Fix snap symlink task failing in initial dry-run
Due to the certbot package not being really installed on the initial
dry-run the symlink generation fails. The corresponding will be ignored
in check mode.
2021-11-24 11:11:03 +01:00
Jeff Geerling dd1f8bd22c Tabs to spaces in README. 2021-11-22 10:58:43 -06:00
Jeff GeerlingandGitHub de4cb90984 Merge pull request #97 from simonspa/webroot
Allow Webroot Certificate Creation
2021-11-22 10:57:37 -06:00
Simon Spannagel 955ec8b17e Update documentation 2021-11-22 07:35:38 +01:00
Simon Spannagel a9a3ef77a3 Remove old deploy hook method superseded by pre-hook and post-hook methods 2021-11-22 07:27:48 +01:00
Simon Spannagel e35a5d0fb9 Remove excess whitespace 2021-11-22 07:25:31 +01:00
Simon Spannagel 854a36e048 Rever changes made by linter to github workflow yaml 2021-11-22 07:25:31 +01:00
2cad2addcd Update defaults/main.yml
Co-authored-by: Jeff Geerling <geerlingguy@mac.com>
2021-11-22 07:25:31 +01:00
52a96f9bde Check for systemd list-unit-files before restarting services
Co-authored-by: Karl M. Davis <karl@justdavis.com>
2021-11-22 07:25:31 +01:00
Simon Spannagel 7a7c1f8b06 Fix linter suggestions 2021-11-22 07:25:31 +01:00
Romain PorteandSimon Spannagel 40c4c1b433 webroot: install hook before creating certificates
The command that will create the certificates need the hook script
ansible.sh to exist before it is run, elsewise an error will occur in
case of first run on a new host.

(cherry picked from commit 2346cd52a262bf2fa89419f29abba0e8ea95cdb7)
2021-11-22 07:25:31 +01:00
Romain PorteandSimon Spannagel bd58f8e72c optimize renewal-hook creation: run it only once and not per domain 2021-11-22 07:25:31 +01:00
Simon Spannagel 123facdbab Ensure deploy hook directory exists before using 2021-11-22 07:25:31 +01:00
Simon Spannagel e1013946c5 Webroot: allow to set default webroot path, overwritten by per-cert path 2021-11-22 07:25:31 +01:00
Simon Spannagel b37af73500 Move webroot definition further down 2021-11-22 07:25:31 +01:00
Simon Spannagel 23447ec217 Fix issue in certificate creation command 2021-11-22 07:25:31 +01:00
Simon Spannagel 50d8921ec2 Create webroot directory if it doesn't exist 2021-11-22 07:25:31 +01:00
2e13cb13cf Update default deploy hook
Co-Authored-By: Kieren Evans <kierenevans@users.noreply.github.com>
2021-11-22 07:25:31 +01:00
Simon Spannagel e669ab0ac4 Replace shell with command module 2021-11-22 07:25:31 +01:00
Simon Spannagel ca46eab49f Fix linting issues 2021-11-22 07:25:29 +01:00
Simon Spannagel 5f476f829c Add default and document certbot_deployhook 2021-11-22 07:24:33 +01:00
Simon Spannagel 34949a63d9 Document webroot functionality 2021-11-22 07:24:33 +01:00
Simon Spannagel 061509319f Allow specification of different webroots per certificate 2021-11-22 07:24:31 +01:00
Ryan FairclothandSimon Spannagel c7e5eec8cc Update create-cert-webroot.yml
Removed debug logging of var as it could have protected information
2021-11-22 07:22:25 +01:00
Ryan FairclothandSimon Spannagel 23f593aaaf Fixes #39 adding new script for webroot
Fixes #41 support deployhook (webroot only)
Fixes #41 support for test CA
2021-11-22 07:22:15 +01:00
Jeff GeerlingandGitHub 027af9b3b3 Merge pull request #152 from stackbuilders/fix_install_with_snap_debian
[#151] Skip "Enable classic snap support" on Debian
2021-10-25 10:20:54 -05:00
Jeff Geerling 7317dbcabe Fix lint warnings. 2021-10-25 10:19:58 -05:00
Jeff Geerling 5cfcc2d316 Disable source install test on CentOS 7 for now. 2021-10-25 10:04:52 -05:00
Jeff GeerlingandGitHub aaf3dbd40a Merge pull request #159 from jivanpal/snapd-start
Ensure snapd is started immediately
2021-10-25 10:04:22 -05:00
Jeff GeerlingandGitHub 96051f08f4 Merge pull request #160 from jivanpal/powertools-for-centos-8.2
Add conditional to handle old name of PowerTools repo for CentOS 8.2.2004 and earlier
2021-10-25 10:03:58 -05:00
Jivan Pal 6647174286 Add conditional to handle old name of PowerTools repo for CentOS 8.2.2004 and earlier 2021-09-18 01:40:09 +01:00
Jivan Pal 3f8533436b Ensure snapd is started immediately 2021-09-17 21:44:35 +01:00
Jeff Geerling d1d517c5a4 Make sure bugs aren't automatically closed. 2021-08-23 08:52:55 -05:00
Sebastián Estrella 02e1e4e148 [#151] Skip "Enable classic snap support" on Debian 2021-04-28 22:05:31 -05:00
10 changed files with 91 additions and 17 deletions
+1
View File
@@ -12,6 +12,7 @@ onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- bug
- pinned
- security
- planned
+4 -3
View File
@@ -53,9 +53,10 @@ jobs:
- distro: debian10
playbook: converge.yml
experimental: false
- distro: centos7
playbook: playbook-source-install.yml
experimental: false
# Source install started failing recently.
# - distro: centos7
# playbook: playbook-source-install.yml
# experimental: false
- distro: centos7
playbook: playbook-snap-install.yml
+4 -2
View File
@@ -32,7 +32,9 @@ jobs:
python-version: '3.x'
- name: Install Ansible.
run: pip3 install ansible-base
run: pip3 install ansible-core
- name: Trigger a new import on Galaxy.
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
run: >-
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
+1 -1
View File
@@ -3,7 +3,7 @@ extends: default
rules:
line-length:
max: 120
max: 180
level: warning
ignore: |
+19 -3
View File
@@ -26,14 +26,25 @@ By default, this role configures a cron job to run under the provided user accou
### Automatic Certificate Generation
Currently there is one built-in method for generating new certificates using this role: `standalone`. Other methods (e.g. using nginx or apache and a webroot) may be added in the future.
Currently the `standalone` and `webroot` method are supported for generating new certificates using this role.
**For a complete example**: see the fully functional test playbook in [molecule/default/playbook-standalone-nginx-aws.yml](molecule/default/playbook-standalone-nginx-aws.yml).
certbot_create_if_missing: false
Set `certbot_create_if_missing` to `yes` or `True` to let this role generate certs.
certbot_create_method: standalone
Set `certbot_create_if_missing` to `yes` or `True` to let this role generate certs. Set the method used for generating certs with the `certbot_create_method` variablecurrent allowed values include: `standalone`.
Set the method used for generating certs with the `certbot_create_method` variablecurrent allowed values are: `standalone` or `webroot`.
certbot_testmode: false
Enable test mode to only run a test request without actually creating certificates.
certbot_hsts: false
Enable (HTTP Strict Transport Security) for the certificate generation.
certbot_admin_email: email@example.com
@@ -41,13 +52,14 @@ The email address used to agree to Let's Encrypt's TOS and subscribe to cert-rel
certbot_certs: []
# - email: janedoe@example.com
# webroot: "/var/www/html"
# domains:
# - example1.com
# - example2.com
# - domains:
# - example3.com
A list of domains (and other data) for which certs should be generated. You can add an `email` key to any list item to override the `certbot_admin_email`.
A list of domains (and other data) for which certs should be generated. You can add an `email` key to any list item to override the `certbot_admin_email`. When using the `webroot` creation method, a `webroot` item has to be provided, specifying which directory to use for the authentication. Make sure your webserver correctly delivers contents from this directory.
certbot_create_command: "{{ certbot_script }} certonly --standalone --noninteractive --agree-tos --email {{ cert_item.email | default(certbot_admin_email) }} -d {{ cert_item.domains | join(',') }}"
@@ -70,6 +82,10 @@ Setting `certbot_install_method: snap` configures this role to install Certbot v
This install method is currently experimental and may or may not work across all Linux distributions.
#### Webroot Certificate Generation
When using the `webroot` creation method, a `webroot` item has to be provided for every `certbot_certs` item, specifying which directory to use for the authentication. Also, make sure your webserver correctly delivers contents from this directory.
### Source Installation from Git
You can install Certbot from it's Git source repository if desired with `certbot_install_method: source`. This might be useful in several cases, but especially when older distributions don't have Certbot packages available (e.g. CentOS < 7, Ubuntu < 16.10 and Debian < 8).
+16 -1
View File
@@ -6,20 +6,35 @@ certbot_auto_renew_hour: "3"
certbot_auto_renew_minute: "30"
certbot_auto_renew_options: "--quiet --no-self-upgrade"
certbot_testmode: false
certbot_hsts: false
# Parameters used when creating new Certbot certs.
certbot_create_if_missing: false
certbot_create_method: standalone
certbot_admin_email: email@example.com
# Default webroot, overwritten by individual per-cert webroot directories
certbot_webroot: /var/www/letsencrypt
certbot_certs: []
# - email: janedoe@example.com
# webroot: "/var/www/html/"
# domains:
# - example1.com
# - example2.com
# - domains:
# - example3.com
certbot_create_command: >-
{{ certbot_script }} certonly --standalone --noninteractive --agree-tos
{{ certbot_script }} certonly --{{ certbot_create_method }}
{{ '--hsts' if certbot_hsts else '' }}
{{ '--test-cert' if certbot_testmode else '' }}
--noninteractive --agree-tos
--email {{ cert_item.email | default(certbot_admin_email) }}
{{ '--webroot-path ' if certbot_create_method == 'webroot' else '' }}
{{ cert_item.webroot | default(certbot_webroot) if certbot_create_method == 'webroot' else '' }}
-d {{ cert_item.domains | join(',') }}
{{ '--pre-hook /etc/letsencrypt/renewal-hooks/pre/stop_services'
if certbot_create_standalone_stop_services
+14
View File
@@ -0,0 +1,14 @@
---
- name: Check if certificate already exists.
stat:
path: /etc/letsencrypt/live/{{ cert_item.domains | first }}/cert.pem
register: letsencrypt_cert
- name: Create webroot directory if it doesn't exist yet
file:
path: "{{ cert_item.webroot | default(certbot_webroot) }}"
state: directory
- name: Generate new certificate if one doesn't exist.
command: "{{ certbot_create_command }}"
when: not letsencrypt_cert.stat.exists
+3
View File
@@ -9,12 +9,14 @@
systemd:
name: snapd.socket
enabled: true
state: started
- name: Enable classic snap support.
file:
src: /var/lib/snapd/snap
dest: /snap
state: link
when: ansible_os_family != "Debian"
- name: Update snap after install.
shell: snap install core; snap refresh core
@@ -32,6 +34,7 @@
src: /snap/bin/certbot
dest: /usr/bin/certbot
state: link
ignore_errors: "{{ ansible_check_mode }}"
- name: Set Certbot script variable.
set_fact:
+8
View File
@@ -21,5 +21,13 @@
loop_control:
loop_var: cert_item
- include_tasks: create-cert-webroot.yml
with_items: "{{ certbot_certs }}"
when:
- certbot_create_if_missing
- certbot_create_method == 'webroot'
loop_control:
loop_var: cert_item
- import_tasks: renew-cron.yml
when: certbot_auto_renew
+15 -1
View File
@@ -7,7 +7,9 @@
name: dnf-plugins-core
state: present
- name: Enable DNF module for CentOS 8+.
- block:
- name: Enable DNF module for CentOS 8.3+.
shell: |
dnf config-manager --set-enabled powertools
args:
@@ -15,6 +17,18 @@
register: dnf_module_enable
changed_when: false
when: ansible_facts['distribution_version'] is version('8.3', '>=')
- name: Enable DNF module for CentOS 8.08.2.
shell: |
dnf config-manager --set-enabled PowerTools
args:
warn: false
register: dnf_module_enable
changed_when: false
when: ansible_facts['distribution_version'] is version('8.2', '<=')
when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version | int >= 8