- ---
- - include_role:
- name: service
- vars:
- service_name: nginx
- service_packages:
- - nginx
-
- - name: disable nginx default configuration
- file:
- path: /etc/nginx/sites-enabled/default
- state: absent
- notify: restart nginx
-
- - name: create nginx location configuration directory
- file:
- path: '{{ item }}'
- state: directory
- mode: 0755
- owner: www-data
- group: www-data
- with_items:
- - /etc/nginx/locations/
- - '/etc/nginx/locations/{{ server_fqdn }}/'
-
- - name: upload nginx configuration
- template:
- src: base.j2
- dest: "/etc/nginx/sites-available/{{ server_fqdn }}.conf"
- notify:
- - restart nginx
-
- - name: create Diffie Hellman exchange parameters
- command: openssl dhparam -out /etc/nginx/dhparam.pem 2048
- args:
- creates: /etc/nginx/dhparam.pem
- notify: restart nginx
-
- - name: enable nginx configurations
- file:
- src: "/etc/nginx/sites-available/{{ server_fqdn }}.conf"
- dest: "/etc/nginx/sites-enabled/{{ server_fqdn }}.conf"
- state: link
- notify: restart nginx
|