Skip to content

Commit

Permalink
Merge pull request spantaleev#418 from mooomooo/var-paths
Browse files Browse the repository at this point in the history
Made directory variables for system files
  • Loading branch information
spantaleev authored Mar 25, 2020
2 parents e584980 + eebc6e1 commit c58a7b8
Show file tree
Hide file tree
Showing 40 changed files with 92 additions and 89 deletions.
3 changes: 3 additions & 0 deletions roles/matrix-base/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ matrix_base_data_path: "/matrix"
matrix_base_data_path_mode: "750"

matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files"
matrix_systemd_path: "/etc/systemd/system"
matrix_cron_path: "/etc/cron.d"
matrix_local_bin_path: "/usr/local/bin"

matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}"

Expand Down
2 changes: 1 addition & 1 deletion roles/matrix-base/tasks/setup_matrix_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
- name: Ensure matrix-remove-all script created
template:
src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2"
dest: "/usr/local/bin/matrix-remove-all"
dest: "{{ matrix_local_bin_path }}/matrix-remove-all"
mode: 0750

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ if [ "$sure" != "Yes, I really want to remove everything!" ]; then
exit 0
else
echo "Stop and remove matrix services"
for s in $(find /etc/systemd/system/ -name "matrix-*" -printf "%f\n"); do
for s in $(find {{ matrix_systemd_path }}/ -name "matrix-*" -printf "%f\n"); do
systemctl stop $s
rm -f /etc/systemd/system/$s
rm -f {{ matrix_systemd_path }}/$s
done
systemctl daemon-reload
echo "Remove matrix cronjobs"
find /etc/cron.d/ -name "matrix-*" -delete
echo "Remove matrix scripts"
find /usr/local/bin/ -name "matrix-*" -delete
find {{ matrix_local_bin_path }}/ -name "matrix-*" -delete
echo "Remove every docker images"
docker rmi $(docker images -aq)
echo "Remove docker matrix network"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
- name: Ensure matrix-appservice-discord.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2"
dest: "/etc/systemd/system/matrix-appservice-discord.service"
dest: "{{ matrix_systemd_path }}/matrix-appservice-discord.service"
mode: 0644
register: matrix_appservice_discord_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-appservice-discord service
stat:
path: "/etc/systemd/system/matrix-appservice-discord.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-discord.service"
register: matrix_appservice_discord_service_stat

- name: Ensure matrix-appservice-discord is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-appservice-discord.service doesn't exist
file:
path: "/etc/systemd/system/matrix-appservice-discord.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-discord.service"
state: absent
when: "matrix_appservice_discord_service_stat.stat.exists"

Expand Down
2 changes: 1 addition & 1 deletion roles/matrix-bridge-appservice-irc/tasks/setup_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
- name: Ensure matrix-appservice-irc.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2"
dest: "/etc/systemd/system/matrix-appservice-irc.service"
dest: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
mode: 0644
register: matrix_appservice_irc_systemd_service_result

Expand Down
4 changes: 2 additions & 2 deletions roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-appservice-irc service
stat:
path: "/etc/systemd/system/matrix-appservice-irc.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
register: matrix_appservice_irc_service_stat

- name: Ensure matrix-appservice-irc is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-appservice-irc.service doesn't exist
file:
path: "/etc/systemd/system/matrix-appservice-irc.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
state: absent
when: "matrix_appservice_irc_service_stat.stat.exists"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- name: Ensure matrix-appservice-slack.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-slack.service.j2"
dest: "/etc/systemd/system/matrix-appservice-slack.service"
dest: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
mode: 0644
register: matrix_appservice_slack_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-appservice-slack service
stat:
path: "/etc/systemd/system/matrix-appservice-slack.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
register: matrix_appservice_slack_service_stat

- name: Ensure matrix-appservice-slack is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-appservice-slack.service doesn't exist
file:
path: "/etc/systemd/system/matrix-appservice-slack.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
state: absent
when: "matrix_appservice_slack_service_stat.stat.exists"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
- name: Ensure matrix-appservice-webhooks.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-webhooks.service.j2"
dest: "/etc/systemd/system/matrix-appservice-webhooks.service"
dest: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service"
mode: 0644
register: matrix_appservice_webhooks_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-appservice-webhooks service
stat:
path: "/etc/systemd/system/matrix-appservice-webhooks.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service"
register: matrix_appservice_webhooks_service_stat

