+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_domains: []
acme_user: "acme"
add_to_docker_group: true
acme_git_repo: "https://github.com/acmesh-official/acme.sh.git"
acme_sh_home: "/home/{{ acme_user }}/acme.sh"
acme_sh_env_vars: []
acme_sh_domains: []
acme_sh_user: "acme"
acme_sh_user_groups: []
acme_sh_user_home: "/home/{{ acme_sh_user }}"
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_config_home: "{{ acme_sh_home }}/config"
acme_sh_email: ""
@ -13,5 +15,5 @@ acme_sh_post_hook: ""
acme_sh_renew_hook: ""
acme_sh_set_notify: ""
acme_sh_set_notify_level: "2"
docker_group: "docker"
acme_user_home: "/home/{{ acme_user }}"
acme_sh_docker_group: ""

View file

@ -1,15 +1,17 @@
---
- name: Git fetch acme.sh repository
ansible.builtin.git:
repo: "https://github.com/acmesh-official/acme.sh.git"
dest: "{{ acme_user_home }}/acme.sh"
- name: Check acme.sh installation existence
ansible.builtin.stat:
path: "{{ acme_sh_home }}"
register: acme_sh_folder_stats
repo: "{{ acme_sh_git_repo }}"
dest: "{{ acme_sh_git_folder }}"
- name: Install acme.sh
ansible.builtin.debug:
msg: "installing..."
when: acme_sh_folder_stats.stat.isdir is defined and acme_sh_folder_stats.stat.isdir
ansible.builtin.command:
chdir: "{{ acme_sh_git_folder }}"
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
become: true
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
ansible.builtin.user:
name: "{{ acme_user }}"
groups: "{{ docker_group }}"
name: "{{ acme_sh_user }}"
groups: "{{ acme_sh_user_groups }}"
append: true
home: "{{ acme_user_home }}"
when: add_to_docker_group == true
when: acme_sh_user_groups|length > 0
- name: Install acme.sh
become: true
become_user: "{{ acme_user }}"
become_user: "{{ acme_sh_user }}"
ansible.builtin.import_tasks: "install_acmesh.yml"