|
3 | 3 | - name: Block for checking boot-start when an existing Splunk installation has been found |
4 | 4 | when: |
5 | 5 | - splunkd_found.stat.exists |
6 | | - - configure_boot_start is defined |
| 6 | + - configure_boot_start is defined or splunk_upgraded is defined |
7 | 7 | block: |
8 | 8 | - 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) |
9 | 9 | include_tasks: check_splunk_status.yml |
|
25 | 25 | become: true |
26 | 26 | ignore_errors: yes |
27 | 27 |
|
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 |
29 | 29 | command: "{{ splunk_home }}/bin/splunk disable boot-start" |
30 | 30 | become: true |
31 | | - when: current_start_method is defined |
| 31 | + when: current_start_method is defined or splunk_upgraded is defined |
32 | 32 |
|
33 | 33 | - name: Ensure init.d file is really gone |
34 | 34 | file: |
|
40 | 40 | - reload systemctl daemon |
41 | 41 |
|
42 | 42 | - 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 |
52 | 54 |
|
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 |
62 | 63 |
|
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" |
0 commit comments