- name: Ensure matrix-appservice-webhooks is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-appservice-webhooks.service doesn't exist
file:
path: "/etc/systemd/system/matrix-appservice-webhooks.service"
path: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service"
state: absent
when: "matrix_appservice_webhooks_service_stat.stat.exists"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
- name: Ensure matrix-mautrix-facebook.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-facebook.service.j2"
dest: "/etc/systemd/system/matrix-mautrix-facebook.service"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service"
mode: 0644
register: matrix_mautrix_facebook_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-mautrix-facebook service
stat:
path: "/etc/systemd/system/matrix-mautrix-facebook.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service"
register: matrix_mautrix_facebook_service_stat

- name: Ensure matrix-mautrix-facebook is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-mautrix-facebook.service doesn't exist
file:
path: "/etc/systemd/system/matrix-mautrix-facebook.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service"
state: absent
when: "matrix_mautrix_facebook_service_stat.stat.exists"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
- name: Ensure matrix-mautrix-hangouts.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-hangouts.service.j2"
dest: "/etc/systemd/system/matrix-mautrix-hangouts.service"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service"
mode: 0644
register: matrix_mautrix_hangouts_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-mautrix-hangouts service
stat:
path: "/etc/systemd/system/matrix-mautrix-hangouts.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service"
register: matrix_mautrix_hangouts_service_stat

- name: Ensure matrix-mautrix-hangouts is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-mautrix-hangouts.service doesn't exist
file:
path: "/etc/systemd/system/matrix-mautrix-hangouts.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service"
state: absent
when: "matrix_mautrix_hangouts_service_stat.stat.exists"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
- name: Ensure matrix-mautrix-telegram.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service.j2"
dest: "/etc/systemd/system/matrix-mautrix-telegram.service"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service"
mode: 0644
register: matrix_mautrix_telegram_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-mautrix-telegram service
stat:
path: "/etc/systemd/system/matrix-mautrix-telegram.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service"
register: matrix_mautrix_telegram_service_stat

- name: Ensure matrix-mautrix-telegram is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-mautrix-telegram.service doesn't exist
file:
path: "/etc/systemd/system/matrix-mautrix-telegram.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service"
state: absent
when: "matrix_mautrix_telegram_service_stat.stat.exists"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
- name: Ensure matrix-mautrix-whatsapp.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-whatsapp.service.j2"
dest: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
dest: "{{ matrix_systemd_path }}/matrix-mautrix-whatsapp.service"
mode: 0644
register: matrix_mautrix_whatsapp_systemd_service_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Check existence of matrix-mautrix-whatsapp service
stat:
path: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-whatsapp.service"
register: matrix_mautrix_whatsapp_service_stat

- name: Ensure matrix-mautrix-whatsapp is stopped
Expand All @@ -14,7 +14,7 @@

- name: Ensure matrix-mautrix-whatsapp.service doesn't exist
file:
path: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
path: "{{ matrix_systemd_path }}/matrix-mautrix-whatsapp.service"
state: absent
when: "matrix_mautrix_whatsapp_service_stat.stat.exists"

Expand Down
8 changes: 4 additions & 4 deletions roles/matrix-corporal/tasks/setup_corporal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- name: Ensure matrix-corporal.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-corporal.service.j2"
dest: "/etc/systemd/system/matrix-corporal.service"
dest: "{{ matrix_systemd_path }}/matrix-corporal.service"
mode: 0644
register: matrix_corporal_systemd_service_result
when: matrix_corporal_enabled|bool
Expand All @@ -54,7 +54,7 @@

- name: Check existence of matrix-corporal service
stat:
path: "/etc/systemd/system/matrix-corporal.service"
path: "{{ matrix_systemd_path }}/matrix-corporal.service"
register: matrix_corporal_service_stat
when: "not matrix_corporal_enabled|bool"

Expand All @@ -68,7 +68,7 @@

- name: Ensure matrix-corporal.service doesn't exist
file:
path: "/etc/systemd/system/matrix-corporal.service"
path: "{{ matrix_systemd_path }}/matrix-corporal.service"
state: absent
when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists"

Expand All @@ -82,7 +82,7 @@
path: "{{ item }}"
state: absent
with_items:
- /etc/systemd/system/matrix-corporal.service
- "{{ matrix_systemd_path }}/matrix-corporal.service"
- "{{ matrix_corporal_config_dir_path }}/config.json"
when: "not matrix_corporal_enabled|bool"

