53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
|
---
|
||
|
- name: add official nginx apt key
|
||
|
apt_key:
|
||
|
state: present
|
||
|
id: 7BD9BF62
|
||
|
url: "https://nginx.org/keys/nginx_signing.key"
|
||
|
|
||
|
- name: add official nginx apt repository
|
||
|
apt_repository:
|
||
|
state: present
|
||
|
repo: "{{ item }}"
|
||
|
update_cache: yes
|
||
|
filename: nginx
|
||
|
with_items:
|
||
|
- deb http://nginx.org/packages/debian/ stretch nginx
|
||
|
- deb-src http://nginx.org/packages/debian/ stretch nginx
|
||
|
|
||
|
- name: install nginx packages
|
||
|
package:
|
||
|
name: nginx
|
||
|
state: present
|
||
|
|
||
|
- name: write nginx configuration default.conf
|
||
|
template:
|
||
|
src: default.conf.j2
|
||
|
dest: /etc/nginx/conf.d/default.conf
|
||
|
mode: 0644
|
||
|
notify: reload nginx
|
||
|
|
||
|
- name: manage html directory for static files
|
||
|
file:
|
||
|
path: /var/www/html/static
|
||
|
state: directory
|
||
|
mode: 0755
|
||
|
|
||
|
- name: copy css stylesheet
|
||
|
copy:
|
||
|
src: style.css
|
||
|
dest: /var/www/html/static/style.css
|
||
|
mode: 0644
|
||
|
|
||
|
- name: write index.html
|
||
|
template:
|
||
|
src: index.html.j2
|
||
|
dest: /var/www/html/index.html
|
||
|
mode: 0644
|
||
|
|
||
|
- name: configure systemd unit nginx
|
||
|
systemd:
|
||
|
name: nginx
|
||
|
state: started
|
||
|
enabled: yes
|