pleroma/otp/tasks/main.yaml
changeset 141 0708c9c075fc
parent 122 cde9702e3bff
child 143 7d4a477be685
equal deleted inserted replaced
140:f0da6c40158e 141:0708c9c075fc
     1 ---
     1 ---
     2 
     2 
     3 - name: add users
     3 - name: add pleroma user
     4   become: yes
     4   become: yes
     5   user: name="pleroma" shell="/bin/false" home="/opt/pleroma" system="yes"
     5   user: name="pleroma" shell="/bin/false" home="/opt/pleroma" system="yes"
     6 
     6 
     7 - name: apt install pleroma dependencies
     7 - name: apt install pleroma dependencies
     8   become: yes
     8   become: yes
     9   apt: name="libtinfo5"
     9   apt: name="libtinfo5"
    10 
    10 
    11 - name: create config and data directory
    11 - name: create pleroma config and data directories
    12   become: yes
    12   become: yes
    13   file:
    13   file:
    14     path: "{{item}}"
    14     path: "{{item}}"
    15     state: "directory"
    15     state: "directory"
    16     mode: "0755"
    16     mode: "0755"
    17   with_items:
    17   with_items:
    18     - "{{pleroma_data_dir}}"
    18     - "{{pleroma_data_dir}}"
    19     - "/etc/pleroma"
    19     - "/etc/pleroma"
    20     - "/opt/pleroma"
    20     - "/opt/pleroma"
    21 
    21 
    22 - name: install pleroma config
       
    23   template:
       
    24     src: "config.exs.j2"
       
    25     dest: "/etc/pleroma/{{pleroma_instance}}.config.exs"
       
    26     owner: "pleroma"
       
    27     group: "pleroma"
       
    28     mode: "0600"
       
    29   become: yes
       
    30   notify: restart pleroma instance
       
    31 
       
    32 - name: create instance data directory
       
    33   become: yes
       
    34   file:
       
    35     path: "{{item}}"
       
    36     state: "directory"
       
    37     owner: "pleroma"
       
    38     group: "pleroma"
       
    39     mode: "0755"
       
    40   with_items:
       
    41     - "{{pleroma_data_dir}}/{{pleroma_instance}}"
       
    42     - "{{pleroma_data_dir}}/{{pleroma_instance}}/uploads"
       
    43     - "{{pleroma_data_dir}}/{{pleroma_instance}}/static"
       
    44     - "{{pleroma_data_dir}}/{{pleroma_instance}}/static/emoji"
       
    45 
       
    46 - name: install pleroma db schema file
       
    47   become: yes
       
    48   template:
       
    49     src: "setup_db.psql.j2"
       
    50     dest: "/tmp/setup_db_{{pleroma_instance}}.psql"
       
    51     owner: "{{pleroma_db_superuser}}"
       
    52     group: "{{pleroma_db_superuser}}"
       
    53     mode: "0600"
       
    54 
       
    55 - name: install pleroma psql
       
    56   become: yes
       
    57   become_user: "{{pleroma_db_superuser}}"
       
    58   command: "psql -f /tmp/setup_db_{{pleroma_instance}}.psql"
       
    59   changed_when: false
       
    60 
       
    61 - name: download and unarchive pleroma release
       
    62   become: yes
       
    63   unarchive:
       
    64     src: "{{pleroma_download_url}}"
       
    65     dest: "/tmp/"
       
    66     creates: "/tmp/release"
       
    67     remote_src: yes
       
    68   notify: restart pleroma instance
       
    69 
       
    70 - name: install pleroma release
       
    71   become: yes
       
    72   copy:
       
    73     remote_src: true
       
    74     src: "/tmp/release/"
       
    75     dest: "/opt/pleroma/"
       
    76     owner: "pleroma"
       
    77     group: "pleroma"
       
    78   changed_when: false
       
    79 
       
    80 - include_tasks: soapbox.yaml
       
    81   when: pleroma_soapbox
       
    82 
       
    83 - name: configure pleroma systemd service
    22 - name: configure pleroma systemd service
    84   become: yes
    23   become: yes
    85   copy:
    24   copy:
    86     src: "[email protected]"
    25     src: "[email protected]"
    87     dest: "/lib/systemd/system/[email protected]"
    26     dest: "/lib/systemd/system/[email protected]"
    88   notify: restart pleroma instance
    27   notify: restart pleroma instance
    89 
    28 
    90 - name: ensure pleroma instance is enabled and started
    29 - name: check if pleroma release exists
    91   become: yes
    30   stat: path="/tmp/release/"
    92   systemd: name="pleroma@{{pleroma_instance}}.service" enabled="yes" state="started"
    31   register: release
    93 
    32 
    94 - name: migrate db
    33 - include_tasks: install.yaml
    95   become: yes
    34   when: not release.stat.exists
    96   become_user: "pleroma"
    35 
    97   command: "/opt/pleroma/bin/pleroma_ctl migrate"
    36 - include_tasks: instance.yaml
    98   args:
       
    99     chdir: "/opt/pleroma/"
       
   100   environment:
       
   101     PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs"
       
   102   changed_when: false