Expand Down
6 changes: 3 additions & 3 deletions roles/matrix-coturn/tasks/setup_coturn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
- name: Ensure matrix-coturn.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-coturn.service.j2"
dest: "/etc/systemd/system/matrix-coturn.service"
dest: "{{ matrix_systemd_path }}/matrix-coturn.service"
mode: 0644
register: matrix_coturn_systemd_service_result
when: matrix_coturn_enabled|bool
Expand Down Expand Up @@ -116,7 +116,7 @@

- name: Check existence of matrix-coturn service
stat:
path: "/etc/systemd/system/matrix-coturn.service"
path: "{{ matrix_systemd_path }}/matrix-coturn.service"
register: matrix_coturn_service_stat
when: "not matrix_coturn_enabled|bool"

Expand All @@ -130,7 +130,7 @@

- name: Ensure matrix-coturn.service doesn't exist
file:
path: "/etc/systemd/system/matrix-coturn.service"
path: "{{ matrix_systemd_path }}/matrix-coturn.service"
state: absent
when: "not matrix_coturn_enabled|bool and matrix_coturn_service_stat.stat.exists"

Expand Down
6 changes: 3 additions & 3 deletions roles/matrix-dimension/tasks/setup_dimension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- name: Ensure matrix-dimension.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-dimension.service.j2"
dest: "/etc/systemd/system/matrix-dimension.service"
dest: "{{ matrix_systemd_path }}/matrix-dimension.service"
mode: 0644
register: matrix_dimension_systemd_service_result
when: matrix_dimension_enabled|bool
Expand All @@ -49,7 +49,7 @@

- name: Check existence of matrix-dimension service
stat:
path: "/etc/systemd/system/matrix-dimension.service"
path: "{{ matrix_systemd_path }}/matrix-dimension.service"
register: matrix_dimension_service_stat
when: "not matrix_dimension_enabled|bool"

Expand All @@ -63,7 +63,7 @@

- name: Ensure matrix-dimension.service doesn't exist
file:
path: "/etc/systemd/system/matrix-dimension.service"
path: "{{ matrix_systemd_path }}/matrix-dimension.service"
state: absent
when: "not matrix_dimension_enabled|bool and matrix_dimension_service_stat.stat.exists"

Expand Down
6 changes: 3 additions & 3 deletions roles/matrix-email2matrix/tasks/setup_email2matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- name: Ensure matrix-email2matrix.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2"
dest: "/etc/systemd/system/matrix-email2matrix.service"
dest: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
mode: 0644
register: matrix_email2matrix_systemd_service_result
when: matrix_email2matrix_enabled|bool
Expand All @@ -52,7 +52,7 @@

- name: Check existence of matrix-email2matrix service
stat:
path: "/etc/systemd/system/matrix-email2matrix.service"
path: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
register: matrix_email2matrix_service_stat
when: "not matrix_email2matrix_enabled|bool"

Expand All @@ -66,7 +66,7 @@

- name: Ensure matrix-email2matrix.service doesn't exist
file:
path: "/etc/systemd/system/matrix-email2matrix.service"
path: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
state: absent
when: "not matrix_email2matrix_enabled|bool and matrix_email2matrix_service_stat.stat.exists"

Expand Down
6 changes: 3 additions & 3 deletions roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- name: Ensure matrix-jitsi-jicofo.service installed
template:
src: "{{ role_path }}/templates/jicofo/matrix-jitsi-jicofo.service.j2"
dest: "/etc/systemd/system/matrix-jitsi-jicofo.service"
dest: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service"
mode: 0644
register: matrix_jitsi_jicofo_systemd_service_result
when: matrix_jitsi_enabled|bool
Expand All @@ -60,7 +60,7 @@

- name: Check existence of matrix-jitsi-jicofo service
stat:
path: "/etc/systemd/system/matrix-jitsi-jicofo.service"
path: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service"
register: matrix_jitsi_jicofo_service_stat
when: "not matrix_jitsi_enabled|bool"

Expand All @@ -74,7 +74,7 @@

- name: Ensure matrix-jitsi-jicofo.service doesn't exist
file:
path: "/etc/systemd/system/matrix-jitsi-jicofo.service"
path: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service"
state: absent
when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists"

Expand Down
Loading

0 comments on commit c58a7b8

Please sign in to comment.