mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2026-08-22 07:50:43 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09c8986636 | ||
|
|
60d805f41b | ||
|
|
6d26c0628d | ||
|
|
b158105fad | ||
|
|
21462d7da9 | ||
|
|
724a3ed920 | ||
|
|
57702b3544 | ||
|
|
6e17af0ac5 | ||
|
|
7a8b82d139 | ||
|
|
980c3ea31d | ||
|
|
6414a15183 | ||
|
|
a49d4e63a1 | ||
|
|
7efc6a50f5 | ||
|
|
00dc226101 | ||
|
|
be44ac2dcd | ||
|
|
09b5bd20e9 | ||
|
|
6b519ffc4d |
@@ -0,0 +1,4 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
---
|
||||||
|
github: geerlingguy
|
||||||
|
patreon: geerlingguy
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# Configuration for probot-stale - https://github.com/probot/stale
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||||
|
daysUntilStale: 90
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||||
|
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||||
|
daysUntilClose: 30
|
||||||
|
|
||||||
|
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||||
|
onlyLabels: []
|
||||||
|
|
||||||
|
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||||
|
exemptLabels:
|
||||||
|
- pinned
|
||||||
|
- security
|
||||||
|
- planned
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a project (defaults to false)
|
||||||
|
exemptProjects: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a milestone (defaults to false)
|
||||||
|
exemptMilestones: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues with an assignee (defaults to false)
|
||||||
|
exemptAssignees: false
|
||||||
|
|
||||||
|
# Label to use when marking as stale
|
||||||
|
staleLabel: stale
|
||||||
|
|
||||||
|
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||||
|
limitPerRun: 30
|
||||||
|
|
||||||
|
pulls:
|
||||||
|
markComment: |-
|
||||||
|
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
|
||||||
|
|
||||||
|
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
|
||||||
|
|
||||||
|
unmarkComment: >-
|
||||||
|
This pull request is no longer marked for closure.
|
||||||
|
|
||||||
|
closeComment: >-
|
||||||
|
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
|
||||||
|
|
||||||
|
issues:
|
||||||
|
markComment: |-
|
||||||
|
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||||
|
|
||||||
|
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||||
|
|
||||||
|
unmarkComment: >-
|
||||||
|
This issue is no longer marked for closure.
|
||||||
|
|
||||||
|
closeComment: >-
|
||||||
|
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||||
+4
-5
@@ -6,18 +6,17 @@ env:
|
|||||||
global:
|
global:
|
||||||
- ROLE_NAME: certbot
|
- ROLE_NAME: certbot
|
||||||
matrix:
|
matrix:
|
||||||
|
- MOLECULE_DISTRO: centos8
|
||||||
- MOLECULE_DISTRO: centos7
|
- MOLECULE_DISTRO: centos7
|
||||||
MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd
|
|
||||||
- MOLECULE_DISTRO: centos6
|
- MOLECULE_DISTRO: centos6
|
||||||
MOLECULE_PLAYBOOK: playbook-source-install.yml
|
MOLECULE_PLAYBOOK: playbook-source-install.yml
|
||||||
|
- MOLECULE_DISTRO: ubuntu1804
|
||||||
- MOLECULE_DISTRO: ubuntu1604
|
- MOLECULE_DISTRO: ubuntu1604
|
||||||
- MOLECULE_DISTRO: ubuntu1404
|
- MOLECULE_DISTRO: debian10
|
||||||
MOLECULE_PLAYBOOK: playbook-source-install.yml
|
|
||||||
- MOLECULE_DISTRO: debian9
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# Install test dependencies.
|
# Install test dependencies.
|
||||||
- pip install molecule docker
|
- pip install molecule yamllint ansible-lint docker
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# Use actual Ansible Galaxy role name for the project directory.
|
# Use actual Ansible Galaxy role name for the project directory.
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
---
|
---
|
||||||
extends: default
|
extends: default
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
line-length:
|
line-length:
|
||||||
max: 120
|
max: 120
|
||||||
level: warning
|
level: warning
|
||||||
|
|
||||||
|
ignore: |
|
||||||
|
.github/stale.yml
|
||||||
@@ -16,8 +16,8 @@ The variable `certbot_install_from_source` controls whether to install Certbot f
|
|||||||
|
|
||||||
certbot_auto_renew: true
|
certbot_auto_renew: true
|
||||||
certbot_auto_renew_user: "{{ ansible_user | default(lookup('env', 'USER')) }}"
|
certbot_auto_renew_user: "{{ ansible_user | default(lookup('env', 'USER')) }}"
|
||||||
certbot_auto_renew_hour: 3
|
certbot_auto_renew_hour: "3"
|
||||||
certbot_auto_renew_minute: 30
|
certbot_auto_renew_minute: "30"
|
||||||
certbot_auto_renew_options: "--quiet --no-self-upgrade"
|
certbot_auto_renew_options: "--quiet --no-self-upgrade"
|
||||||
|
|
||||||
By default, this role configures a cron job to run under the provided user account at the given hour and minute, every day. The defaults run `certbot renew` (or `certbot-auto renew`) via cron every day at 03:30:00 by the user you use in your Ansible playbook. It's preferred that you set a custom user/hour/minute so the renewal is during a low-traffic period and done by a non-root user account.
|
By default, this role configures a cron job to run under the provided user account at the given hour and minute, every day. The defaults run `certbot renew` (or `certbot-auto renew`) via cron every day at 03:30:00 by the user you use in your Ansible playbook. It's preferred that you set a custom user/hour/minute so the renewal is during a low-traffic period and done by a non-root user account.
|
||||||
@@ -26,7 +26,7 @@ By default, this role configures a cron job to run under the provided user accou
|
|||||||
|
|
||||||
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 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.
|
||||||
|
|
||||||
**For a complete example**: see the fully functional test playbook in [tests/test-standalone-nginx-aws.yml](tests/test-standalone-nginx-aws.yml).
|
**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
|
certbot_create_if_missing: false
|
||||||
certbot_create_method: standalone
|
certbot_create_method: standalone
|
||||||
@@ -91,8 +91,8 @@ None.
|
|||||||
|
|
||||||
vars:
|
vars:
|
||||||
certbot_auto_renew_user: your_username_here
|
certbot_auto_renew_user: your_username_here
|
||||||
certbot_auto_renew_minute: 20
|
certbot_auto_renew_minute: "20"
|
||||||
certbot_auto_renew_hour: 5
|
certbot_auto_renew_hour: "5"
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- geerlingguy.certbot
|
- geerlingguy.certbot
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
# Certbot auto-renew cron job configuration (for certificate renewals).
|
# Certbot auto-renew cron job configuration (for certificate renewals).
|
||||||
certbot_auto_renew: true
|
certbot_auto_renew: true
|
||||||
certbot_auto_renew_user: "{{ ansible_user | default(lookup('env', 'USER')) }}"
|
certbot_auto_renew_user: "{{ ansible_user | default(lookup('env', 'USER')) }}"
|
||||||
certbot_auto_renew_hour: 3
|
certbot_auto_renew_hour: "3"
|
||||||
certbot_auto_renew_minute: 30
|
certbot_auto_renew_minute: "30"
|
||||||
certbot_auto_renew_options: "--quiet --no-self-upgrade"
|
certbot_auto_renew_options: "--quiet --no-self-upgrade"
|
||||||
|
|
||||||
# Parameters used when creating new Certbot certs.
|
# Parameters used when creating new Certbot certs.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ galaxy_info:
|
|||||||
versions:
|
versions:
|
||||||
- 6
|
- 6
|
||||||
- 7
|
- 7
|
||||||
|
- 8
|
||||||
- name: Fedora
|
- name: Fedora
|
||||||
versions:
|
versions:
|
||||||
- all
|
- all
|
||||||
|
|||||||
@@ -3,25 +3,19 @@ dependency:
|
|||||||
name: galaxy
|
name: galaxy
|
||||||
driver:
|
driver:
|
||||||
name: docker
|
name: docker
|
||||||
lint:
|
lint: |
|
||||||
name: yamllint
|
set -e
|
||||||
options:
|
yamllint .
|
||||||
config-file: molecule/default/yaml-lint.yml
|
ansible-lint
|
||||||
platforms:
|
platforms:
|
||||||
- name: instance
|
- name: instance
|
||||||
image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible
|
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
||||||
command: ${MOLECULE_DOCKER_COMMAND:-"sleep infinity"}
|
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
privileged: true
|
privileged: true
|
||||||
pre_build_image: true
|
pre_build_image: true
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
lint:
|
|
||||||
name: ansible-lint
|
|
||||||
playbooks:
|
playbooks:
|
||||||
converge: ${MOLECULE_PLAYBOOK:-playbook.yml}
|
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
||||||
scenario:
|
|
||||||
name: default
|
|
||||||
verifier:
|
|
||||||
name: testinfra
|
|
||||||
lint:
|
|
||||||
name: flake8
|
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
region: "us-east-1"
|
region: "us-east-1"
|
||||||
name: certbot_test
|
name: certbot_test
|
||||||
key_material: "{{ item }}"
|
key_material: "{{ item }}"
|
||||||
with_file: ~/.ssh/id_rsa.pub
|
with_file:
|
||||||
|
- ~/.ssh/id_rsa.pub
|
||||||
|
|
||||||
- name: Provision EC2 instance.
|
- name: Provision EC2 instance.
|
||||||
ec2:
|
ec2:
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
import testinfra.utils.ansible_runner
|
|
||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
||||||
|
|
||||||
|
|
||||||
def test_hosts_file(host):
|
|
||||||
f = host.file('/etc/hosts')
|
|
||||||
|
|
||||||
assert f.exists
|
|
||||||
assert f.user == 'root'
|
|
||||||
assert f.group == 'root'
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
with_items: "{{ certbot_create_standalone_stop_services }}"
|
with_items: "{{ certbot_create_standalone_stop_services }}"
|
||||||
|
|
||||||
- name: Generate new certificate if one doesn't exist.
|
- name: Generate new certificate if one doesn't exist.
|
||||||
shell: "{{ certbot_create_command }}"
|
command: "{{ certbot_create_command }}"
|
||||||
when: not letsencrypt_cert.stat.exists
|
when: not letsencrypt_cert.stat.exists
|
||||||
|
|
||||||
- name: Start services after cert has been generated.
|
- name: Start services after cert has been generated.
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
- import_tasks: include-vars.yml
|
- import_tasks: include-vars.yml
|
||||||
|
|
||||||
|
- import_tasks: setup-RedHat.yml
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- import_tasks: install-with-package.yml
|
- import_tasks: install-with-package.yml
|
||||||
when: not certbot_install_from_source
|
when: not certbot_install_from_source
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
# See: https://github.com/geerlingguy/ansible-role-certbot/issues/107
|
||||||
|
- block:
|
||||||
|
|
||||||
|
- name: Ensure dnf-plugins are installed on CentOS 8+.
|
||||||
|
yum:
|
||||||
|
name: dnf-plugins-core
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Enable DNF module for CentOS 8+.
|
||||||
|
shell: |
|
||||||
|
dnf config-manager --set-enabled PowerTools
|
||||||
|
args:
|
||||||
|
warn: false
|
||||||
|
register: dnf_module_enable
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
when:
|
||||||
|
- ansible_os_family == 'RedHat'
|
||||||
|
- ansible_distribution_major_version | int >= 8
|
||||||
Reference in New Issue
Block a user