--- - name: execute LetsEncrypt setup script command: /usr/local/directadmin/scripts/letsencrypt.sh request_single {{ directadmin_hostname }} 4096 register: directadmin_letsencrypt_output - debug: var: directadmin_letsencrypt_output.stdout_lines - name: enable SSL with LetsEncrypt for DirectAdmin lineinfile: path: "{{ directadmin_config_path }}" regexp: "{{ item.regexp }}" line: "{{ item.line }}" loop: - name: Turn SSL on regexp: '^SSL\=0' line: 'SSL=1' - name: Configure CA Root Cert regexp: '^carootcert=' line: 'carootcert=/usr/local/directadmin/conf/carootcert.pem' - name: Force hostname regexp: '^force_hostname=' line: "force_hostname={{ directadmin_hostname }}" - name: SSL Redirect Setup regexp: '^ssl_redirect_host=' line: "ssl_redirect_host={{ directadmin_hostname }}" - name: Enable LetsEncrypt regexp: '^letsencrypt=' line: "letsencrypt=1" loop_control: label: "{{ item.name }}" notify: - Restart DirectAdmin