Merge "It's always systemd. Remove references to upstart"

This commit is contained in:
Zuul 2021-03-15 09:33:38 +00:00 committed by Gerrit Code Review
commit 518159ef40
19 changed files with 23 additions and 248 deletions

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart apm-server (systemd) - name: Enable and restart apm-server
systemd: systemd:
name: "apm-server" name: "apm-server"
enabled: true enabled: true
state: restarted state: restarted
daemon_reload: true 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

View File

@ -35,7 +35,7 @@
retries: 3 retries: 3
delay: 2 delay: 2
notify: notify:
- Enable and restart apm server - Enable and restart apm-server
tags: tags:
- package_install - package_install
@ -46,28 +46,24 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "/etc/systemd/system/apm-server.service.d/{{ item.dest }}" dest: "/etc/systemd/system/apm-server.service.d/{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "apm-server-overrides.conf" dest: "apm-server-overrides.conf"
notify: notify:
- Enable and restart apm server - Enable and restart apm-server
- name: Drop apm-server conf file - name: Drop apm-server conf file
template: template:
src: "apm-server.yml.j2" src: "apm-server.yml.j2"
dest: "/etc/apm-server/apm-server.yml" dest: "/etc/apm-server/apm-server.yml"
notify: notify:
- Enable and restart apm server - Enable and restart apm-server
- name: Run the beat setup role - name: Run the beat setup role
include_role: include_role:

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart auditbeat (systemd) - name: Enable and restart auditbeat
systemd: systemd:
name: "auditbeat" name: "auditbeat"
enabled: true enabled: true
state: "{{ auditbeat_service_state }}" state: "{{ auditbeat_service_state }}"
daemon_reload: true 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

View File

@ -54,16 +54,12 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "/etc/systemd/system/auditbeat.service.d/{{ item.dest }}" dest: "/etc/systemd/system/auditbeat.service.d/{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "auditbeat-overrides.conf" dest: "auditbeat-overrides.conf"
@ -92,20 +88,10 @@
- name: Force beat handlers - name: Force beat handlers
meta: flush_handlers meta: flush_handlers
- name: set auditbeat service state (upstart) - name: set auditbeat service state
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)
systemd: systemd:
name: "auditbeat" name: "auditbeat"
state: "{{ auditbeat_service_state }}" state: "{{ auditbeat_service_state }}"
enabled: "{{ auditbeat_service_state in ['running', 'started', 'restarted'] }}" enabled: "{{ auditbeat_service_state in ['running', 'started', 'restarted'] }}"
when: when:
- ansible_service_mgr == 'systemd'
- auditbeat_service_state in ['started', 'stopped'] - auditbeat_service_state in ['started', 'stopped']

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart filebeat (systemd) - name: Enable and restart filebeat
systemd: systemd:
name: "filebeat" name: "filebeat"
enabled: true enabled: true
state: "{{ filebeat_service_state }}" state: "{{ filebeat_service_state }}"
daemon_reload: true 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

View File

@ -46,16 +46,12 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "/etc/systemd/system/filebeat.service.d/{{ item.dest }}" dest: "/etc/systemd/system/filebeat.service.d/{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "filebeat-overrides.conf" dest: "filebeat-overrides.conf"
@ -95,20 +91,10 @@
- name: Force beat handlers - name: Force beat handlers
meta: flush_handlers meta: flush_handlers
- name: set filebeat service state (upstart) - name: set filebeat service state
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)
systemd: systemd:
name: "filebeat" name: "filebeat"
state: "{{ filebeat_service_state }}" state: "{{ filebeat_service_state }}"
enabled: "{{ filebeat_service_state in ['running', 'started', 'restarted'] }}" enabled: "{{ filebeat_service_state in ['running', 'started', 'restarted'] }}"
when: when:
- ansible_service_mgr == 'systemd'
- filebeat_service_state in ['started', 'stopped'] - filebeat_service_state in ['started', 'stopped']

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart heartbeat (systemd) - name: Enable and restart heartbeat
systemd: systemd:
name: "heartbeat-elastic" name: "heartbeat-elastic"
enabled: true enabled: true
state: "{{ heartbeat_service_state }}" state: "{{ heartbeat_service_state }}"
daemon_reload: true 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

View File

