Skip to content

Commit 062ba01

Browse files
authored
Merge pull request #197 from Graylog2/pr-195
Pr 195
2 parents 81b4c34 + c38dfe6 commit 062ba01

File tree

9 files changed

+91
-34
lines changed

9 files changed

+91
-34
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
with:
1818
path: 'graylog2.graylog-ansible-role'
1919

20-
- name: Set up Python 3.
20+
- name: Set up Python 3.9
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: '3.x'
23+
python-version: '3.9'
2424

2525
- name: Install test dependencies.
2626
run: pip3 install yamllint
@@ -49,7 +49,7 @@ jobs:
4949
- name: Set up Python 3.
5050
uses: actions/setup-python@v2
5151
with:
52-
python-version: '3.x'
52+
python-version: '3.9'
5353

5454
- name: Install test dependencies.
5555
run: pip3 install -r requirements.txt

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55

66
## Requirements
77

8-
- Ansible (> 2.5.0)
8+
- Ansible (2.13.13)
9+
- Python 3.9
910
- At least 4gb of memory on the target instance.
1011
- Linux
1112
- Currently tested against:
1213
- Ubuntu 18.04
1314
- Ubuntu 20.04
15+
- Ubuntu 22.04
1416
- Centos 7
1517
- Centos 8
18+
- Centos 9
1619

1720
To install the role, run:
1821

@@ -33,10 +36,13 @@ Be certain you are running a supported version of Elasticsearch. You can configu
3336

3437
**Compatibility Matrix**
3538

36-
| Graylog version | 3.x | 4.x |
37-
|:--------------|:-------------:|:-------------:|
38-
| Elasticsearch | 5-6 | 6.8 - 7.10 |
39+
| Graylog version | 3.x | 4.x | 5.x | 6.x |
40+
|:--------------|:-------------:|:----------:|:-------------:|:-------------:|
41+
| Elasticsearch | 5-6 | 6.8 - 7.10 | 6.8 - 7.10 | n/a |
42+
| OpenSearch | | 1.x* | 1.x - 2.x | 1.x - 2.x |
43+
*Graylog 4.3.x introduces support for OpenSearch.
3944

