+feature added: install acme.sh

This commit is contained in:
adns44 2024-09-13 14:53:21 +02:00
parent beba645030
commit d57f3c45f0
3 changed files with 28 additions and 25 deletions

View file

@ -1,9 +1,11 @@
env_vars: [] acme_sh_env_vars: []
acme_domains: [] acme_sh_domains: []
acme_user: "acme" acme_sh_user: "acme"
add_to_docker_group: true acme_sh_user_groups: []
acme_git_repo: "https://github.com/acmesh-official/acme.sh.git" acme_sh_user_home: "/home/{{ acme_sh_user }}"
acme_sh_home: "/home/{{ acme_user }}/acme.sh" acme_sh_git_repo: "https://github.com/acmesh-official/acme.sh.git"
acme_sh_git_folder: "{{ acme_sh_user_home }}/git_acme.sh"
acme_sh_home: "{{ acme_sh_user_home }}/acme.sh"
acme_sh_cert_home: "{{ acme_sh_home }}/certs" acme_sh_cert_home: "{{ acme_sh_home }}/certs"
acme_sh_config_home: "{{ acme_sh_home }}/config" acme_sh_config_home: "{{ acme_sh_home }}/config"
acme_sh_email: "" acme_sh_email: ""
@ -13,5 +15,5 @@ acme_sh_post_hook: ""
acme_sh_renew_hook: "" acme_sh_renew_hook: ""
acme_sh_set_notify: "" acme_sh_set_notify: ""
acme_sh_set_notify_level: "2" acme_sh_set_notify_level: "2"
docker_group: "docker" acme_sh_docker_group: ""
acme_user_home: "/home/{{ acme_user }}"

View file

@ -1,15 +1,17 @@
--- ---
- name: Git fetch acme.sh repository - name: Git fetch acme.sh repository
ansible.builtin.git: ansible.builtin.git:
repo: "https://github.com/acmesh-official/acme.sh.git" repo: "{{ acme_sh_git_repo }}"
dest: "{{ acme_user_home }}/acme.sh" dest: "{{ acme_sh_git_folder }}"
- name: Check acme.sh installation existence
ansible.builtin.stat:
path: "{{ acme_sh_home }}"
register: acme_sh_folder_stats
- name: Install acme.sh - name: Install acme.sh
ansible.builtin.debug: ansible.builtin.command:
msg: "installing..." chdir: "{{ acme_sh_git_folder }}"
when: acme_sh_folder_stats.stat.isdir is defined and acme_sh_folder_stats.stat.isdir cmd: |
/bin/sh acme.sh
--install
--home {{ acme_sh_home | quote }}
--cert-home {{ acme_sh_cert_home | quote }}
--config-home {{ acme_sh_config_home | quote }}
-m {{ acme_sh_email | quote }}
creates: "{{ acme_sh_home }}"

View file

@ -10,18 +10,17 @@
- name: Create acme user - name: Create acme user
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ acme_user }}" name: "{{ acme_sh_user }}"
- name: Add acme user to Docker group - name: Add acme user to groups
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ acme_user }}" name: "{{ acme_sh_user }}"
groups: "{{ docker_group }}" groups: "{{ acme_sh_user_groups }}"
append: true append: true
home: "{{ acme_user_home }}" when: acme_sh_user_groups|length > 0
when: add_to_docker_group == true
- name: Install acme.sh - name: Install acme.sh
become: true become: true
become_user: "{{ acme_user }}" become_user: "{{ acme_sh_user }}"
ansible.builtin.import_tasks: "install_acmesh.yml" ansible.builtin.import_tasks: "install_acmesh.yml"