commit beba6450302b6d19d507f877dc9c028a1d6c674f Author: adns44 Date: Wed Sep 11 21:47:47 2024 +0200 initial commit, not working, under development diff --git a/defaults/main.yaml b/defaults/main.yaml new file mode 100644 index 0000000..d6b2941 --- /dev/null +++ b/defaults/main.yaml @@ -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 }}" diff --git a/tasks/install_acmesh.yml b/tasks/install_acmesh.yml new file mode 100644 index 0000000..2209f55 --- /dev/null +++ b/tasks/install_acmesh.yml @@ -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 \ No newline at end of file diff --git a/tasks/main.yaml b/tasks/main.yaml new file mode 100644 index 0000000..37d80db --- /dev/null +++ b/tasks/main.yaml @@ -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" \ No newline at end of file