roles/pleroma-otp/tasks/main.yaml
changeset 85 dcfd23308c32
parent 84 d0c40727e6ff
child 87 4f87097dd651
equal deleted inserted replaced
84:d0c40727e6ff 85:dcfd23308c32
    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 
    21 
    21 - name: install pleroma config
    22 - name: install pleroma config
    22   template:
    23   template:
    23     src: "config.exs.j2"
    24     src: "config.exs.j2"
    24     dest: "/etc/pleroma/{{pleroma_instance}}.config.exs"
    25     dest: "/etc/pleroma/{{pleroma_instance}}.config.exs"
    25     mode: "0700"
    26     owner: "pleroma"
       
    27     group: "pleroma"
       
    28     mode: "0600"
    26   become: yes
    29   become: yes
    27   notify: "restart pleroma {{pleroma_instance}} instance"
    30   notify: restart pleroma instance
    28 
    31 
    29 - name: create instance data directory
    32 - name: create instance data directory
    30   become: yes
    33   become: yes
    31   file:
    34   file:
    32     path: "{{item}}"
    35     path: "{{item}}"
    38     - "{{pleroma_data_dir}}/{{pleroma_instance}}"
    41     - "{{pleroma_data_dir}}/{{pleroma_instance}}"
    39     - "{{pleroma_data_dir}}/{{pleroma_instance}}/uploads"
    42     - "{{pleroma_data_dir}}/{{pleroma_instance}}/uploads"
    40     - "{{pleroma_data_dir}}/{{pleroma_instance}}/static"
    43     - "{{pleroma_data_dir}}/{{pleroma_instance}}/static"
    41     - "{{pleroma_data_dir}}/{{pleroma_instance}}/static/emoji"
    44     - "{{pleroma_data_dir}}/{{pleroma_instance}}/static/emoji"
    42 
    45 
    43 # Set config path in systemd: PLEROMA_CONFIG_PATH
    46 - name: install pleroma db schema file
       
    47   template:
       
    48     src: "setup_db.psql.j2"
       
    49     dest: "/tmp/setup_db.psql"
       
    50     owner: "{{pleroma_db_superuser}}"
       
    51     group: "{{pleroma_db_superuser}}"
       
    52     mode: "0600"
       
    53   become: yes
    44 
    54 
    45 # - name: install pleroma db schema file
    55 - name: install pleroma psql
    46 #   template:
    56   become: yes
    47 #     src: "setup_db.psql.j2"
    57   become_user: "{{pleroma_db_superuser}}"
    48 #     dest: "/tmp/setup_db.psql"
    58   command: "psql -f /tmp/setup_db.psql"
    49 #     owner: "{{pleroma_db_superuser}}"
    59   notify: restart pleroma instance
    50 #     group: "{{pleroma_db_superuser}}"
       
    51 #     mode: "0700"
       
    52 #   become: yes
       
    53 
       
    54 # - name: install pleroma psql
       
    55 #   become: yes
       
    56 #   become_user: "{{pleroma_db_superuser}}"
       
    57 #   command: "psql -f /tmp/setup_db.psql"
       
    58 #   notify: restart pleroma
       
    59 
       
    60 
       
    61 
       
    62 
       
    63 
       
    64 # MIGERATION
       
    65 # mv ~pleroma/uploads/* /var/lib/pleroma/uploads
       
    66 # mv ~pleroma/instance/static /var/lib/pleroma/static
       
    67 # mv ~pleroma/priv/static/emoji /var/lib/pleroma/static/emoji
       
    68 # mv ~pleroma/config/prod.secret.exs /etc/pleroma/config.exs
       
    69 # Change `use Mix.Config` at the top to `import Config`
       
    70 # rm -r ~pleroma/*
       
    71 
       
    72 
    60 
    73 - name: download and unarchive pleroma release
    61 - name: download and unarchive pleroma release
    74   become: yes
    62   become: yes
    75   unarchive:
    63   unarchive:
    76     src: "https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/{{pleroma_branch}}/download?job={{pleroma_flavor}}"
    64     src: "{{pleroma_download_url}}"
    77     dest: "/tmp/"
    65     dest: "/tmp/"
    78     remote_src: yes
    66     remote_src: yes
    79     creates: "/tmp/release"
    67     creates: "/tmp/release"
    80   notify: "restart pleroma {{pleroma_instance}} instance"
    68   notify: restart pleroma instance
    81 
    69 
    82 - name: install pleroma release
    70 - name: install pleroma release
    83   become: yes
    71   become: yes
    84   copy: remote_src="True" src="/tmp/release/" dest="/opt/pleroma/"
    72   copy: remote_src="True" src="/tmp/release/" dest="/opt/pleroma/" owner="pleroma" group="pleroma"
       
    73   notify: restart pleroma instance
    85 
    74 
    86 # - name: Remove old files foo
    75 # - name: remove tmp release folder
    87 #   file: path="/path/to/foo" state="absent"
    76 #   become: yes
       
    77 #   file: path="{{item}}" state="absent"
       
    78 #   with_items:
       
    79 #     - "/tmp/setup_db.psql"
       
    80 #     - "/tmp/release/"
    88 
    81 
    89 # ***
    82 - name: "configure pleroma systemd service"
    90 # mv /tmp/release/* ~pleroma/
    83   become: yes
       
    84   copy:
       
    85     src: "[email protected]"
       
    86     dest: "/lib/systemd/system/[email protected]"
       
    87   notify: restart pleroma instance
    91 
    88 
       
    89 - name: "ensure pleroma {{pleroma_instance}} instance is enabled and started"
       
    90   become: yes
       
    91   systemd: name="pleroma@{{pleroma_instance}}.service" enabled="yes" state="started"
    92 
    92 
    93 # Copy the service into a proper directory
    93 - name: migrate db
    94 # cp ~pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
    94   become: yes
    95 
    95   become_user: "pleroma"
    96 # - name: "configure pleroma systemd service"
    96   command: "/opt/pleroma/bin/pleroma_ctl migrate"
    97 #   become: yes
    97   args:
    98 #   copy:
    98     chdir: "/opt/pleroma/"
    99 #     src: "[email protected]"
    99   environment:
   100 #     dest: "/lib/systemd/system/[email protected]"
   100     PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs"
   101 #   notify: "restart pleroma {{pleroma_instance}} instance"
   101   notify: restart pleroma instance
   102 
       
   103 # - name: "ensure pleroma {{pleroma_instance}} instance is enabled and started"
       
   104 #   become: yes
       
   105 #   systemd: name="pleroma@{{pleroma_instance}}" enabled="yes" state="started"
       
   106 
       
   107 # - name: migrate db
       
   108 #   become: yes
       
   109 #   become_user: "pleroma"
       
   110 #   command: "/opt/pleroma/bin/pleroma_ctl migrate"
       
   111 #   args:
       
   112 #     chdir: "/opt/pleroma/"
       
   113 #   notify: restart pleroma