From f17d52cdcc8837a4c574ff0ee253fa72664c2792 Mon Sep 17 00:00:00 2001 From: Lucas <116588+hairmare@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:21:23 +0100 Subject: [PATCH] chore: set exec bit and use shebang (#7) --- roles/certbot/tasks/main.yml | 9 +++++---- roles/certbot/templates/cert_sync.sh.j2 | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/roles/certbot/tasks/main.yml b/roles/certbot/tasks/main.yml index 9a6a5dd..fc8469b 100644 --- a/roles/certbot/tasks/main.yml +++ b/roles/certbot/tasks/main.yml @@ -15,16 +15,17 @@ - name: Write script for pushing certificates to remote host ansible.builtin.template: - src: templates/cert_sync.sh.j2 - dest: "{{ certbot_certsync_script_path }}" + src: templates/cert_sync.sh.j2 + dest: "{{ certbot_certsync_script_path }}" + mode: "755" - name: Add deploy hook to {{ certbot_certbot_sysconfig_path }} - ansible.builtin.command: sed -i 's/^DEPLOY_HOOK=""/DEPLOY_HOOK="--deploy-hook \\\"\/usr\/bin\/sh \/usr\/local\/libexec\/cert_sync.sh\\\""/' {{ certbot_certbot_sysconfig_path }} + ansible.builtin.command: sed -i 's/^DEPLOY_HOOK=""/DEPLOY_HOOK="--deploy-hook \\\"\/usr\/local\/libexec\/cert_sync.sh\\\""/' {{ certbot_certbot_sysconfig_path }} - name: Add certificates to certbot ansible.builtin.command: "{{ certbot_certbot_binary_path }} certonly \ --standalone --non-interactive -m {{ certbot_acme_account_mail }} \ - --deploy-hook '/usr/bin/sh /usr/local/libexec/cert_sync.sh' + --deploy-hook '/usr/local/libexec/cert_sync.sh' --domains {{ item }} --agree-tos" loop: "{{ certbot_certificates }}" diff --git a/roles/certbot/templates/cert_sync.sh.j2 b/roles/certbot/templates/cert_sync.sh.j2 index f32d582..90d22c2 100644 --- a/roles/certbot/templates/cert_sync.sh.j2 +++ b/roles/certbot/templates/cert_sync.sh.j2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/sh certbot_certificates_src={{ certbot_certificates_src }} certbot_remote_user={{ certbot_remote_user }} certbot_certificates_dest={{ certbot_certificates_dest }}