summaryrefslogblamecommitdiffstats
path: root/pad/tasks/main.yml
blob: bb3209d1790f3ae63fe4daf52c2e2ea0c0dc0199 (plain) (tree)
1
2
3
4

                    
                               
              

























                                                                
              

                                            
              



























                                                                                 

                                    
              




                              









                                              
              
                                

                      
              

                  
                    























                                                                                                                                        
---
# tasks file for pad
- name: Set up packages as root
  become: true
  block:
  - name: Add nodesource key
    apt_key:
      url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
      state: present
  - name: Add nodesource repository
    ansible.builtin.apt_repository:
      repo: deb https://deb.nodesource.com/node_13.x buster main
      update_cache: yes
  - name: Install packages
    apt:
      update_cache: yes
      name:
        - systemd
        - sudo
        - nodejs
        - mariadb-server
        - mariadb-client
      state: present
  - name: Create etherpad user
    user:
      name: etherpad
      home: /home/etherpad
      shell: /bin/bash
      state: present
- include: mariadb.yml
  become: true
- name: Set up etherpad as the etherpad user
  tags: etherpad-src
  become: true
  block:
  - name: Install etherpad
    git:
      repo: https://github.com/ether/etherpad-lite.git
      dest: "{{ etherpad_path }}"
      depth: 1
  - name: Configure etherpad
    template:
      src: templates/settings.json
      dest: "{{ etherpad_path }}/settings.json"
  - name: Install dependencies
    shell: cd {{ etherpad_path }}; . src/bin/functions.sh; src/bin/installDeps.sh
  - name: Install etherpad plugins
    npm:
      name: ep_pad-lister
      path: "{{ etherpad_path }}"
  - name: Change ownership
    file:
      dest: /home/etherpad/etherpad
      owner: "{{ etherpad_user }}"
      group: "{{ etherpad_group }}"
      recurse: true
  - name: Set etherpad API key
    copy:
      content: "{{ etherpad_api_key }}"
      dest: "{{ etherpad_path }}/APIKEY.txt"
      owner: "{{ etherpad_user }}"
      mode: "0600"
- name: Install init.d configuration
  tags: system
  become: true
  template:
    src: etherpad.init.d
    dest: /etc/init.d/etherpad
    owner: root
    group: root
    mode: 0644
  when: use_initd is defined
- name: Install systemd configuration
  tags: system
  become: true
  template:
    src: etherpad.service
    dest: /etc/systemd/system/etherpad.service
    owner: root
    group: root
    mode: 0755
  when: use_initd is not defined
- name: Start Etherpad
  tags: system
  become: true
  service:
    name: etherpad
    state: restarted
- tags: create-pads
  include_vars:
    file: talks.json
    name: talks
- name: Set slugs
  tags: create-pads
  set_fact:
    slugs:
- name: Wait for OK
  tags: create-pads
  uri:
    url: "http://localhost:9001/api/1/createPad?apikey={{ etherpad_api_key }}&padID={{etherpad_base}}-{{etherpad_year}}"
  register: _result
  until: _result.status == 200
  retries: 720
  delay: 5  
- debug:
    var: _result
  tags: create-pads
- name: Create pads
  tags: create-pads
  uri:
    url: "http://localhost:9001/api/1/createPad?apikey={{ etherpad_api_key }}&padID={{etherpad_base}}-{{etherpad_year}}-{{ item.slug }}"
  loop: "{{ talks | json_query('talks[*]') }}"