Dodan role za apache
This commit is contained in:
parent
d5b6fe1d92
commit
b324daff08
6 changed files with 675 additions and 0 deletions
48
roles/apache/tasks/main.yml
Normal file
48
roles/apache/tasks/main.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
- 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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue