initial commit, not working, under development

This commit is contained in:
adns44 2024-09-11 21:47:47 +02:00
commit beba645030
3 changed files with 59 additions and 0 deletions

17
defaults/main.yaml Normal file
View file

@ -0,0 +1,17 @@
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_cert_home: "{{ acme_sh_home }}/certs"
acme_sh_config_home: "{{ acme_sh_home }}/config"
acme_sh_email: ""
acme_sh_default_ca_server: "https://acme-v02.api.letsencrypt.org/directory"
acme_sh_pre_hook: ""
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 }}"

15
tasks/install_acmesh.yml Normal file
View file

@ -0,0 +1,15 @@
---
- 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
- 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

27
tasks/main.yaml Normal file
View file

@ -0,0 +1,27 @@
---
- name: Install git
become: true
ansible.builtin.apt:
name:
- git
state: present
update_cache: yes
- name: Create acme user
become: true
ansible.builtin.user:
name: "{{ acme_user }}"
- name: Add acme user to Docker group
become: true
ansible.builtin.user:
name: "{{ acme_user }}"
groups: "{{ docker_group }}"
append: true
home: "{{ acme_user_home }}"
when: add_to_docker_group == true
- name: Install acme.sh
become: true
become_user: "{{ acme_user }}"
ansible.builtin.import_tasks: "install_acmesh.yml"