iloth_ansible/roles/mattermost/tasks/main.yml

42 lines
1.2 KiB
YAML

---
- name: Download binary from MatterMost website
get_url:
url: https://releases.mattermost.com/{{ mattermost_version }}/mattermost-{{ mattermost_version }}-linux-amd64.tar.gz
dest: /tmp/
- name: unpack mattermost archive
unarchive:
src: /tmp/mattermost-team-{{ mattermost_version }}-linux-amd64.tar.gz
dest: /opt/
copy: no
args:
creates: /opt/mattermost/bin/platform
- name: Edit /opt/mattermost/config/config.json
lineinfile:
dest: /opt/mattermost/config/config.json
regexp: '"DriverName": "mysql",'
line: ' "DriverName": "postgres",'
backrefs: yes
- name: Edit /opt/mattermost/config/config.json
lineinfile:
dest: /opt/mattermost/config/config.json
regexp: '"DataSource":'
line: ' "DataSource": "postgres://{{ db_user }}:{{ db_password }}@127.0.0.1:5432/{{ db_name }}?sslmode=disable&connect_timeout=10",'
backrefs: yes
- name: Create mattermost user
user:
name: "{{ mattermost_user }}"
system: yes
createhome: no
- name: Change mattermost directory permissions
file:
path: /opt/mattermost
state: directory
owner: "{{ mattermost_user }}"
group: "{{ mattermost_user }}"
recurse: yes