Skip to content

Commit e27e14c

Browse files
authored
reconfigure systemd if splunk was upgraded (splunk#151)
1 parent 69c67e3 commit e27e14c

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

roles/splunk/tasks/configure_splunk_boot.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- name: Block for checking boot-start when an existing Splunk installation has been found
44
when:
55
- splunkd_found.stat.exists
6-
- configure_boot_start is defined
6+
- configure_boot_start is defined or splunk_upgraded is defined
77
block:
88
- name: Check if Splunk needs to be stopped if boot-start isn't configured as Ansible expects (or boot-start is not configured at all)
99
include_tasks: check_splunk_status.yml
@@ -25,10 +25,10 @@
2525
become: true
2626
ignore_errors: yes
2727

28-
- name: Disable boot-start if current configuration does not matched expected configuration
28+
- name: Disable boot-start if it needs to be to reconfigured
2929
command: "{{ splunk_home }}/bin/splunk disable boot-start"
3030
become: true
31-
when: current_start_method is defined
31+
when: current_start_method is defined or splunk_upgraded is defined
3232

3333
- name: Ensure init.d file is really gone
3434
file:
@@ -40,28 +40,28 @@
4040
- reload systemctl daemon
4141

4242
- name: Enable splunk boot-start via initd
43-
command: "{{ splunk_home }}/bin/splunk enable boot-start -user {{ splunk_nix_user }} -group {{ splunk_nix_group }} -systemd-managed 0 --answer-yes --auto-ports --no-prompt --accept-license"
44-
become: true
45-
when:
46-
- desired_start_method == "initd"
47-
- configure_boot_start is defined
48-
notify:
49-
- set ulimits in init.d
50-
- reload systemctl daemon
51-
- start splunk
43+
when: configure_boot_start is defined or splunk_upgraded is defined
44+
block:
45+
- name: Enable splunk boot-start via initd
46+
command: "{{ splunk_home }}/bin/splunk enable boot-start -user {{ splunk_nix_user }} -group {{ splunk_nix_group }} -systemd-managed 0 --answer-yes --auto-ports --no-prompt --accept-license"
47+
become: true
48+
when:
49+
- desired_start_method == "initd"
50+
notify:
51+
- set ulimits in init.d
52+
- reload systemctl daemon
53+
- start splunk
5254

53-
- name: Enable splunk boot-start via systemd
54-
command: "{{ splunk_home }}/bin/splunk enable boot-start -user {{ splunk_nix_user }} -group {{ splunk_nix_group }} -systemd-managed 1 -systemd-unit-file-name {{ systemd_unit }} -create-polkit-rules {{ splunk_create_polkit }} --answer-yes --auto-ports --no-prompt --accept-license"
55-
become: true
56-
when:
57-
- desired_start_method == "systemd"
58-
- configure_boot_start is defined
59-
notify:
60-
- reload systemctl daemon
61-
- start splunk
55+
- name: Enable splunk boot-start via systemd
56+
command: "{{ splunk_home }}/bin/splunk enable boot-start -user {{ splunk_nix_user }} -group {{ splunk_nix_group }} -systemd-managed 1 -systemd-unit-file-name {{ systemd_unit }} -create-polkit-rules {{ splunk_create_polkit }} --answer-yes --auto-ports --no-prompt --accept-license"
57+
become: true
58+
when:
59+
- desired_start_method == "systemd"
60+
notify:
61+
- reload systemctl daemon
62+
- start splunk
6263

63-
- name: Update systemd file
64-
include_tasks: configure_systemd.yml
65-
when:
66-
- desired_start_method == "systemd"
67-
- configure_boot_start is defined
64+
- name: Update systemd file
65+
include_tasks: configure_systemd.yml
66+
when:
67+
- desired_start_method == "systemd"

roles/splunk/tasks/upgrade_splunk.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
- name: Include accept license task
2424
include_tasks: splunk_license_accept.yml
2525

26+
- name: set splunk_uprgaded variable
27+
set_fact:
28+
splunk_upgraded: True
29+
2630
- name: Enable boot start
2731
include_tasks: configure_splunk_boot.yml
2832

0 commit comments

Comments
 (0)