Support both binary & source install, improved README, fixed systemd service etc.
This commit is contained in:
parent
70ecff8caf
commit
318029b9a9
7 changed files with 93 additions and 14 deletions
|
@ -20,10 +20,10 @@
|
|||
vars:
|
||||
__os_supported: "{{ lookup('vars', '{}_os_supported'.format(role_name)) | bool }}"
|
||||
|
||||
- name: Assert matrixmailer version and system_spec are defined
|
||||
- name: Assert matrixmailer version and build are defined
|
||||
assert:
|
||||
that: matrixmailer_version is defined and matrixmailer_system_spec is defined and matrixmailer_config is defined
|
||||
fail_msg: "The ansible variables 'matrixmailer_version', 'matrixmailer_system_spec' and 'matrixmailer_config' need to be set to run this role."
|
||||
that: matrixmailer_version is defined and matrixmailer_build is defined and matrixmailer_config is defined
|
||||
fail_msg: "The ansible variables 'matrixmailer_version', 'matrixmailer_build' and 'matrixmailer_config' need to be set to run this role."
|
||||
|
||||
- name: Create matrixmailer group
|
||||
group:
|
||||
|
@ -40,14 +40,49 @@
|
|||
password_lock: yes
|
||||
state: present
|
||||
|
||||
- name: Download matrixmailer
|
||||
become: yes
|
||||
get_url:
|
||||
url: "https://gitea.a-0.me/philip/matrixmailer/releases/download/{{ matrixmailer_version }}/{{ matrixmailer_system_spec }}"
|
||||
dest: "{{ matrixmailer_binary_location }}"
|
||||
owner: "{{ matrixmailer_system_user }}"
|
||||
group: "{{ matrixmailer_system_group }}"
|
||||
mode: 0500
|
||||
- name: Install matrixmailer from pre-built binary
|
||||
block:
|
||||
- name: Download matrixmailer
|
||||
become: yes
|
||||
get_url:
|
||||
url: "https://gitea.a-0.me/philip/matrixmailer/releases/download/{{ matrixmailer_version }}/{{ matrixmailer_build }}"
|
||||
dest: "{{ matrixmailer_binary_location }}"
|
||||
owner: "{{ matrixmailer_system_user }}"
|
||||
group: "{{ matrixmailer_system_group }}"
|
||||
mode: 0500
|
||||
when: matrixmailer_build != "from_source"
|
||||
|
||||
- name: Install matrixmailer custom-built from git repository
|
||||
block:
|
||||
- name: Clone repository
|
||||
git:
|
||||
repo: "{{ matrixmailer_git_repo }}"
|
||||
depth: 1
|
||||
dest: "{{ matrixmailer_build_tmp }}"
|
||||
version: "{{ matrixmailer_git_branch }}"
|
||||
- name: Install required packages
|
||||
apt:
|
||||
pkg:
|
||||
- libssl-dev
|
||||
- pkg-config
|
||||
- curl
|
||||
state: present
|
||||
- name: Install Rust
|
||||
command:
|
||||
cmd: "curl https://sh.rustup.rs -sSf | sh"
|
||||
- name: Install matrixmailer
|
||||
command:
|
||||
cmd: cargo build --release
|
||||
chdir: "{{ matrixmailer_build_tmp }}"
|
||||
- name: Copy built binary to final location
|
||||
copy:
|
||||
remote_src: yes
|
||||
src: "{{ matrixmailer_build_tmp }}"/release/matrixmailer
|
||||
dest: "{{ matrixmailer_binary_location }}"
|
||||
owner: "{{ matrixmailer_system_user }}"
|
||||
group: "{{ matrixmailer_system_group }}"
|
||||
mode: 0500
|
||||
when: matrixmailer_build == "from_source"
|
||||
|
||||
- name: Create config file directory
|
||||
file:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue