Skip to content

Commit df03fd9

Browse files
committed
Remove handlers
1 parent bf9a674 commit df03fd9

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

handlers/systemctl.yml

-3
This file was deleted.

playbook.yml

-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,3 @@
5151
- mobileforces-masterserver
5252
- mobileforces
5353
- mobileforces-fastdl
54-
55-
handlers:
56-
- ansible.builtin.import_tasks: handlers/systemctl.yml

tasks/create_apache_webserver.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
src: templates/webserver/vhosts/mobileforces.j2
1717
dest: /etc/apache2/sites-available/mobileforces.conf
1818
mode: "644"
19+
register: apache_vhost
1920

2021
- name: Copy website files
2122
ansible.builtin.copy:
@@ -56,6 +57,12 @@
5657
cmd: "certbot --apache -n --email {{ ServerAdmin }} --agree-tos --no-redirect -d {{ ServerName }}"
5758
creates: /etc/apache2/sites-enabled/mobileforces-le-ssl.conf
5859

60+
- name: Reload apache
61+
ansible.builtin.service:
62+
name: apache2
63+
state: reloaded
64+
when: apache_vhost.changed
65+
5966
- name: PHP tasks (skipped in check mode)
6067
block:
6168
- name: Get PHP version
@@ -70,14 +77,13 @@
7077
loop:
7178
- [= www-data, "= {{ server_user }}"]
7279
- ["/run/php/php{{ php.stdout }}-fpm.sock", /run/php/www.sock]
80+
register: fpm_config
7381

74-
- name: Reload the apache and PHP fpm services
82+
- name: Reload the PHP fpm service
7583
ansible.builtin.service:
76-
name: "{{ item }}"
84+
name: "php{{ php.stdout }}-fpm"
7785
state: reloaded
78-
loop:
79-
- apache2
80-
- "php{{ php.stdout }}-fpm"
86+
when: fpm_config.changed
8187
when: not ansible_check_mode
8288

8389
- name: Allow the website to restart game services

tasks/create_mf_gameserver.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
- [mobileforces.j2, mobileforces.service]
6464
- [mobileforces-fastdl.j2, mobileforces-fastdl.service]
6565
- [mobileforces-package.j2, mobileforces-package.service]
66-
notify: Reload systemctl
66+
register: service_files
67+
68+
- name: Reload systemctl
69+
ansible.builtin.command: systemctl daemon-reload
70+
when: service_files.changed
6771

6872
- name: Create cron job for fastdl
6973
ansible.builtin.cron:

tasks/create_mf_masterserver.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@
3131
src: templates/masterserver/services/mobileforces-masterserver.j2
3232
dest: /etc/systemd/system/mobileforces-masterserver.service
3333
mode: "644"
34-
notify: Reload systemctl
34+
register: service_files
35+
36+
- name: Reload systemctl
37+
ansible.builtin.command: systemctl daemon-reload
38+
when: service_files.changed

0 commit comments

Comments
 (0)