- name: Set configuration parameters for Alpine when: ansible_os_family == 'Alpine' set_fact: apache_user: apache - name: Set configuration parameters for Debian when: ansible_os_family == 'Debian' set_fact: apache_user: www-data - name: Install packages package: name: - apache2 - apache2-ssl - apache2-ctl - certbot-apache - name: Create HTTP directory file: dest: /srv/http owner: "{{ apache_user }}" state: directory - name: Set up default HTTP server template: src: httpd.conf dest: "/etc/apache2/httpd.conf" notify: reload apache - name: Enable apache service service: name: apache2 enabled: true state: started # - meta: flush_handlers # - name: Get LE certificate command: cmd: > certbot --apache --non-interactive --agree-tos --register-unsafely-without-email -d {{ ([dns_name] + tls_domains|default([])) | join(',') }} creates: '/etc/letsencrypt/renewal/{{ dns_name }}.conf' register: get_certificate_result ignore_errors: true