diff --git a/elk_metrics_7x/roles/elastic_apm_server/handlers/main.yml b/elk_metrics_7x/roles/elastic_apm_server/handlers/main.yml index b61ae69b..53f8dc07 100644 --- a/elk_metrics_7x/roles/elastic_apm_server/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_apm_server/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart apm-server (systemd) +- name: Enable and restart apm-server systemd: name: "apm-server" enabled: true state: restarted daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart apm server - -- name: Enable and restart apm-server (upstart) - service: - name: "apm-server" - state: restarted - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart apm server diff --git a/elk_metrics_7x/roles/elastic_apm_server/tasks/main.yml b/elk_metrics_7x/roles/elastic_apm_server/tasks/main.yml index 835c5c8d..199d4a16 100644 --- a/elk_metrics_7x/roles/elastic_apm_server/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_apm_server/tasks/main.yml @@ -35,7 +35,7 @@ retries: 3 delay: 2 notify: - - Enable and restart apm server + - Enable and restart apm-server tags: - package_install @@ -46,28 +46,24 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "/etc/systemd/system/apm-server.service.d/{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "apm-server-overrides.conf" notify: - - Enable and restart apm server + - Enable and restart apm-server - name: Drop apm-server conf file template: src: "apm-server.yml.j2" dest: "/etc/apm-server/apm-server.yml" notify: - - Enable and restart apm server + - Enable and restart apm-server - name: Run the beat setup role include_role: diff --git a/elk_metrics_7x/roles/elastic_auditbeat/handlers/main.yml b/elk_metrics_7x/roles/elastic_auditbeat/handlers/main.yml index bf751755..f3a6017e 100644 --- a/elk_metrics_7x/roles/elastic_auditbeat/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_auditbeat/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart auditbeat (systemd) +- name: Enable and restart auditbeat systemd: name: "auditbeat" enabled: true state: "{{ auditbeat_service_state }}" daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart auditbeat - -- name: Enable and restart auditbeat (upstart) - service: - name: "auditbeat" - state: "{{ auditbeat_service_state }}" - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart auditbeat diff --git a/elk_metrics_7x/roles/elastic_auditbeat/tasks/main.yml b/elk_metrics_7x/roles/elastic_auditbeat/tasks/main.yml index 6805b7aa..8693435d 100644 --- a/elk_metrics_7x/roles/elastic_auditbeat/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_auditbeat/tasks/main.yml @@ -54,16 +54,12 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "/etc/systemd/system/auditbeat.service.d/{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "auditbeat-overrides.conf" @@ -92,20 +88,10 @@ - name: Force beat handlers meta: flush_handlers -- name: set auditbeat service state (upstart) - service: - name: "auditbeat" - state: "{{ auditbeat_service_state }}" - enabled: "{{ auditbeat_service_state in ['running', 'started', 'restarted'] }}" - when: - - ansible_service_mgr == 'upstart' - - auditbeat_service_state in ['started', 'stopped'] - -- name: set auditbeat service state (systemd) +- name: set auditbeat service state systemd: name: "auditbeat" state: "{{ auditbeat_service_state }}" enabled: "{{ auditbeat_service_state in ['running', 'started', 'restarted'] }}" when: - - ansible_service_mgr == 'systemd' - auditbeat_service_state in ['started', 'stopped'] diff --git a/elk_metrics_7x/roles/elastic_filebeat/handlers/main.yml b/elk_metrics_7x/roles/elastic_filebeat/handlers/main.yml index 76c5a128..cb68d7ae 100644 --- a/elk_metrics_7x/roles/elastic_filebeat/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_filebeat/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart filebeat (systemd) +- name: Enable and restart filebeat systemd: name: "filebeat" enabled: true state: "{{ filebeat_service_state }}" daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart filebeat - -- name: Enable and restart filebeat (upstart) - service: - name: "filebeat" - state: "{{ filebeat_service_state }}" - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart filebeat diff --git a/elk_metrics_7x/roles/elastic_filebeat/tasks/main.yml b/elk_metrics_7x/roles/elastic_filebeat/tasks/main.yml index 81868110..9ca63ce1 100644 --- a/elk_metrics_7x/roles/elastic_filebeat/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_filebeat/tasks/main.yml @@ -46,16 +46,12 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "/etc/systemd/system/filebeat.service.d/{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "filebeat-overrides.conf" @@ -95,20 +91,10 @@ - name: Force beat handlers meta: flush_handlers -- name: set filebeat service state (upstart) - service: - name: "filebeat" - state: "{{ filebeat_service_state }}" - enabled: "{{ filebeat_service_state in ['running', 'started', 'restarted'] }}" - when: - - ansible_service_mgr == 'upstart' - - filebeat_service_state in ['started', 'stopped'] - -- name: set filebeat service state (systemd) +- name: set filebeat service state systemd: name: "filebeat" state: "{{ filebeat_service_state }}" enabled: "{{ filebeat_service_state in ['running', 'started', 'restarted'] }}" when: - - ansible_service_mgr == 'systemd' - filebeat_service_state in ['started', 'stopped'] diff --git a/elk_metrics_7x/roles/elastic_heartbeat/handlers/main.yml b/elk_metrics_7x/roles/elastic_heartbeat/handlers/main.yml index 6eee1cc2..5f91e60b 100644 --- a/elk_metrics_7x/roles/elastic_heartbeat/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_heartbeat/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart heartbeat (systemd) +- name: Enable and restart heartbeat systemd: name: "heartbeat-elastic" enabled: true state: "{{ heartbeat_service_state }}" daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart heartbeat - -- name: Enable and restart heartbeat (upstart) - service: - name: "heartbeat-elastic" - state: "{{ heartbeat_service_state }}" - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart heartbeat diff --git a/elk_metrics_7x/roles/elastic_heartbeat/tasks/main.yml b/elk_metrics_7x/roles/elastic_heartbeat/tasks/main.yml index 46ce931d..7a5e068b 100644 --- a/elk_metrics_7x/roles/elastic_heartbeat/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_heartbeat/tasks/main.yml @@ -46,16 +46,12 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "/etc/systemd/system/heartbeat.service.d/heartbeat-overrides.conf" @@ -67,8 +63,6 @@ src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "heartbeat.yml.j2" dest: "/etc/heartbeat/heartbeat.yml" @@ -90,20 +84,10 @@ - name: Force beat handlers meta: flush_handlers -- name: set heartbeat service state (upstart) - service: - name: "heartbeat-elastic" - state: "{{ heartbeat_service_state }}" - enabled: "{{ heartbeat_service_state in ['running', 'started', 'restarted'] }}" - when: - - ansible_service_mgr == 'upstart' - - heartbeat_service_state in ['started', 'stopped'] - - name: set heartbeat service state (systemd) systemd: name: "heartbeat-elastic" state: "{{ heartbeat_service_state }}" enabled: "{{ heartbeat_service_state in ['running', 'started', 'restarted'] }}" when: - - ansible_service_mgr == 'systemd' - heartbeat_service_state in ['started', 'stopped'] diff --git a/elk_metrics_7x/roles/elastic_journalbeat/tasks/main.yml b/elk_metrics_7x/roles/elastic_journalbeat/tasks/main.yml index b87da6b3..7aaa06a0 100644 --- a/elk_metrics_7x/roles/elastic_journalbeat/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_journalbeat/tasks/main.yml @@ -102,20 +102,10 @@ - name: Force beat handlers meta: flush_handlers -- name: set journalbeat service state (upstart) - service: - name: "journalbeat" - state: "{{ journalbeat_service_state }}" - enabled: "{{ journalbeat_service_state in ['running', 'started', 'restarted'] }}" - when: - - ansible_service_mgr == 'upstart' - - journalbeat_service_state in ['started', 'stopped'] - - name: set journalbeat service state (systemd) systemd: name: "journalbeat" state: "{{ journalbeat_service_state }}" enabled: "{{ journalbeat_service_state in ['running', 'started', 'restarted'] }}" when: - - ansible_service_mgr == 'systemd' - journalbeat_service_state in ['started', 'stopped'] diff --git a/elk_metrics_7x/roles/elastic_kibana/handlers/main.yml b/elk_metrics_7x/roles/elastic_kibana/handlers/main.yml index 619855db..dacb25e2 100644 --- a/elk_metrics_7x/roles/elastic_kibana/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_kibana/handlers/main.yml @@ -13,27 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart services (systemd) +- name: Enable and restart kibana services systemd: name: "{{ item }}" enabled: true state: restarted daemon_reload: true - when: - - ansible_service_mgr == 'systemd' with_items: - nginx - kibana - listen: Enable and restart services - -- name: Enable and restart services (upstart) - service: - name: "{{ item }}" - state: restarted - enabled: yes - when: - - ansible_service_mgr == 'upstart' - with_items: - - nginx - - kibana - listen: Enable and restart services diff --git a/elk_metrics_7x/roles/elastic_kibana/tasks/main.yml b/elk_metrics_7x/roles/elastic_kibana/tasks/main.yml index c94a77d8..dc5b0dda 100644 --- a/elk_metrics_7x/roles/elastic_kibana/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_kibana/tasks/main.yml @@ -35,7 +35,7 @@ retries: 3 delay: 2 notify: - - Enable and restart services + - Enable and restart kibana services tags: - package_install @@ -54,7 +54,7 @@ src: "nginx_default.j2" dest: "{{ kibana_nginx_vhost_path }}/default" notify: - - Enable and restart services + - Enable and restart kibana services - name: Create kibana systemd service config dir file: @@ -63,21 +63,17 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "/etc/systemd/system/kibana.service.d/kibana-overrides.conf" notify: - - Enable and restart services + - Enable and restart kibana services - name: Drop kibana conf file template: @@ -85,4 +81,4 @@ dest: "/etc/kibana/kibana.yml" mode: "0666" notify: - - Enable and restart services + - Enable and restart kibana services diff --git a/elk_metrics_7x/roles/elastic_logstash/handlers/main.yml b/elk_metrics_7x/roles/elastic_logstash/handlers/main.yml index 341581a0..cf0372ad 100644 --- a/elk_metrics_7x/roles/elastic_logstash/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_logstash/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart logstash (systemd) +- name: Enable and restart logstash systemd: name: "logstash" enabled: true state: "restarted" daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart logstash - -- name: Enable and restart logstash (upstart) - service: - name: "logstash" - state: "restarted" - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart logstash diff --git a/elk_metrics_7x/roles/elastic_logstash/tasks/main.yml b/elk_metrics_7x/roles/elastic_logstash/tasks/main.yml index 2e733149..f42d9359 100644 --- a/elk_metrics_7x/roles/elastic_logstash/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_logstash/tasks/main.yml @@ -65,16 +65,12 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "/etc/systemd/system/logstash.service.d/logstash-overrides.conf" @@ -137,15 +133,11 @@ command: id -u logstash register: logstash_uid changed_when: false - when: - - ansible_service_mgr == 'systemd' - name: Get logstash GID command: id -g logstash register: logstash_gid changed_when: false - when: - - ansible_service_mgr == 'systemd' - name: Read logstash queue path command: "readlink -f /var/lib/logstash/queue" @@ -166,18 +158,6 @@ - logstash.service state: 'started' enabled: true - when: - - ansible_service_mgr == 'systemd' - - - name: Apply fstab options for memory queues - mount: - path: "{{ logstash_queue_path.stdout.strip() }}" - src: tmpfs - fstype: tmpfs - opts: size={{ (elastic_memory_lower_limit | int) // 2 }}m - state: mounted - when: - - ansible_service_mgr != 'systemd' when: - logstash_queue_type == 'memory' diff --git a/elk_metrics_7x/roles/elastic_metricbeat/handlers/main.yml b/elk_metrics_7x/roles/elastic_metricbeat/handlers/main.yml index 08425049..c9cbff8b 100644 --- a/elk_metrics_7x/roles/elastic_metricbeat/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_metricbeat/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart metricbeat (systemd) +- name: Enable and restart metricbeat systemd: name: "metricbeat" enabled: true state: "{{ metricbeat_service_state }}" daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart metricbeat - -- name: Enable and restart metricbeat (upstart) - service: - name: "metricbeat" - state: "{{ metricbeat_service_state }}" - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart metricbeat diff --git a/elk_metrics_7x/roles/elastic_metricbeat/tasks/main.yml b/elk_metrics_7x/roles/elastic_metricbeat/tasks/main.yml index 2652f13a..8fcb6aff 100644 --- a/elk_metrics_7x/roles/elastic_metricbeat/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_metricbeat/tasks/main.yml @@ -268,16 +268,12 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "/etc/systemd/system/metricbeat.service.d/metricbeat-overrides.conf" @@ -310,20 +306,10 @@ - name: Force beat handlers meta: flush_handlers -- name: set metricbeat service state (upstart) - service: - name: "metricbeat" - state: "{{ metricbeat_service_state }}" - enabled: "{{ metricbeat_service_state in ['running', 'started', 'restarted'] }}" - when: - - ansible_service_mgr == 'upstart' - - metricbeat_service_state in ['started', 'stopped'] - - name: set metricbeat service state (systemd) systemd: name: "metricbeat" state: "{{ metricbeat_service_state }}" enabled: "{{ metricbeat_service_state in ['running', 'started', 'restarted'] }}" when: - - ansible_service_mgr == 'systemd' - metricbeat_service_state in ['started', 'stopped'] diff --git a/elk_metrics_7x/roles/elastic_packetbeat/handlers/main.yml b/elk_metrics_7x/roles/elastic_packetbeat/handlers/main.yml index 1c4bbed8..238e447b 100644 --- a/elk_metrics_7x/roles/elastic_packetbeat/handlers/main.yml +++ b/elk_metrics_7x/roles/elastic_packetbeat/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart packetbeat (systemd) +- name: Enable and restart packetbeat systemd: name: "packetbeat" enabled: true state: "{{ packetbeat_service_state }}" daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart packetbeat - -- name: Enable and restart packetbeat (upstart) - service: - name: "packetbeat" - state: "{{ packetbeat_service_state }}" - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart packetbeat diff --git a/elk_metrics_7x/roles/elastic_packetbeat/tasks/main.yml b/elk_metrics_7x/roles/elastic_packetbeat/tasks/main.yml index 0be9d95d..3dff6bc3 100644 --- a/elk_metrics_7x/roles/elastic_packetbeat/tasks/main.yml +++ b/elk_metrics_7x/roles/elastic_packetbeat/tasks/main.yml @@ -46,16 +46,12 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "0644" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.general-overrides.conf.j2" dest: "/etc/systemd/system/packetbeat.service.d/packetbeat-overrides.conf" @@ -88,20 +84,10 @@ - name: Force beat handlers meta: flush_handlers -- name: set packetbeat service state (upstart) - service: - name: "packetbeat" - state: "{{ packetbeat_service_state }}" - enabled: "{{ packetbeat_service_state in ['running', 'started', 'restarted'] }}" - when: - - ansible_service_mgr == 'upstart' - - packetbeat_service_state in ['started', 'stopped'] - -- name: set packetbeat service state (systemd) +- name: set packetbeat service state systemd: name: "packetbeat" state: "{{ packetbeat_service_state }}" enabled: "{{ packetbeat_service_state in ['running', 'started', 'restarted'] }}" when: - - ansible_service_mgr == 'systemd' - packetbeat_service_state in ['started', 'stopped'] diff --git a/elk_metrics_7x/roles/elasticsearch/handlers/main.yml b/elk_metrics_7x/roles/elasticsearch/handlers/main.yml index 3dacb437..1f866845 100644 --- a/elk_metrics_7x/roles/elasticsearch/handlers/main.yml +++ b/elk_metrics_7x/roles/elasticsearch/handlers/main.yml @@ -13,21 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Enable and restart elasticsearch (systemd) +- name: Enable and restart elasticsearch systemd: name: "elasticsearch" enabled: true state: restarted daemon_reload: true - when: - - ansible_service_mgr == 'systemd' - listen: Enable and restart elastic - -- name: Enable and restart elasticsearch (upstart) - service: - name: "elasticsearch" - state: restarted - enabled: yes - when: - - ansible_service_mgr == 'upstart' - listen: Enable and restart elastic diff --git a/elk_metrics_7x/roles/elasticsearch/tasks/main.yml b/elk_metrics_7x/roles/elasticsearch/tasks/main.yml index 1aa86114..715aa41c 100644 --- a/elk_metrics_7x/roles/elasticsearch/tasks/main.yml +++ b/elk_metrics_7x/roles/elasticsearch/tasks/main.yml @@ -40,7 +40,7 @@ retries: 3 delay: 2 notify: - - Enable and restart elastic + - Enable and restart elasticsearch tags: - package_install @@ -51,20 +51,16 @@ group: "root" owner: "root" mode: "0755" - when: - - ansible_service_mgr == 'systemd' - name: Apply systemd options template: src: "{{ item.src }}" dest: "{{ item.dest }}" - when: - - ansible_service_mgr == 'systemd' with_items: - src: "systemd.elasticsearch-overrides.conf.j2" dest: "/etc/systemd/system/elasticsearch.service.d/elasticsearch-overrides.conf" notify: - - Enable and restart elastic + - Enable and restart elasticsearch tags: - config @@ -95,7 +91,7 @@ - src: "jvm.options.j2" dest: "/etc/elasticsearch/jvm.options" notify: - - Enable and restart elastic + - Enable and restart elasticsearch - name: Drop elasticsearch conf file template: @@ -107,7 +103,7 @@ - src: "es-log4j2.properties.j2" dest: "/etc/elasticsearch/log4j2.properties" notify: - - Enable and restart elastic + - Enable and restart elasticsearch tags: - config