main.yml 3.59 KB
Newer Older
1
---
rgaudin's avatar
rgaudin committed
2
- name: make sure wikifundi data folder exists
3
  file:
rgaudin's avatar
rgaudin committed
4
5
6
7
8
9
10
    path: "{{ wikifundi_data_root }}"
    state: directory
  tags: move-content

- name: make sure images folder does not exists
  file:
    path: "{{ wikifundi_data_root }}/images_{{ item }}"
11
12
13
14
    state: absent
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
- name: move wikifundi LocalSettings
  command: mv {{ wikifundi_langpack_prefix }}{{ item }}/config/LocalSettings.custom.php {{ mediawiki_root }}/LocalSettings.custom.{{ item }}.php
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

- name: change sqliteDataDir in LocalSettings.custom
  lineinfile:
    dest: "{{ mediawiki_root }}/LocalSettings.custom.{{ item }}.php"
    regexp: '^\$wgSQLiteDataDir = "/var/www/data";'
    line: '$wgSQLiteDataDir = "{{ wikifundi_data_root }}/";'
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

- name: add parsoid config to LocalSettings.custom
  lineinfile:
    dest: "{{ mediawiki_root }}/LocalSettings.custom.{{ item }}.php"
    line: "$wgVirtualRestConfig['modules']['parsoid'] = array('url' => 'http://localhost:8000', 'domain' => '{{ item }}.{{ wikifundi_fqdn }}', 'prefix' => 'mediawiki_kiwix', 'forwardCookies' => true);"
    insertbefore: '\?>'
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
34
  tags: ['move-content', 'rename']
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

- name: add upload path to LocalSettings.custom
  lineinfile:
    dest: "{{ mediawiki_root }}/LocalSettings.custom.{{ item }}.php"
    line: '$wgUploadPath = "$wgScriptPath/images";'
    insertbefore: '\?>'
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

- name: add wgUploadDirectory path to LocalSettings.custom
  lineinfile:
    dest: "{{ mediawiki_root }}/LocalSettings.custom.{{ item }}.php"
    line: '$wgUploadDirectory  = "{{ wikifundi_data_root }}/images_{{ item }}";'
    insertbefore: '\?>'
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

rgaudin's avatar
rgaudin committed
52
53
- name: move wikifundi database
  command: mv {{ wikifundi_langpack_prefix }}{{ item }}/mw_wikifundi_{{ item }}.sqlite {{ wikifundi_data_root }}/mw_wikifundi_{{ item }}.sqlite
54
55
56
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

rgaudin's avatar
rgaudin committed
57
58
59
- name: Add admin account to Wikifundi
  environment:
    WIKIFUNDI_LANG: "{{ item }}"
60
61
62
    ADMIN_ACCOUNT: "{{ admin_account }}"
    ADMIN_PASSWORD: "{{ admin_password }}"
  command: php maintenance/createAndPromote.php --bureaucrat --sysop --force "$ADMIN_ACCOUNT" "$ADMIN_PASSWORD"
rgaudin's avatar
rgaudin committed
63
64
  args:
    chdir: "{{ mediawiki_root }}"
65
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
rgaudin's avatar
rgaudin committed
66
  when: ansible_local.config.admin_account is defined
67
68
  tags: move-content

rgaudin's avatar
rgaudin committed
69
70
- name: move wikifundi images
  command: mv {{ wikifundi_langpack_prefix }}{{ item }}/images {{ wikifundi_data_root }}/images_{{ item }}
71
72
73
  with_items: "{{ ansible_local.config.wikifundi_languages | default(omit) }}"
  tags: move-content

rgaudin's avatar
rgaudin committed
74
- name: Add wikifundi CSS hack
75
  lineinfile:
rgaudin's avatar
rgaudin committed
76
77
78
    dest: /opt/venvs/ideascube/lib/python{{ python3_version }}/site-packages/ideascube/static/ideascube/cards.css
    line: '.card.tinted[href*="http://{{ item }}.{{ wikifundi_fqdn }}"], { background-image: url("http://{{ item }}.{{ wikifundi_fqdn }}/logo-sq.png"); background-size: 48px; }'
    insertafter: EOF
79
    state: present
rgaudin's avatar
rgaudin committed
80
81
82
  with_items: '{{ ansible_local.config.wikifundi_languages | default(omit) }}'
  when: ansible_local.config.wikifundi_languages | length
  tags: ['move-content', 'rename']