45+
Refer to the [Software Interoperability Chart](https://go2docs.graylog.org/5-0/planning_your_deployment/planning_your_upgrade_to_opensearch.htm)
4046

4147
You will need to these Ansible role dependencies:
4248
- [Java](https://github.com/lean-delivery/ansible-role-java)
@@ -77,13 +83,15 @@ Here is an example playbook that uses this role. This is a single-instance confi
7783
es_action_auto_create_index: False
7884

7985
#Graylog vars
80-
graylog_version: 4.2
86+
graylog_version: 5.2
8187
graylog_install_java: True
8288
graylog_password_secret: "" # Insert your own here. Generate with: pwgen -s 96 1
8389
graylog_root_password_sha2: "" # Insert your own root_password_sha2 here.
8490
graylog_http_bind_address: "{{ ansible_default_ipv4.address }}:9000"
8591
graylog_http_publish_uri: "http://{{ ansible_default_ipv4.address }}:9000/"
8692
graylog_http_external_uri: "http://{{ ansible_default_ipv4.address }}:9000/"
93+
graylog_install_open_package: True
94+
graylog_install_enterprise_package: False
8795

8896
roles:
8997
- role: "graylog2.graylog"
@@ -222,7 +230,7 @@ We run smoke tests for Graylog using this role. Documentation on that can be fou
222230

223231
## Author Information
224232

225-
Author: Marius Sturm (<[email protected]>) and [contributors](https://github.com/Graylog2/graylog2-ansible-role/graphs/contributors)
233+
Author: Graylog and [contributors](https://github.com/Graylog2/graylog2-ansible-role/graphs/contributors)
226234

227235
## License
228236

defaults/main.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ graylog_web_thread_pool_size: 16
187187
# JVM
188188
graylog_gc_warning_threshold: "1s"
189189
graylog_server_heap_size: "1500m"
190-
graylog_server_java: "/usr/bin/java"
190+
graylog_server_java: "/usr/bin/java" # For usage of the bundled openjdk version within graylog leave varviable blank
191191
graylog_server_java_opts_extra: ""
192192
graylog_server_java_opts: "-Djava.net.preferIPv4Stack=true -Xms{{ graylog_server_heap_size }} -Xmx{{ graylog_server_heap_size }} -XX:NewRatio=1 -server -XX:+ResizeTLAB -XX:-OmitStackTraceInFastThrow {{graylog_server_java_opts_extra}}"
193193
graylog_server_args: ""
@@ -202,11 +202,19 @@ graylog_install_java: True
202202
# Disable steps which break tests
203203
graylog_not_testing: True
204204

205-
# Plugins
205+
# Plugins for Graylog Versions <5.0
206206
graylog_install_enterprise_plugins: False
207207
graylog_install_integrations_plugins: False
208208
graylog_install_enterprise_integrations_plugins: False
209209

210+
# package version for Graylog Version >=5.0
211+
graylog_install_enterprise_package: False
212+
graylog_install_open_package: True
213+
214+
# Graylog Version to install
215+
graylog_version: 5.0
216+
graylog_full_version: ""
217+
210218
graylog_additional_config: {}
211219

212220
required_vars:

docs/Variables.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
| `graylog_install_java` | True | Whether to install Java on the instance.|
1010
| `graylog_install_elasticsearch` | True | Whether to install Elasticsearch on the instance. |
1111
| `graylog_install_mongodb` | True | Whether to install MongoDB on the instance. |
12-
| `graylog_install_enterprise_plugins` | False | Whether to install the [graylog-enterprise-plugins](https://docs.graylog.org/docs/intro) package. |
13-
| `graylog_install_integrations_plugins` | False | Whether to install the [graylog-integrations-plugins](https://docs.graylog.org/docs/integrations) package. |
14-
| `graylog_install_enterprise_integrations_plugins` | False | Whether to install the [graylog-enterprise-integrations-plugins](https://docs.graylog.org/docs/intro) package. |
12+
| `graylog_install_enterprise_plugins` | False | Whether to install the [graylog-enterprise-plugins](https://docs.graylog.org/docs/intro) package for version <= 4.3. |
13+
| `graylog_install_integrations_plugins` | False | Whether to install the [graylog-integrations-plugins](https://docs.graylog.org/docs/integrations) package for version <= 4.3. |
14+
| `graylog_install_enterprise_integrations_plugins` | False | Whether to install the [graylog-enterprise-integrations-plugins](https://docs.graylog.org/docs/intro) package for version <= 4.3. |
15+
| `graylog_install_open_package` | False | Whether to install the [graylog-server](https://docs.graylog.org/docs/intro) package for version >= 5.0. |
16+
| `graylog_install_enterprise_package` | False | Whether to install the [graylog-enterprise](https://docs.graylog.org/docs/intro) package for version >= 5.0. |
1517

1618

1719
## Java Variables

meta/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ dependencies:
1414
galaxy_info:
1515
role_name: graylog
1616
namespace: graylog2
17-
author: "Marius Sturm"
17+
author: "Graylog"
1818
company: "Graylog, Inc."
1919
description: "Install and configure Graylog log management."
20-
min_ansible_version: "2.5"
20+
min_ansible_version: "2.13.13"
2121
license: "Apache 2"
2222
platforms:
2323
- name: "EL"

requirements.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
ansible==4.2.0
2-
ansible-base==2.10.5
1+
ansible==6.7.0
2+
ansible-compat==24.5.1
3+
ansible-core==2.13.13
34
ansible-lint==4.3.5
45
enrich==1.2.6
56
molecule==3.5.1
67
molecule-docker==1.0.2
78
molecule-vagrant==0.6
89
python-vagrant==0.5.15
910
pytest-testinfra==6.1.0
11+
python-dateutil==2.9.0.post0
12+
python-dotenv==1.0.1
13+
python-slugify==8.0.4
14+
PyYAML==5.3.1
1015
selenium==3.141.0
16+
selinux==0.3.0
17+
setuptools==58.1.0
1118
yamllint==1.25.0
1219
webdriver-manager
13-
wheel
20+
wheel==0.45.1

tasks/setup-Debian.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,23 @@
2626

2727
- name: "Graylog server package should be installed"
2828
apt:
29-
name: "graylog-server{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}"
29+
name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}"
3030
state: "{{ graylog_package_state }}"
31+
when: graylog_version is version('5.0', '<')
32+
notify: "restart graylog-server"
33+
34+
- name: "Graylog Open server package should be installed"
35+
apt:
36+
name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}"
37+
state: "{{ graylog_package_state }}"
38+
when: (graylog_install_open_package | bool == true and graylog_install_enterprise_package | bool == false and graylog_version is version('5.0', '>='))
39+
notify: "restart graylog-server"
40+
41+
- name: "Graylog Enterprise server package should be installed"
42+
apt:
43+
name: "graylog-enterprise{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}"
44+
state: "{{ graylog_package_state }}"
45+
when: (graylog_install_open_package | bool == false and graylog_install_enterprise_package | bool == true and graylog_version is version('5.0', '>='))
3146
notify: "restart graylog-server"
3247

3348
- name: "setup-Debian.yml | Set elasticsearch priority to {{ graylog_es_debian_pin_version }} apt_preferences"
@@ -39,21 +54,21 @@
3954

4055
- name: "Installing graylog-enterprise-plugins"
4156
apt:
42-
name: "graylog-enterprise-plugins{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}"
57+
name: "graylog-enterprise-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}"
4358
state: "{{ graylog_package_state }}"
44-
when: graylog_install_enterprise_plugins
59+
when: (graylog_install_enterprise_plugins | bool == true and graylog_version is version('5.0', '<'))
4560
notify: restart graylog-server
4661

4762
- name: "Installing graylog-integrations-plugins"
4863
apt:
49-
name: "graylog-integrations-plugins{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}"
64+
name: "graylog-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}"
5065
state: "{{ graylog_package_state }}"
51-
when: graylog_install_integrations_plugins
66+
when: (graylog_install_integrations_plugins | bool == true and graylog_version is version('5.0', '<'))
5267
notify: restart graylog-server
5368

5469
- name: "Installing graylog-enterprise-integrations-plugins"
5570
apt:
56-
name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}"
71+
name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}"
5772
state: "{{ graylog_package_state }}"
58-
when: graylog_install_enterprise_integrations_plugins
73+
when: (graylog_install_enterprise_integrations_plugins | bool == true and graylog_version is version('5.0', '<'))
5974
notify: restart graylog-server

tasks/setup-RedHat.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,42 @@
1010

1111
- name: "Graylog server should be installed"
1212
yum:
13-
name: "graylog-server{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}"
13+
name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}"
1414
state: "{{ graylog_package_state }}"
15-
notify: restart graylog-server
15+
when: graylog_version is version('5.0', '<')
16+
notify: "restart graylog-server"
17+
18+
- name: "Graylog Open server package should be installed"
19+
yum:
20+
name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}"
21+
state: "{{ graylog_package_state }}"
22+
when: (graylog_install_open_package | bool == true and graylog_install_enterprise_package | bool == false and graylog_version is version('5.0', '>='))
23+
notify: "restart graylog-server"
24+
25+
- name: "Graylog Enterprise server package should be installed"
26+
yum:
27+
name: "graylog-enterprise{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}"
28+
state: "{{ graylog_package_state }}"
29+
when: (graylog_install_open_package | bool == false and graylog_install_enterprise_package | bool == true and graylog_version is version('5.0', '>='))
30+
notify: "restart graylog-server"
1631

1732
- name: "Installing graylog-enterprise-plugins"
1833
yum:
19-
name: "graylog-enterprise-plugins{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}"
34+
name: "graylog-enterprise-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}"
2035
state: "{{ graylog_package_state }}"
21-
when: graylog_install_enterprise_plugins
36+
when: (graylog_install_enterprise_plugins | bool == true and graylog_version is version('5.0', '<'))
2237
notify: restart graylog-server
2338

2439
- name: "Installing graylog-integrations-plugins"
2540
yum:
26-
name: "graylog-integrations-plugins{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}"
41+
name: "graylog-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}"
2742
state: "{{ graylog_package_state }}"
28-
when: graylog_install_integrations_plugins
43+
when: (graylog_install_integrations_plugins | bool == true and graylog_version is version('5.0', '<'))
2944
notify: restart graylog-server
3045

3146
- name: "Installing graylog-enterprise-integrations-plugins"
3247
yum:
33-
name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}"
48+
name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}"
3449
state: "{{ graylog_package_state }}"
35-
when: graylog_install_enterprise_integrations_plugins
50+
when: (graylog_install_enterprise_integrations_plugins | bool == true and graylog_version is version('5.0', '<'))
3651
notify: restart graylog-server

templates/graylog.server.default.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
{% if graylog_server_java is defined and graylog_server_java|length %}
12
JAVA="{{ graylog_server_java }}"
3+
{% endif %}
24
GRAYLOG_SERVER_JAVA_OPTS="{{ graylog_server_java_opts }}"
35
GRAYLOG_SERVER_ARGS="{{ graylog_server_args }}"
46
GRAYLOG_COMMAND_WRAPPER="{{ graylog_server_wrapper }}"

0 commit comments

Comments
 (0)