From 5e295e871427ab9f72b92ed8cce2b69a03154cfb Mon Sep 17 00:00:00 2001 From: Nikolaos Kakouros Date: Sun, 12 May 2019 18:29:59 +0200 Subject: [PATCH] Adds test for systemd --- .travis.yml | 2 ++ molecule/default/playbook.yml | 1 + tasks/systemd.yml | 5 +++++ templates/certbot-renew.service.j2 | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6e475ce..4fa541d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ env: - MOLECULE_DISTRO: centos6 MOLECULE_PLAYBOOK: playbook-source-install.yml - MOLECULE_DISTRO: ubuntu1804 + - MOLECULE_DISTRO: ubuntu1604 + CERTBOT_AUTO_RENEW_SYSTEMD: true - MOLECULE_DISTRO: ubuntu1604 - MOLECULE_DISTRO: ubuntu1404 MOLECULE_PLAYBOOK: playbook-source-install.yml diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 9d6e5e7..7f4bb38 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -5,6 +5,7 @@ vars: certbot_auto_renew_user: root + certbot_auto_renew_systemd: "{{ lookup('env', 'CERTBOT_AUTO_RENEW_SYSTEMD') }}" pre_tasks: - name: Update apt cache. diff --git a/tasks/systemd.yml b/tasks/systemd.yml index 2a08aea..fa99236 100644 --- a/tasks/systemd.yml +++ b/tasks/systemd.yml @@ -11,3 +11,8 @@ src: certbot-renew.timer.j2 dest: /etc/systemd/system/certbot-renew.timer notify: certbot restart renew timer + +- name: Start certbot-renew timer + systemd: + name: certbot-renew.timer + state: started diff --git a/templates/certbot-renew.service.j2 b/templates/certbot-renew.service.j2 index 1270240..3c3d68c 100644 --- a/templates/certbot-renew.service.j2 +++ b/templates/certbot-renew.service.j2 @@ -4,6 +4,6 @@ Description=Let's Encrypt renewal service [Service] User={{ certbot_auto_renew_user }} Type=oneshot -ExecStart={{ certbot_script }} renew --quiet --agree-tos +ExecStart={{ certbot_script }} renew {{ certbot_auto_renew_options }} ExecStartPost=/bin/systemctl reload {{ certbot_web_service }}.service