Add pretasks to exit quick when needed
The journalbeat playbook uses conditionals to know when to deploy the journalbeat collector. This change makes it so the playbook simply exits when the journal is not found or the environment being deployed is not using systemd. This change will result in faster deployments in mixed environments as the role will no longer need to iterate over its conditional. Change-Id: I581b61902723f54237623036566a83c9be79210e Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
5586d8a80f
commit
b1232aead5
@ -56,11 +56,14 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
|
- name: Halt this playbook if no journal is found
|
||||||
|
meta: end_play
|
||||||
|
when:
|
||||||
|
- not (journal_dir.stat.exists | bool) or
|
||||||
|
(ansible_service_mgr != 'systemd')
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_journalbeat
|
- role: elastic_journalbeat
|
||||||
when:
|
|
||||||
- journal_dir.stat.exists | bool
|
|
||||||
- ansible_service_mgr == 'systemd'
|
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- beat-install
|
- beat-install
|
||||||
@ -76,11 +79,22 @@
|
|||||||
|
|
||||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Check for journal directory
|
||||||
|
stat:
|
||||||
|
path: /var/log/journal
|
||||||
|
register: journal_dir
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- name: Halt this playbook if no journal is found
|
||||||
|
meta: end_play
|
||||||
|
when:
|
||||||
|
- not (journal_dir.stat.exists | bool) or
|
||||||
|
(ansible_service_mgr != 'systemd')
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: elastic_rollup
|
- role: elastic_rollup
|
||||||
when:
|
|
||||||
- journal_dir.stat.exists | bool
|
|
||||||
- ansible_service_mgr == 'systemd'
|
|
||||||
index_name: journalbeat
|
index_name: journalbeat
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
|
Loading…
Reference in New Issue
Block a user