summaryrefslogtreecommitdiffstats
path: root/roles/wiki/tasks/docker.yml
blob: 4c7fd067e3242e7406b6e5d38048ff743dfa534e (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
- name: Set up docker stuff if on docker
  apt:
    pkg:
      - lighttpd
      - supervisor
      - sudo
- name: Create the anon user
  user:
    name: anon
    state: present
  when: docker
- name: Set up Ikiwiki setup
  template:
    src: emacsconf.setup
    dest: "{{ ikiwiki_path }}/emacsconf.setup"
    owner: www-data
    group: www-data
- name: Set up the ikiwiki directories
  file:
    dest: "{{ ikiwiki_dest }}"
    state: directory
    owner: ikiwiki
    group: www-data
    recurse: true
- name: Clone the bare git repo
  git:
    bare: true
    repo: "{{ ikiwiki_git_source_mount }}"
    dest: "{{ ikiwiki_bare_git_dir }}"
    version: "{{ ikiwiki_git_branch }}"
- name: Set up post-update hook
  template:
    src: post-update
    dest: "{{ ikiwiki_bare_git_dir }}/hooks/post-update"
    mode: 0755
- name: Remove sample
  file:
    path: "{{ ikiwiki_bare_git_dir }}/hooks/post-update.sample"
    state: absent
- name: Set up ikiwiki post-update hook
  template:
    src: post-update.h00-ikiwiki-wrapper
    dest: "{{ ikiwiki_bare_git_dir }}/hooks/post-update.h00-ikiwiki-wrapper"
    mode: 0755  
- name: Change owner
  file:
    dest: "{{ ikiwiki_bare_git_dir }}"
    recurse: true
    owner: ikiwiki
    group: www-data
- name: Clone the working git repo
  git:
    repo: "{{ ikiwiki_bare_git_dir }}"
    dest: "{{ ikiwiki_src_dir }}"
    version: "{{ ikiwiki_git_branch }}"
- name: Chown all the files to ikiwiki
  file:
    dest: "{{ ikiwiki_src_dir }}"
    owner: ikiwiki
    group: ikiwiki
    recurse: true
- name: Copy supervisor config
  template:
    src: supervisord.conf
    dest: /etc/supervisor/conf.d/ikiwiki.conf
- name: Start lighttpd
  service:
    name: lighttpd
    state: started
- name: Start ssh
  tags: ssh
  service:
    name: ssh
    state: started
- name: Set up SSH directory
  tags: ssh
  file:
    path: /home/ikiwiki/.ssh
    owner: ikiwiki
    group: ikiwiki
    state: directory
    mode: 0700
- name: Set up SSH authentication
  tags: ssh
  block:
    - name: Copy key
      template:
        src: "{{ docker_ssh_key }}"
        dest: "/home/ikiwiki/.ssh/authorized_keys2"
        mode: 0600
    - name: Change ownership
      file:
        path: "/home/ikiwiki/.ssh"
        owner: ikiwiki
        group: ikiwiki
        recurse: true
  when: docker_ssh_key is defined