dendrite/server/tasks/main.yaml
changeset 163 40b78af86337
parent 159 05d0cf32e077
child 168 8e61e4bb714b
equal deleted inserted replaced
162:a7a64ed07204 163:40b78af86337
       
     1 ---
       
     2 
       
     3 - name: add dendrite user
       
     4   become: yes
       
     5   user: name="{{dendrite_user}}"
       
     6 
       
     7 # build
       
     8 - name: snap install golang
       
     9   become: yes
       
    10   snap: name="go" classic="yes"
       
    11 
       
    12 - name: unarchive dendrite
       
    13   become: yes
       
    14   unarchive:
       
    15     remote_src: yes
       
    16     src: "{{dendrite_tar}}"
       
    17     dest: "/tmp/"
       
    18     creates: "{{dendrite_build_dir}}"
       
    19     owner: "{{dendrite_user}}"
       
    20     group: "{{dendrite_user}}"
       
    21 
       
    22 - name: check if dendrite build exists
       
    23   stat:
       
    24     path: "{{dendrite_build_dir}}/bin"
       
    25   register: build_file
       
    26 
       
    27 - name: build dendrite
       
    28   become: yes
       
    29   become_user: "{{dendrite_user}}"
       
    30   command: "{{dendrite_build_dir}}/build.sh"
       
    31   args:
       
    32     chdir: "{{dendrite_build_dir}}"
       
    33   when: not build_file.stat.exists
       
    34   notify: restart service
       
    35 
       
    36 # install
       
    37 - name: install dendrite binary
       
    38   become: yes
       
    39   copy:
       
    40     src: "{{dendrite_build_dir}}/bin/dendrite-monolith-server"
       
    41     dest: "/usr/local/bin/dendrite-monolith-server"
       
    42     remote_src: yes
       
    43     owner: "root"
       
    44     group: "root"
       
    45     mode: "0755"
       
    46 
       
    47 - name: create instance dir
       
    48   become: yes
       
    49   file:
       
    50     path: "{{item}}"
       
    51     state: "directory"
       
    52     owner: "{{dendrite_user}}"
       
    53     group: "{{dendrite_user}}"
       
    54     mode: "0755"
       
    55   notify: reload service
       
    56   loop:
       
    57     - "{{dendrite_dir}}"
       
    58     - "{{dendrite_dir}}/{{dendrite_instance}}"
       
    59 
       
    60 - name: install keys
       
    61   become: yes
       
    62   copy:
       
    63     src: "{{item}}"
       
    64     dest: "{{dendrite_dir}}/{{dendrite_instance}}/"
       
    65     owner: "{{dendrite_user}}"
       
    66     group: "{{dendrite_user}}"
       
    67     mode: "0600"
       
    68   loop: "{{dendrite_keys}}"
       
    69 
       
    70 - name: copy db schema file
       
    71   become: yes
       
    72   template:
       
    73     src: "setup_db.psql.j2"
       
    74     dest: "/tmp/setup_db_dendrite_{{dendrite_instance}}.psql"
       
    75     owner: "postgres"
       
    76     group: "postgres"
       
    77     mode: "0600"
       
    78 
       
    79 - name: install db schema psql
       
    80   become: yes
       
    81   become_user: "postgres"
       
    82   command: "psql -f /tmp/setup_db_dendrite_{{dendrite_instance}}.psql"
       
    83   changed_when: false
       
    84 
       
    85 - name: configure dendrite
       
    86   become: yes
       
    87   template:
       
    88     src: "dendrite.yaml.j2"
       
    89     dest: "{{dendrite_dir}}/{{dendrite_instance}}/dendrite.yaml"
       
    90     mode: "0644"
       
    91     owner: "{{dendrite_user}}"
       
    92     group: "{{dendrite_user}}"
       
    93   notify: reload service
       
    94 
       
    95 - name: install systemd service
       
    96   become: yes
       
    97   template:
       
    98     src: "[email protected]"
       
    99     dest: "/lib/systemd/system/[email protected]"
       
   100 
       
   101 - name: ensure service is started
       
   102   become: yes
       
   103   systemd: name="dendrite@{{dendrite_instance}}.service" enabled="yes" state="started"