Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Javier Franco
/
elk_installation
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
459cec39
authored
2023-01-17 17:51:39 -0300
by
Gustavo Calcaterra
Committed by
DevOps
2023-01-17 17:51:39 -0300
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Enable nginx module for metricbeat and filebeat for nginx servers
1 parent
9e5d460b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
roles/beat/tasks/main.yml
roles/beat/tasks/main.yml
View file @
459cec3
...
...
@@ -27,13 +27,14 @@
daemon_reload
:
yes
when
:
ansible_distribution_major_version >= "7"
#Enable system module
-
name
:
Verify if system module of {{ beat_name }} is enabled
shell
:
'
ls
-l
/etc/{{
beat_name
}}/modules.d/*.yml
|
grep
system'
ignore_errors
:
yes
#when: modules == 'yes'
when
:
( beat_name == "metricbeat") or
( beat_name == "filebeat")
register
:
verify_system
_result
register
:
check_system_module
_result
changed_when
:
False
-
name
:
Configure system module of {{ beat_name }}
...
...
@@ -41,11 +42,34 @@
#when: modules == 'yes'
when
:
-
( beat_name == "metricbeat") or ( beat_name == "filebeat")
-
"
verify_system
_result.rc
!=
0"
-
"
check_system_module
_result.rc
!=
0"
register
:
result
changed_when
:
"
'Module
system
is
already
enabled'
not
in
result.stdout"
notify
:
"
Restart
beat
service"
#Enable nginx module
-
name
:
Verify if nginx module of {{ beat_name }} is enabled
shell
:
'
ls
-l
/etc/{{
beat_name
}}/modules.d/*.yml
|
grep
nginx'
ignore_errors
:
yes
#when: modules == 'yes'
when
:
-
( beat_name == "metricbeat" ) or ( beat_name == "filebeat" )
-
inventory_hostname in groups['nginx']
register
:
check_nginx_module_result
changed_when
:
False
-
name
:
Configure nginx module of {{ beat_name }}
shell
:
'
{{
beat_name
}}
modules
enable
nginx'
#when: modules == 'yes'
when
:
-
( beat_name == "metricbeat" ) or ( beat_name == "filebeat" )
-
inventory_hostname in groups['nginx']
-
"
check_nginx_module_result.rc
!=
0"
register
:
result
changed_when
:
"
'Module
nginx
is
already
enabled'
not
in
result.stdout"
notify
:
"
Restart
beat
service"
#Configure Dashboards
-
name
:
Run {{ beat_name }} setup and dashboard config on kibana
shell
:
'
{{
beat_name
}}
setup'
register
:
result
...
...
@@ -54,6 +78,7 @@
notify
:
"
Restart
beat
service"
when
:
installation_result.changed
#Run handlers
-
name
:
Flush handlers
meta
:
flush_handlers
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment