summaryrefslogtreecommitdiffstats
path: root/tasks/main.yml
blob: 4ffde512d850645c224afa1207131dcd1ad05e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
# tasks file for MicroJoe.staticwebsite

- name: Make sure {{ nginx_upload_user }} user exists
  user:
    name: "{{ nginx_upload_user }}"
    group: "{{ nginx_upload_group }}"

- name: Make sure {{ nginx_upload_user }} has .ssh directory
  file:
    path: "/home/{{ nginx_upload_user }}/.ssh"
    state: directory
    owner: "{{ nginx_upload_user }}"
    group: "{{ nginx_upload_group }}"

- name: Make sure {{ nginx_upload_user }} has .ssh/authorized_keys file
  copy:
    src: ~/.ssh/id_rsa.pub
    dest: "/home/{{ nginx_upload_user }}/.ssh/authorized_keys"
    owner: "{{ nginx_upload_user }}"
    group: "{{ nginx_upload_group }}"

- name: Make sure root directory {{ nginx_root }} exists
  file:
    path: "{{ nginx_root }}"
    state: directory
    owner: "{{ nginx_upload_user }}"
    group: "{{ nginx_upload_group }}"

- name: Install nginx configuration file {{ nginx_filename }}
  template:
    src: templates/nginx.j2
    dest: /etc/nginx/sites-available/{{ nginx_filename }}
    owner: root
    group: root
  notify: restart nginx