diff --git a/defaults/main.yml b/defaults/main.yml index b575552..2587702 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,6 +5,9 @@ # @var certbot_packages_extra:description: Extra packages to install with pip (e.g. DNS plugins). certbot_packages_extra: [] +certbot_virtualenv_command: /usr/bin/python3 -m venv +certbot_virtualenv: /opt/python3/certbot + certbot_user: root certbot_work_dir: /var/lib/letsencrypt diff --git a/tasks/install.yml b/tasks/install.yml index 8043e4d..4a4ed15 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -10,8 +10,8 @@ - name: Upgrade python dependencies pip: name: "{{ item }}" - virtualenv: /opt/python3/certbot - virtualenv_command: /usr/bin/python3 -m venv + virtualenv: "{{ certbot_virtualenv }}" + virtualenv_command: "{{ certbot_virtualenv_command }} -m venv" extra_args: --upgrade loop: - pip @@ -20,8 +20,8 @@ - name: Install dependencies pip: name: "{{ item }}" - virtualenv: /opt/python3/certbot - virtualenv_command: /usr/bin/python3 -m venv + virtualenv: "{{ certbot_virtualenv }}" + virtualenv_command: "{{ certbot_virtualenv_command }} -m venv" environment: TMPDIR: /opt/python3/tmp loop: "{{ certbot_packages_extra }}" @@ -29,20 +29,20 @@ - name: Install certbot pip: name: "{{ item }}" - virtualenv: /opt/python3/certbot - virtualenv_command: /usr/bin/python3 -m venv + virtualenv: "{{ certbot_virtualenv }}" + virtualenv_command: "{{ certbot_virtualenv_command }} -m venv" loop: "{{ __certbot_packages }}" - name: Adjust file permissions file: - name: /opt/python3/certbot + name: "{{ certbot_virtualenv }}" recurse: True mode: u+rwX,go+rX,go-w state: directory - name: Make certbot binaries executable file: - name: "/opt/python3/certbot/bin/{{ item }}" + name: "{{ certbot_virtualenv }}/bin/{{ item }}" mode: 0755 loop: "{{ __certbot_binaries }}" diff --git a/templates/usr/local/bin/certbot-wrapper.j2 b/templates/usr/local/bin/certbot-wrapper.j2 index 14f7cf1..afad6f7 100644 --- a/templates/usr/local/bin/certbot-wrapper.j2 +++ b/templates/usr/local/bin/certbot-wrapper.j2 @@ -1,4 +1,4 @@ #!/usr/bin/env sh set -eo pipefail -exec /opt/python3/certbot/bin/{{ item }} "$@" +exec {{ certbot_virtualenv }}/bin/{{ item }} "$@"