@ -46,16 +46,12 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "/etc/systemd/system/heartbeat.service.d/heartbeat-overrides.conf" dest: "/etc/systemd/system/heartbeat.service.d/heartbeat-overrides.conf"
@ -67,8 +63,6 @@
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "heartbeat.yml.j2" - src: "heartbeat.yml.j2"
dest: "/etc/heartbeat/heartbeat.yml" dest: "/etc/heartbeat/heartbeat.yml"
@ -90,20 +84,10 @@
- name: Force beat handlers - name: Force beat handlers
meta: flush_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) - name: set heartbeat service state (systemd)
systemd: systemd:
name: "heartbeat-elastic" name: "heartbeat-elastic"
state: "{{ heartbeat_service_state }}" state: "{{ heartbeat_service_state }}"
enabled: "{{ heartbeat_service_state in ['running', 'started', 'restarted'] }}" enabled: "{{ heartbeat_service_state in ['running', 'started', 'restarted'] }}"
when: when:
- ansible_service_mgr == 'systemd'
- heartbeat_service_state in ['started', 'stopped'] - heartbeat_service_state in ['started', 'stopped']

View File

@ -102,20 +102,10 @@
- name: Force beat handlers - name: Force beat handlers
meta: flush_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) - name: set journalbeat service state (systemd)
systemd: systemd:
name: "journalbeat" name: "journalbeat"
state: "{{ journalbeat_service_state }}" state: "{{ journalbeat_service_state }}"
enabled: "{{ journalbeat_service_state in ['running', 'started', 'restarted'] }}" enabled: "{{ journalbeat_service_state in ['running', 'started', 'restarted'] }}"
when: when:
- ansible_service_mgr == 'systemd'
- journalbeat_service_state in ['started', 'stopped'] - journalbeat_service_state in ['started', 'stopped']

View File

@ -13,27 +13,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart services (systemd) - name: Enable and restart kibana services
systemd: systemd:
name: "{{ item }}" name: "{{ item }}"
enabled: true enabled: true
state: restarted state: restarted
daemon_reload: true daemon_reload: true
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- nginx - nginx
- kibana - 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

View File

@ -35,7 +35,7 @@
retries: 3 retries: 3
delay: 2 delay: 2
notify: notify:
- Enable and restart services - Enable and restart kibana services
tags: tags:
- package_install - package_install
@ -54,7 +54,7 @@
src: "nginx_default.j2" src: "nginx_default.j2"
dest: "{{ kibana_nginx_vhost_path }}/default" dest: "{{ kibana_nginx_vhost_path }}/default"
notify: notify:
- Enable and restart services - Enable and restart kibana services
- name: Create kibana systemd service config dir - name: Create kibana systemd service config dir
file: file:
@ -63,21 +63,17 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "/etc/systemd/system/kibana.service.d/kibana-overrides.conf" dest: "/etc/systemd/system/kibana.service.d/kibana-overrides.conf"
notify: notify:
- Enable and restart services - Enable and restart kibana services
- name: Drop kibana conf file - name: Drop kibana conf file
template: template:
@ -85,4 +81,4 @@
dest: "/etc/kibana/kibana.yml" dest: "/etc/kibana/kibana.yml"
mode: "0666" mode: "0666"
notify: notify:
- Enable and restart services - Enable and restart kibana services

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart logstash (systemd) - name: Enable and restart logstash
systemd: systemd:
name: "logstash" name: "logstash"
enabled: true enabled: true
state: "restarted" state: "restarted"
daemon_reload: true 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

View File

@ -65,16 +65,12 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "/etc/systemd/system/logstash.service.d/logstash-overrides.conf" dest: "/etc/systemd/system/logstash.service.d/logstash-overrides.conf"
@ -137,15 +133,11 @@
command: id -u logstash command: id -u logstash
register: logstash_uid register: logstash_uid
changed_when: false changed_when: false
when:
- ansible_service_mgr == 'systemd'
- name: Get logstash GID - name: Get logstash GID
command: id -g logstash command: id -g logstash
register: logstash_gid register: logstash_gid
changed_when: false changed_when: false
when:
- ansible_service_mgr == 'systemd'
- name: Read logstash queue path - name: Read logstash queue path
command: "readlink -f /var/lib/logstash/queue" command: "readlink -f /var/lib/logstash/queue"
@ -166,18 +158,6 @@
- logstash.service - logstash.service
state: 'started' state: 'started'
enabled: true 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: when:
- logstash_queue_type == 'memory' - logstash_queue_type == 'memory'

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart metricbeat (systemd) - name: Enable and restart metricbeat
systemd: systemd:
name: "metricbeat" name: "metricbeat"
enabled: true enabled: true
state: "{{ metricbeat_service_state }}" state: "{{ metricbeat_service_state }}"
daemon_reload: true 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

