Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ansible deprecations #187

Merged
merged 5 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# For improved Ansible performance, SSH pipelining is enabled by default (`ansible_ssh_pipelining=yes`).
# If this causes SSH connection troubles, feel free to disable it.

[matrix-servers]
[matrix_servers]
matrix.<your-domain> ansible_host=<your-server's external IP address> ansible_ssh_user=root ansible_ssh_pipelining=yes
File renamed without changes.
10 changes: 5 additions & 5 deletions roles/matrix-base/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
- always

- import_tasks: "{{ role_path }}/tasks/clean_up_old_files.yml"
when: run_setup
when: run_setup|bool
tags:
- setup-all

- import_tasks: "{{ role_path }}/tasks/setup_server_base.yml"
when: run_setup
when: run_setup|bool
tags:
- setup-all

- import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml"
when: run_setup
when: run_setup|bool
tags:
- setup-all

- import_tasks: "{{ role_path }}/tasks/setup_well_known.yml"
when: run_setup
when: run_setup|bool
tags:
- setup-all
- setup-mxisd
Expand All @@ -28,6 +28,6 @@
- import_tasks: "{{ role_path }}/tasks/self_check_dns.yml"
delegate_to: 127.0.0.1
become: false
when: run_self_check
when: run_self_check|bool
tags:
- self-check
2 changes: 1 addition & 1 deletion roles/matrix-base/tasks/self_check_dns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- name: Determine domains that we require certificates for (mxisd)
set_fact:
dns_srv_record_checks: "{{ dns_srv_record_checks + [dns_srv_record_check_mxisd] }}"
when: "matrix_mxisd_enabled"
when: matrix_mxisd_enabled|bool

- name: Perform DNS SRV checks
include_tasks: "{{ role_path }}/tasks/self_check_dns_srv.yml"
Expand Down
4 changes: 2 additions & 2 deletions roles/matrix-base/tasks/setup_well_known.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
mode: 0644
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
when: matrix_well_known_matrix_server_enabled
when: matrix_well_known_matrix_server_enabled|bool

- name: Ensure Matrix /.well-known/matrix/server file deleted
file:
path: "{{ matrix_static_files_base_path }}/.well-known/matrix/server"
state: absent
when: "not matrix_well_known_matrix_server_enabled"
when: "not matrix_well_known_matrix_server_enabled|bool"
2 changes: 1 addition & 1 deletion roles/matrix-bridge-appservice-discord/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord'] }}"
when: matrix_appservice_discord_enabled
when: matrix_appservice_discord_enabled|bool
6 changes: 3 additions & 3 deletions roles/matrix-bridge-appservice-discord/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
- always

- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup and matrix_appservice_discord_enabled"
when: "run_setup|bool and matrix_appservice_discord_enabled|bool"
tags:
- setup-all
- setup-appservice-discord

- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup and matrix_appservice_discord_enabled"
when: "run_setup|bool and matrix_appservice_discord_enabled|bool"
tags:
- setup-all
- setup-appservice-discord

- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup and not matrix_appservice_discord_enabled"
when: "run_setup|bool and not matrix_appservice_discord_enabled|bool"
tags:
- setup-all
- setup-appservice-discord
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- name: Ensure Appservice Discord image is pulled
docker_image:
name: "{{ matrix_appservice_discord_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"

- name: Ensure Appservice Discord base directory exists
file:
Expand Down Expand Up @@ -90,4 +91,3 @@
{{ matrix_synapse_app_service_config_files|default([]) }}
+
{{ ["{{ matrix_synapse_app_service_config_file_appservice_discord }}"] | to_nice_json }}

2 changes: 1 addition & 1 deletion roles/matrix-bridge-appservice-irc/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc'] }}"
when: matrix_appservice_irc_enabled
when: matrix_appservice_irc_enabled|bool
6 changes: 3 additions & 3 deletions roles/matrix-bridge-appservice-irc/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
- always

- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup and matrix_appservice_irc_enabled"
when: "run_setup|bool and matrix_appservice_irc_enabled|bool"
tags:
- setup-all
- setup-appservice-irc

- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup and matrix_appservice_irc_enabled"
when: "run_setup|bool and matrix_appservice_irc_enabled|bool"
tags:
- setup-all
- setup-appservice-irc

- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup and not matrix_appservice_irc_enabled"
when: "run_setup|bool and not matrix_appservice_irc_enabled|bool"
tags:
- setup-all
- setup-appservice-irc
1 change: 1 addition & 0 deletions roles/matrix-bridge-appservice-irc/tasks/setup_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- name: Ensure Appservice IRC image is pulled
docker_image:
name: "{{ matrix_appservice_irc_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"

- name: Ensure Appservice IRC base directory exists
file:
Expand Down
2 changes: 1 addition & 1 deletion roles/matrix-bridge-mautrix-facebook/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook'] }}"
when: "matrix_mautrix_facebook_enabled"
when: matrix_mautrix_facebook_enabled|bool
6 changes: 3 additions & 3 deletions roles/matrix-bridge-mautrix-facebook/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
- always

- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup and matrix_mautrix_facebook_enabled"
when: "run_setup|bool and matrix_mautrix_facebook_enabled|bool"
tags:
- setup-all
- setup-mautrix-facebook

- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup and matrix_mautrix_facebook_enabled"
when: "run_setup|bool and matrix_mautrix_facebook_enabled|bool"
tags:
- setup-all
- setup-mautrix-facebook

- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup and not matrix_mautrix_facebook_enabled"
when: "run_setup|bool and not matrix_mautrix_facebook_enabled|bool"
tags:
- setup-all
- setup-mautrix-facebook
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- name: Ensure Mautrix Facebook image is pulled
docker_image:
name: "{{ matrix_mautrix_facebook_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"

- name: Ensure Mautrix Facebook base directory exists
file:
Expand Down
2 changes: 1 addition & 1 deletion roles/matrix-bridge-mautrix-telegram/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram'] }}"
when: "matrix_mautrix_telegram_enabled"
when: matrix_mautrix_telegram_enabled|bool
6 changes: 3 additions & 3 deletions roles/matrix-bridge-mautrix-telegram/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
- always

- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup and matrix_mautrix_telegram_enabled"
when: "run_setup|bool and matrix_mautrix_telegram_enabled|bool"
tags:
- setup-all
- setup-mautrix-telegram

- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup and matrix_mautrix_telegram_enabled"
when: "run_setup|bool and matrix_mautrix_telegram_enabled|bool"
tags:
- setup-all
- setup-mautrix-telegram

- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup and not matrix_mautrix_telegram_enabled"
when: "run_setup|bool and not matrix_mautrix_telegram_enabled|bool"
tags:
- setup-all
- setup-mautrix-telegram
3 changes: 2 additions & 1 deletion roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- name: Ensure Mautrix Telegram image is pulled
docker_image:
name: "{{ matrix_mautrix_telegram_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"

- name: Ensure Mautrix Telegram base directory exists
file:
Expand Down Expand Up @@ -98,7 +99,7 @@
but it's pointless since the matrix-nginx-proxy role had already executed.
To fix this, please change the order of roles in your plabook,
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-telegram role.
when: "matrix_nginx_proxy_role_executed"
when: matrix_nginx_proxy_role_executed|bool

- name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy
set_fact:
Expand Down
2 changes: 1 addition & 1 deletion roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-whatsapp'] }}"
when: "matrix_mautrix_whatsapp_enabled"
when: matrix_mautrix_whatsapp_enabled|bool
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- name: Ensure Mautrix Whatsapp image is pulled
docker_image:
name: "{{ matrix_mautrix_whatsapp_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"

- name: Ensure Mautrix Whatsapp base directory exists
file:
Expand Down
4 changes: 2 additions & 2 deletions roles/matrix-common-after/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- import_tasks: "{{ role_path }}/tasks/start.yml"
when: run_start
when: run_start|bool
tags:
- start

- import_tasks: "{{ role_path }}/tasks/stop.yml"
when: run_stop
when: run_stop|bool
tags:
- stop
2 changes: 1 addition & 1 deletion roles/matrix-corporal/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-corporal'] }}"
when: "matrix_corporal_enabled"
when: matrix_corporal_enabled|bool
8 changes: 4 additions & 4 deletions roles/matrix-corporal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
- always

- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup and matrix_corporal_enabled"
when: "run_setup|bool and matrix_corporal_enabled|bool"
tags:
- setup-all
- setup-corporal

- import_tasks: "{{ role_path }}/tasks/setup_corporal.yml"
when: run_setup
when: run_setup|bool
tags:
- setup-all
- setup-corporal

