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