nginx-html-root/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 02 May 2020 18:38:02 -0500
changeset 16 c2ff7e33d1e5
permissions -rw-r--r--
Added nginx web root.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install nginx packages
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="nginx"
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: disable default site
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  file: path="/etc/nginx/sites-enabled/default" state="absent"
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
  notify: restart nginx
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
- name: create http directory
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  become: yes
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
  file: path="{{nginx_html_root}}" state="directory"
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
- name: install root files
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  become: yes
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
  copy: src="{{nginx_html_src}}" dest="{{nginx_html_root}}"
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
- name: enable nginx service
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
  become: yes
c2ff7e33d1e5 Added nginx web root.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
  systemd: name="nginx" enabled="yes" state="started"