summaryrefslogblamecommitdiffstats
path: root/roles/wiki/tasks/main.yml
blob: 3ee7d4f88dd81a461b7ff28239fc7f2c420b3135 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                            




                  








                            
















































                                                                                                          




                                              


                          



                                                    
                            
                    

                     
                                                               



                     
                           
              
                                      
                    



                              
                    
                 



                     
                                
                                     


                                                                                               


                  
---
- name: Set up packages
  ansible.builtin.apt:
    update_cache: true
    pkg:
      - ikiwiki
      - git
      - openssh-server
      - libimage-magick-perl
      - libtext-csv-perl
      - libxml-writer-perl
      - imagemagick
      - nginx
      - wget
    state: present
- name: Start ssh
  tags: ssh
  service:
    name: ssh
    state: started
- name: Create ikiwiki group
  group:
    name: ikiwiki
    state: present
- name: Create ikiwiki user
  user:
    name: ikiwiki
    group: ikiwiki
    state: present
- name: Create anon group
  group:
    name: anon
    state: present
- name: Create anon user
  user:
    name: anon
    group: anon
    state: present
- include_tasks: bare-git.yml
  when: docker or test_mode
- name: Configure safe directory
  shell: git config --global --add safe.directory "{{ ikiwiki_src_dir }}"
- name: Clone the working git repo
  git:
    repo: "{{ ikiwiki_bare_git_dir }}"
    dest: "{{ ikiwiki_src_dir }}"
- name: Switch the source git repo to the branch
  shell: git checkout "{{ ikiwiki_git_branch }}" 2>/dev/null || git checkout -b "{{ ikiwiki_git_branch }}"
  args:
    chdir: "{{ ikiwiki_src_dir }}"
- name: Set the default branch policy
  shell: git config --global pull.rebase false
  become: true
  become_user: ikiwiki
- name: Set up SSH directory
  tags: ssh
  file:
    path: /home/ikiwiki/.ssh
    owner: ikiwiki
    group: ikiwiki
    state: directory
    mode: 0700
- name: Set up SSH key access
  tags: wiki-test-keys
  template:
    src: authorized_keys
    dest: "/home/ikiwiki/.ssh/authorized_keys"
    mode: 0600
    owner: ikiwiki
    group: ikiwiki
  when: test_mode
- name: Set up the ikiwiki directories
  file:
    dest: "{{ ikiwiki_dest }}"
    state: directory
    owner: ikiwiki
    group: ikiwiki
    recurse: true
- name: Template the config
  ansible.builtin.template:
    src: emacsconf.setup
    dest: "{{ ikiwiki_path }}/emacsconf.setup"
    owner: ikiwiki
    group: ikiwiki
- include_tasks: nginx.yml
  when: test_mode
- name: Create the plugin directory
  file:
    path: "{{ ikiwiki_plugin_path }}/IkiWiki/Plugin"
    state: directory
- name: Copy Ikiwiki plugins
  tags: wiki-plugins
  template:
    src: "{{ item }}"
    dest: "{{ ikiwiki_plugin_path }}/IkiWiki/Plugin/{{ item }}"
  loop:
    - copyright.pm
    - htmlscrubber.pm
    - license.pm
- include_tasks: docker.yml
  when: docker
- name: Chown all the files to ikiwiki
  tags: wiki-plugins
  file:
    dest: "{{ ikiwiki_path }}"
    owner: ikiwiki
    group: ikiwiki
    state: directory
    recurse: true
- name: Debug
  tags: dev-wiki
  debug:
    var: ikiwiki_path
- name: Regenerate all the files
  tags: wiki-regenerate, wiki-plugins
  become: true
  become_user: ikiwiki
  shell: cd ~ikiwiki; ikiwiki --setup "{{ ikiwiki_path }}/emacsconf.setup" --rebuild --wrappers
  register: output
- debug:
    var: output