source: darkpeak-services/roles/pleroma/tasks/main.yml @ 7ac752f2

keycloakpleroma
Last change on this file since 7ac752f2 was 7ac752f2, checked in by Caolan McMahon <caolan.mcmahon@…>, 2 years ago

pleroma: change image upload directory

  • Property mode set to 100644
File size: 2.5 KB
Line 
1- name: add Erlang Solutions repository (including public key for apt-secure)
2  apt:
3    deb: https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
4  register: erlang_solutions_repo
5
6- name: update apt cache
7  apt:
8    update_cache: yes
9  when: erlang_solutions_repo is changed
10
11- name: install pleroma build dependencies
12  apt:
13    name: "{{ item }}"
14    state: present
15    update_cache: yes
16    cache_valid_time: 10800   # 3 hours
17  with_items:
18    - build-essential
19    - git
20    - wget
21    - sudo
22    - elixir
23    - esl-erlang
24    - imagemagick   # to automatically strip EXIF data
25
26- name: add pleroma user
27  user:
28    name: pleroma
29
30- name: clone pleroma git repository
31  become_user: pleroma
32  git:
33    repo: https://git.pleroma.social/pleroma/pleroma
34    dest: /home/pleroma/pleroma
35
36- name: Configure pleroma
37  template:
38    src: config.exs
39    dest: /home/pleroma/pleroma/config/prod.secret.exs
40  notify:
41    - restart pleroma
42
43- name: get elixir dependencies
44  become_user: pleroma
45  shell: mix local.hex --force && mix local.rebar --force && MIX_ENV=prod mix deps.get
46  args:
47    chdir: /home/pleroma/pleroma
48
49- name: Add postgresql user
50  include: ../../community/geerlingguy.postgresql/tasks/users.yml
51
52- name: Add postgresql database
53  include: ../../community/geerlingguy.postgresql/tasks/databases.yml
54
55- name: Copy database setup file
56  copy:
57    src: setup_db.psql
58    dest: /home/pleroma/pleroma/config/setup_db.psql
59    owner: pleroma
60    group: pleroma
61    mode: 0644
62
63- name: Initialise database
64  # requires root psql access to create extensions used by ecto.migrate step
65  become_user: postgres
66  command: "psql -d {{ postgresql_databases[0].name }} \
67                 -f /home/pleroma/pleroma/config/setup_db.psql
68                 -q"
69
70- name: Run database migrations
71  become_user: pleroma
72  shell: MIX_ENV=prod mix ecto.migrate
73  args:
74    chdir: /home/pleroma/pleroma
75
76- name: Enable required apache2 modules
77  apache2_module:
78    name: "{{ item }}"
79  with_items:
80    - proxy
81    - proxy_http
82    - proxy_wstunnel
83    - rewrite
84   
85- name: Configure apache for pleroma
86  include: ../../apache2/tasks/configure-apache-site.yml
87
88- name: Install systemd unit file
89  copy:
90    src: pleroma.service
91    dest: "/etc/systemd/system/pleroma.service"
92    owner: root
93    group: root
94    mode: 0644
95
96- name: Create uploads directory
97  file:
98    path: "{{ web_root }}/uploads"
99    mode: 0755
100    owner: pleroma
101    group: www-data
102    state: directory
103   
104- name: Enable pleroma service
105  service:
106    name: pleroma
107    enabled: yes
108  notify:
109    - restart pleroma
Note: See TracBrowser for help on using the repository browser.