roles/pleroma/tasks/main.yaml
changeset 75 d8c87a41cc6d
parent 74 dc20ec78acdd
child 81 5fe7c52b2063
equal deleted inserted replaced
74:dc20ec78acdd 75:d8c87a41cc6d
     1 ---
     1 ---
     2 
     2 
     3 - name: add erland solutions key
     3 - name: add erland solutions key
     4   become: yes
     4   become: yes
     5   apt_key: "url=http://packages.erlang-solutions.com/debian/erlang_solutions.asc"
     5   apt_key: url="http://packages.erlang-solutions.com/debian/erlang_solutions.asc"
     6 
     6 
     7 - name: install erland solutions repo
     7 - name: install erland solutions repo
     8   become: yes
     8   become: yes
     9   apt_repository: repo="deb http://binaries.erlang-solutions.com/debian bionic contrib"
     9   apt_repository: repo="deb http://binaries.erlang-solutions.com/debian buster contrib"
    10 
    10 
    11 - name: update apt package cache
    11 - name: update apt package cache
    12   become: yes
    12   become: yes
    13   apt: upgrade="dist" update_cache="yes" cache_valid_time="3600"
    13   apt: upgrade="dist" update_cache="yes" cache_valid_time="3600"
    14 
    14 
    24   become: yes
    24   become: yes
    25   become_user: "{{pleroma_user}}"
    25   become_user: "{{pleroma_user}}"
    26   git:
    26   git:
    27     repo: "https://git.pleroma.social/pleroma/pleroma.git"
    27     repo: "https://git.pleroma.social/pleroma/pleroma.git"
    28     dest: "~{{pleroma_user}}/pleroma"
    28     dest: "~{{pleroma_user}}/pleroma"
       
    29     version: "{{pleroma_version}}"
    29     force: yes
    30     force: yes
    30 
    31 
    31 - name: install pleroma config files
    32 - name: install pleroma config files
    32   template:
    33   template:
    33     src: "{{item}}.j2"
    34     src: "{{item}}.j2"
    34     dest: "~{{pleroma_user}}/pleroma/config/{{item}}"
    35     dest: "~{{pleroma_user}}/pleroma/config/{{item}}"
    35     owner: "{{pleroma_user}}"
    36     owner: "{{pleroma_user}}"
    36     group: "{{pleroma_user}}"
    37     group: "{{pleroma_user}}"
    37     mode: "0775"
    38     mode: "0775"
    38   become: yes
    39   become: yes
    39   become_user: "{{pleroma_user}}"
       
    40   with_items:
    40   with_items:
    41     - "setup_db.psql"
    41     - "setup_db.psql"
    42     - "prod.secret.exs"
    42     - "prod.secret.exs"
    43   notify: restart pleroma
    43   notify: restart pleroma
    44 
    44 
    45 - name: install pleroma psql
    45 - name: install pleroma psql
    46   become: yes
    46   become: yes
    47   become_user: "{{pleroma_db_superuser}}"
    47   become_user: "{{pleroma_db_superuser}}"
    48   command: "psql -f ~{{pleroma_user}}/pleroma/config/setup_db.psql -h {{pleroma_db_host}}"
    48   command: "psql -f ~{{pleroma_user}}/pleroma/config/setup_db.psql"
    49   notify: restart pleroma
    49   notify: restart pleroma
    50   environment:
    50 
    51     PGUSER: "{{pleroma_db_superuser}}"
    51 # - name: restore
    52     PGPASSWORD: "{{pleroma_db_superpass}}"
    52 #   postgresql_db:
       
    53 #     state: "restore"
       
    54 #     db: "{{pleroma_user}}"
       
    55 #     target: "/tmp/{{pleroma_user}}-backup.sql"
       
    56 #     login_user: "{{pleroma_user}}"
       
    57 #     login_password: "{{pleroma_db_passwd}}"
       
    58 #     login_host: "{{pleroma_db_host}}"
       
    59 #   when: "{{pleroma_restore_db}}"
    53 
    60 
    54 - name: migrate db
    61 - name: migrate db
    55   become: yes
    62   become: yes
    56   become_user: "{{pleroma_user}}"
    63   become_user: "{{pleroma_user}}"
    57   command: "{{item}}"
    64   command: "{{item}}"
    76   become: yes
    83   become: yes
    77 
    84 
    78 - name: enable pleroma systemd service
    85 - name: enable pleroma systemd service
    79   systemd: name="{{pleroma_user}}" enabled="yes" state="started"
    86   systemd: name="{{pleroma_user}}" enabled="yes" state="started"
    80   become: yes
    87   become: yes
       
    88 
       
    89 
       
    90 # - name: backup db
       
    91 #   postgresql_db:
       
    92 #     state: "dump"
       
    93 #     db: "{{pleroma_user}}"
       
    94 #     target: "/tmp/{{pleroma_user}}-backup.sql"
       
    95 #     login_user: "{{pleroma_user}}"
       
    96 #     login_password: "{{pleroma_db_passwd}}"
       
    97 #     login_host: "{{pleroma_db_host}}"
       
    98 
       
    99 
       
   100 
       
   101 
       
   102 
       
   103 # pg_dump -U pleroma_nth_io -h pleroma.ctzpnw3lfkwz.us-east-1.rds.amazonaws.com pleroma_nth_io -f pleroma_nth_io_dump.sql