summaryrefslogtreecommitdiff
path: root/roles/sublab_web/tasks/as_wikiuser.yaml
blob: bd30e9d56f13518fc4de997f6ec858fc4db3686b (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
- name: Put wiki configuration
  template:
    src=ikiwiki.setup.j2
    dest="/home/wiki-{{sublab_web_server_name}}/wiki.setup"
  notify: Rebuild ikiwiki

- name: Put wiki rebuild script
  template:
    src=ikiwiki-rebuild.sh.j2
    dest="/home/wiki-{{sublab_web_server_name}}/ikiwiki-rebuild.sh"
    mode=0755
  notify: Rebuild ikiwiki

- name: Create Template dir
  file:
    path="/home/wiki-{{sublab_web_server_name}}/templates"
    state=directory

- name: Put editpage template
  copy:
    src=ikiwiki-editpage.tmpl
    dest="/home/wiki-{{sublab_web_server_name}}/templates/editpage.tmpl"

- name: Create .ssh dir
  file:
    path="/home/wiki-{{sublab_web_server_name}}/.ssh"
    state=directory
    mode=0700

# This ssh keypair is authorized to push to the git-server wiki repo
- name: Put ssh pubkey
  copy:
    dest="/home/wiki-{{sublab_web_server_name}}/.ssh/id_rsa.pub"
    content="{{wiki_user_pubkey}}"
    mode=0644

- name: Put ssh privkey
  copy:
    dest="/home/wiki-{{sublab_web_server_name}}/.ssh/id_rsa"
    content="{{wiki_user_privkey}}"
    mode=0600

# Configure git
- name: Configure git push for wikiuser
  command: git config --global push.default simple
- name: Configure git name
  command: git config --global user.name "Wiki User {{ansible_hostname}}"
- name:
  command: git config --global user.email "nobody@nowhere.ws"

# Updates to git are pushed automatically and should not
# go through ansible - this is for initial deployment only
- name: Clone wiki git
  git:
    dest="/home/wiki-{{sublab_web_server_name}}/wiki"
    repo=git+ssh://git@{{groups['gitservers'][0]}}/ikiwiki
    accept_hostkey=yes
    update=no
  notify: Rebuild ikiwiki