forked from ReconInfoSec/ansible-graylog-modules
-
Notifications
You must be signed in to change notification settings - Fork 1
/
graylog_streams_pause.yaml
44 lines (40 loc) · 1.25 KB
/
graylog_streams_pause.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
- hosts: localhost
gather_facts: no
become: true
vars:
graylog_fqdn: "localhost"
graylog_port: "9000"
graylog_user: "admin"
graylog_password: "admin"
graylog_streams:
- gelf
- syslog
- bal
- cloudwatch
tasks:
- name: Get stream id from stream name query
graylog_streams:
action: query_streams
allow_http: true
protocol: http
graylog_fqdn: "{{ graylog_fqdn }}"
graylog_port: "{{ graylog_port }}"
graylog_user: "{{ graylog_user }}"
graylog_password: "{{ graylog_password }}"
stream_name: "{{ item }}"
loop: "{{ graylog_streams }}"
register: streams
- name: "Print matching streams"
ansible.builtin.debug:
msg: "Stream Name: {{ item.invocation.module_args.stream_name }}, Stream ID: {{ item.json.stream_id }}"
with_items: "{{ streams.results }}"
- name: Pause streams
graylog_streams:
action: pause_stream
protocol: http
graylog_fqdn: "{{ graylog_fqdn }}"
graylog_port: "{{ graylog_port }}"
graylog_user: "{{ graylog_user }}"
graylog_password: "{{ graylog_password }}"
stream_id: "{{ item.json.stream_id }}"
with_items: "{{ streams.results }}"