- import_tasks: "{{ role_path }}/tasks/self_check_corporal.yml"
delegate_to: 127.0.0.1
become: false
when: "run_self_check and matrix_corporal_enabled"
when: "run_self_check|bool and matrix_corporal_enabled|bool"
tags:
- self-check
- self-check
23 changes: 12 additions & 11 deletions roles/matrix-corporal/tasks/setup_corporal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,33 @@
- "{{ matrix_corporal_config_dir_path }}"
- "{{ matrix_corporal_cache_dir_path }}"
- "{{ matrix_corporal_var_dir_path }}"
when: "matrix_corporal_enabled"
when: matrix_corporal_enabled|bool

- name: Ensure Matrix Corporal Docker image is pulled
docker_image:
name: "{{ matrix_corporal_docker_image }}"
when: "matrix_corporal_enabled"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
when: matrix_corporal_enabled|bool

- name: Ensure Matrix Corporal config installed
template:
src: "{{ role_path }}/templates/config.json.j2"
dest: "{{ matrix_corporal_config_dir_path }}/config.json"
mode: 0644
when: "matrix_corporal_enabled"
when: matrix_corporal_enabled|bool

- name: Ensure matrix-corporal.service installed
template:
src: "{{ role_path }}/templates/systemd/matrix-corporal.service.j2"
dest: "/etc/systemd/system/matrix-corporal.service"
mode: 0644
register: matrix_corporal_systemd_service_result
when: "matrix_corporal_enabled"
when: matrix_corporal_enabled|bool

- name: Ensure systemd reloaded after matrix-corporal.service installation
service:
daemon_reload: yes
when: "matrix_corporal_enabled and matrix_corporal_systemd_service_result.changed"
when: "matrix_corporal_enabled|bool and matrix_corporal_systemd_service_result.changed"


#
Expand All @@ -51,26 +52,26 @@
stat:
path: "/etc/systemd/system/matrix-corporal.service"
register: matrix_corporal_service_stat
when: "not matrix_corporal_enabled"
when: "not matrix_corporal_enabled|bool"

- name: Ensure matrix-corporal is stopped
service:
name: matrix-corporal
state: stopped
daemon_reload: yes
register: stopping_result
when: "not matrix_corporal_enabled and matrix_corporal_service_stat.stat.exists"
when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists"

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

- name: Ensure systemd reloaded after matrix-corporal.service removal
service:
daemon_reload: yes
when: "not matrix_corporal_enabled and matrix_corporal_service_stat.stat.exists"
when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists"

- name: Ensure matrix-corporal files don't exist
file:
Expand All @@ -79,10 +80,10 @@
with_items:
- /etc/systemd/system/matrix-corporal.service
- "{{ matrix_corporal_config_dir_path }}/config.json"
when: "not matrix_corporal_enabled"
when: "not matrix_corporal_enabled|bool"

- name: Ensure Matrix Corporal Docker image doesn't exist
docker_image:
name: "{{ matrix_corporal_docker_image }}"
state: absent
when: "not matrix_corporal_enabled"
when: "not matrix_corporal_enabled|bool"
2 changes: 1 addition & 1 deletion roles/matrix-corporal/tasks/validate_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
- name: Fail if HTTP API enabled, but no token set
fail:
msg: "The Matrix Corporal HTTP API is enabled (`matrix_corporal_http_api_enabled`), but no auth token has been set in `matrix_corporal_http_api_auth_token`"
when: "matrix_corporal_http_api_enabled and matrix_corporal_http_api_auth_token == ''"
when: "matrix_corporal_http_api_enabled|bool and matrix_corporal_http_api_auth_token == ''"
2 changes: 1 addition & 1 deletion roles/matrix-coturn/tasks/init.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-coturn'] }}"
when: "matrix_coturn_enabled"
when: matrix_coturn_enabled|bool
6 changes: 3 additions & 3 deletions roles/matrix-coturn/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
- always

- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup and matrix_coturn_enabled"
when: "run_setup|bool and matrix_coturn_enabled|bool"
tags:
- setup-all
- setup-coturn

- import_tasks: "{{ role_path }}/tasks/setup_coturn.yml"
when: run_setup
when: run_setup|bool
tags:
- setup-all
- setup-coturn
- setup-coturn
Loading