View File

@ -268,16 +268,12 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "/etc/systemd/system/metricbeat.service.d/metricbeat-overrides.conf" dest: "/etc/systemd/system/metricbeat.service.d/metricbeat-overrides.conf"
@ -310,20 +306,10 @@
- name: Force beat handlers - name: Force beat handlers
meta: flush_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) - name: set metricbeat service state (systemd)
systemd: systemd:
name: "metricbeat" name: "metricbeat"
state: "{{ metricbeat_service_state }}" state: "{{ metricbeat_service_state }}"
enabled: "{{ metricbeat_service_state in ['running', 'started', 'restarted'] }}" enabled: "{{ metricbeat_service_state in ['running', 'started', 'restarted'] }}"
when: when:
- ansible_service_mgr == 'systemd'
- metricbeat_service_state in ['started', 'stopped'] - metricbeat_service_state in ['started', 'stopped']

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart packetbeat (systemd) - name: Enable and restart packetbeat
systemd: systemd:
name: "packetbeat" name: "packetbeat"
enabled: true enabled: true
state: "{{ packetbeat_service_state }}" state: "{{ packetbeat_service_state }}"
daemon_reload: true 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

View File

@ -46,16 +46,12 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "0644" mode: "0644"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.general-overrides.conf.j2" - src: "systemd.general-overrides.conf.j2"
dest: "/etc/systemd/system/packetbeat.service.d/packetbeat-overrides.conf" dest: "/etc/systemd/system/packetbeat.service.d/packetbeat-overrides.conf"
@ -88,20 +84,10 @@
- name: Force beat handlers - name: Force beat handlers
meta: flush_handlers meta: flush_handlers
- name: set packetbeat service state (upstart) - name: set packetbeat service state
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)
systemd: systemd:
name: "packetbeat" name: "packetbeat"
state: "{{ packetbeat_service_state }}" state: "{{ packetbeat_service_state }}"
enabled: "{{ packetbeat_service_state in ['running', 'started', 'restarted'] }}" enabled: "{{ packetbeat_service_state in ['running', 'started', 'restarted'] }}"
when: when:
- ansible_service_mgr == 'systemd'
- packetbeat_service_state in ['started', 'stopped'] - packetbeat_service_state in ['started', 'stopped']

View File

@ -13,21 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Enable and restart elasticsearch (systemd) - name: Enable and restart elasticsearch
systemd: systemd:
name: "elasticsearch" name: "elasticsearch"
enabled: true enabled: true
state: restarted state: restarted
daemon_reload: true 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

View File

@ -40,7 +40,7 @@
retries: 3 retries: 3
delay: 2 delay: 2
notify: notify:
- Enable and restart elastic - Enable and restart elasticsearch
tags: tags:
- package_install - package_install
@ -51,20 +51,16 @@
group: "root" group: "root"
owner: "root" owner: "root"
mode: "0755" mode: "0755"
when:
- ansible_service_mgr == 'systemd'
- name: Apply systemd options - name: Apply systemd options
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
when:
- ansible_service_mgr == 'systemd'
with_items: with_items:
- src: "systemd.elasticsearch-overrides.conf.j2" - src: "systemd.elasticsearch-overrides.conf.j2"
dest: "/etc/systemd/system/elasticsearch.service.d/elasticsearch-overrides.conf" dest: "/etc/systemd/system/elasticsearch.service.d/elasticsearch-overrides.conf"
notify: notify:
- Enable and restart elastic - Enable and restart elasticsearch
tags: tags:
- config - config
@ -95,7 +91,7 @@
- src: "jvm.options.j2" - src: "jvm.options.j2"
dest: "/etc/elasticsearch/jvm.options" dest: "/etc/elasticsearch/jvm.options"
notify: notify:
- Enable and restart elastic - Enable and restart elasticsearch
- name: Drop elasticsearch conf file - name: Drop elasticsearch conf file
template: template:
@ -107,7 +103,7 @@
- src: "es-log4j2.properties.j2" - src: "es-log4j2.properties.j2"
dest: "/etc/elasticsearch/log4j2.properties" dest: "/etc/elasticsearch/log4j2.properties"
notify: notify:
- Enable and restart elastic - Enable and restart elasticsearch
tags: tags:
- config - config