- name: Install package: name: dehydrated - name: create folders file: path: "{{ item }}" state: directory with_items: - /etc/nginx/sites.d - /etc/nginx/local.d - /etc/nginx/snippets - name: create folders file: path: "/srv/http/.well-known/acme-challenge" state: directory - name: templates notify: reload nginx template: src: "{{ item.file }}" dest: "/etc/nginx/{{ item.path }}" with_items: - file: letsencrypt.nginx path: snippets/letsencrypt.conf - name: config dehydrated template: src: dehydrated dest: /etc/dehydrated/config - name: get let's encrypt account command: /usr/bin/dehydrated --register --accept-terms args: creates: /etc/dehydrated/accounts - name: get osp_hostname cert notify: dehydrated lineinfile: path: /etc/dehydrated/domains.txt line: "{{ osp_hostname }}" create: yes