pleroma/otp/tasks/main.yaml
changeset 104 73eb2db468ec
parent 103 78a072bbf3c1
child 120 7b3b01948954
equal deleted inserted replaced
59:b339d3c51504 104:73eb2db468ec
       
     1 ---
       
     2 
       
     3 - name: add users
       
     4   become: yes
       
     5   user: name="pleroma" shell="/bin/false" home="/opt/pleroma" system="yes"
       
     6 
       
     7 - name: apt install pleroma dependencies
       
     8   become: yes
       
     9   apt: name="libtinfo5"
       
    10 
       
    11 - name: create config and data directory
       
    12   become: yes
       
    13   file:
       
    14     path: "{{item}}"
       
    15     state: "directory"
       
    16     mode: "0755"
       
    17   with_items:
       
    18     - "{{pleroma_data_dir}}"
       
    19     - "/etc/pleroma"
       
    20     - "/opt/pleroma"
       
    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   changed_when: false
       
    55 
       
    56 - name: install pleroma psql
       
    57   become: yes
       
    58   become_user: "{{pleroma_db_superuser}}"
       
    59   command: "psql -f /tmp/setup_db_{{pleroma_instance}}.psql"
       
    60   changed_when: false
       
    61 
       
    62 - name: download and unarchive pleroma release
       
    63   become: yes
       
    64   unarchive:
       
    65     src: "{{pleroma_download_url}}"
       
    66     dest: "/tmp/"
       
    67     remote_src: yes
       
    68     creates: "/tmp/release"
       
    69   notify: restart pleroma instance
       
    70 
       
    71 - name: install pleroma release
       
    72   become: yes
       
    73   copy:
       
    74     remote_src: true
       
    75     src: "/tmp/release/"
       
    76     dest: "/opt/pleroma/"
       
    77     owner: "pleroma"
       
    78     group: "pleroma"
       
    79   changed_when: false
       
    80 
       
    81 - name: remove tmp release folder
       
    82   become: yes
       
    83   file: path="{{item}}" state="absent"
       
    84   with_items:
       
    85     - "/tmp/setup_db.psql"
       
    86     - "/tmp/release/"
       
    87   when: pleroma_cleanup_tmp
       
    88 
       
    89 - name: configure pleroma systemd service
       
    90   become: yes
       
    91   copy:
       
    92     src: "[email protected]"
       
    93     dest: "/lib/systemd/system/[email protected]"
       
    94   notify: restart pleroma instance
       
    95 
       
    96 - name: ensure pleroma instance is enabled and started
       
    97   become: yes
       
    98   systemd: name="pleroma@{{pleroma_instance}}.service" enabled="yes" state="started"
       
    99 
       
   100 - name: migrate db
       
   101   become: yes
       
   102   become_user: "pleroma"
       
   103   command: "/opt/pleroma/bin/pleroma_ctl migrate"
       
   104   args:
       
   105     chdir: "/opt/pleroma/"
       
   106   environment:
       
   107     PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs"
       
   108   changed_when: false