roles/pleroma/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 19 Jan 2019 13:32:43 -0600
changeset 73 3e6344570822
parent 69 be979818d483
child 74 dc20ec78acdd
permissions -rw-r--r--
Fixed deprecated ansible syntax.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: add erland solutions key
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt_key: "url=http://packages.erlang-solutions.com/debian/erlang_solutions.asc"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: install erland solutions repo
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  apt_repository: repo="deb http://binaries.erlang-solutions.com/debian bionic contrib"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
- name: update apt package cache
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  apt: upgrade="dist" update_cache="yes" cache_valid_time="3600"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
73
3e6344570822 Fixed deprecated ansible syntax.
Luke Hoersten <luke@hoersten.org>
parents: 69
diff changeset
    15
- name: install pleroma apt packages
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  become: yes
73
3e6344570822 Fixed deprecated ansible syntax.
Luke Hoersten <luke@hoersten.org>
parents: 69
diff changeset
    17
  apt: name="{{pleroma_apt_packages}}"
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
- name: add users
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
  user: name="{{pleroma_user}}" shell="/bin/bash"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
- name: checkout plemora
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
  become_user: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  git:
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    repo: "https://git.pleroma.social/pleroma/pleroma.git"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    dest: "~{{pleroma_user}}/pleroma"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    force: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
- name: install pleroma config files
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
  template:
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    src: "{{item}}.j2"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
    dest: "~{{pleroma_user}}/pleroma/config/{{item}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
    owner: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
    group: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
    mode: "0775"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
  become_user: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
  with_items:
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
    - "setup_db.psql"
64
2b0d305daa43 Moved to prod config.
Luke Hoersten <luke@hoersten.org>
parents: 63
diff changeset
    42
    - "prod.secret.exs"
62
63586cf10d46 Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents: 60
diff changeset
    43
  notify: restart pleroma
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
- name: install pleroma psql
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
  become: yes
66
652a236229c2 Updated for external DB.
Luke Hoersten <luke@hoersten.org>
parents: 65
diff changeset
    47
  become_user: "{{pleroma_db_superuser}}"
652a236229c2 Updated for external DB.
Luke Hoersten <luke@hoersten.org>
parents: 65
diff changeset
    48
  command: "psql -f ~{{pleroma_user}}/pleroma/config/setup_db.psql -h {{pleroma_db_host}}"
62
63586cf10d46 Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents: 60
diff changeset
    49
  notify: restart pleroma
66
652a236229c2 Updated for external DB.
Luke Hoersten <luke@hoersten.org>
parents: 65
diff changeset
    50
  environment:
652a236229c2 Updated for external DB.
Luke Hoersten <luke@hoersten.org>
parents: 65
diff changeset
    51
    PGUSER: "{{pleroma_db_superuser}}"
652a236229c2 Updated for external DB.
Luke Hoersten <luke@hoersten.org>
parents: 65
diff changeset
    52
    PGPASSWORD: "{{pleroma_db_superpass}}"
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
- name: migrate db
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
  become_user: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
  command: "{{item}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    58
  args:
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
    chdir: "~{{pleroma_user}}/pleroma/"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    60
  with_items:
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    61
    - "mix local.hex --force"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    62
    - "mix local.rebar --force"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    63
    - "mix deps.get"
69
be979818d483 Lots of updates.
Luke Hoersten <luke@hoersten.org>
parents: 67
diff changeset
    64
    # - "mix ecto.migrate"
62
63586cf10d46 Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents: 60
diff changeset
    65
  notify: restart pleroma
65
4538ad030906 Moved mix commands to prod.
Luke Hoersten <luke@hoersten.org>
parents: 64
diff changeset
    66
  environment:
4538ad030906 Moved mix commands to prod.
Luke Hoersten <luke@hoersten.org>
parents: 64
diff changeset
    67
    MIX_ENV: "prod"
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    68
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    69
- name: install pleroma systemd service
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    70
  template:
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    71
    src: "pleroma.service.j2"
67
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents: 66
diff changeset
    72
    dest: "/lib/systemd/system/{{pleroma_user}}.service"
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    73
    owner: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    74
    group: "{{pleroma_user}}"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    75
    mode: "0770"
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    76
  become: yes
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    77
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    78
- name: enable pleroma systemd service
67
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents: 66
diff changeset
    79
  systemd: name="{{pleroma_user}}" enabled="yes" state="started"
60
48a3a65119d5 Initial commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    80
  become: yes