Skip to content

Commit 30972af

Browse files
authored
Allow disabling repos per default (NETWAYS#108)
This introduces a new variable that will disable yum repositories per default and re-enables them temporarily when modifying packages. It's not possible to disable apt repositories temporarily so we need to have two different approaches. fixes NETWAYS#106 fixes NETWAYS#76 fixes NETWAYS#98 supersedes NETWAYS#101
1 parent f9db00f commit 30972af

File tree

30 files changed

+292
-90
lines changed

30 files changed

+292
-90
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
This collection installs and manages the Elastic Stack. It provides roles every component which is part of the Stack. Furthermore it is possible to differentiate between Enterprise or OSS releases. Every role is documented with all variables, please refer to the documentation found in **[Getting-Started](./docs/getting-started.md)**
44

5-
6-
75
## Roles Documentation
86

97
* [Beats](docs/role-beats.md)
@@ -56,6 +54,10 @@ We have known issues with the following Distributions.
5654

5755
## Usage
5856

57+
* *elastic_version*: Version number of tools to install Only set if you don't want the latest. (default: none). For OSS version see `elastic_variant` below. **IMPORTANT** Do not change the version once you have set up the stack. There are unpredictable effects to be expected when using this for upgrades. And upgrade mechanism is already on it's way. (default: none. Example: `7.17.2`
58+
*elastic_release*: Major release version of Elastic stack to configure. (default: `7`)
59+
*elastic_variant*: Variant of the stack to install. Valid values: `elastic` or `oss`. (default: `elastic`)
60+
5961
Make sure all hosts that should be configured are part of your playbook. (See below for details on groups etc.). The collection is built to first collect all facts from all hosts (including those only running beats) and then use facts like hostnames or ip addresses to connect the tools to each other.
6062

6163
You will want to have reliable DNS resolution or enter all hosts of the stack into your systems hosts files.

docs/role-beats.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Role Variables
1414
--------------
1515

1616
* *beats_filebeat*: Install and manage filebeat (Default: `true`)
17-
* *beats_filebeat_version*: Install specific version (Default: none. Possible values: e.g. `-7.10.1` for RedHat compatible systems or `=1:7.10.1-1` for Debian compatible systems or `latest`)
1817
* *filebeat_enable*: Automatically start Filebeat (Default: `true`)
1918
* *filebeat_output*: Set to `logstash` or `elasticsearch`. (default: `logstash`)
2019
* *filebeat_syslog_udp*: Use UDP Syslog input (Default: `false`)
@@ -66,14 +65,12 @@ filebeat_journald_inputs:
6665
* *filebeat_modules*: **EXPERIMENTAL**: Give a list of modules to enable. (default: none)
6766

6867
* *beats_auditbeat*: Install and manage filebeat (Default: `false`)
69-
* *beats_auditbeat_version*: Install specific version (Default: none. Possible values: e.g. `-7.10.1` for RedHat compatible systems or `=1:7.10.1-1` for Debian compatible systems or `latest`)
7068
* *auditbeat_output*: Output for Auditbeat Set to `logstash` or `elasticsearch`. (default: `elasticsearch`)
7169
* *auditbeat_enable*: Automatically start Auditbeat (Default: `true`)
7270
* *auditbeat_setup*: Run Auditbeat Setup (Default: `true`) (Only works with Elasticsearch output)
7371
* *auditbeat_loadbalance*: Enable loadbalancing for Auditbeats Logstash output (default: `true`)
7472

7573
* *beats_metricbeat*: Enable installation and management of Metricbeat (Default: `false`)
76-
* *beats_metricbeat_version*: Install specific version (Default: none. Possible values: e.g. `-7.10.1` for RedHat compatible systems or `=1:7.10.1-1` for Debian compatible systems or `latest`)
7774
* *metricbeat_enable*: Start Metricbeat automatically (Default: `true`)
7875
* *metricbeat_output*: Set to `logstash` or `elasticsearch`. (default: `elasticsearch`)
7976
* *metricbeat_modules*: List of modules to enable. (Default: `- system`)
@@ -96,6 +93,7 @@ The following variables only apply if you use this role together with our other
9693
* *elastic_ca_dir*: Directory where on the Elasticsearch CA host certificates are stored. This is only useful in connection with out other Elastic Stack related roles. (default: `/opt/es-ca`)
9794
* *elastic_ca_pass*: Password for Elasticsearch CA (default: `PleaseChangeMe`)
9895
* *elastic_initial_passwords*: Path to file with initical elasticsearch passwords (default: `/usr/share/elasticsearch/initial_passwords`)
96+
* *elastic_version*: Install specific version (Default: none. Possible values: e.g. `7.10.1` or `latest`)
9997

10098
If you want to use this role with your own TLS certificates, use these variables.
10199

docs/role-logstash.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If you want to use the default pipeline (or other pipelines communicating via Re
2929
Role Variables
3030
--------------
3131

32-
* *logstash_version*: Version number of Logstash to install (use os specific version string. e.g. `-7.10.1` for RedHat compatible systems or `=1:7.10.1-1` for Debian compatible systems). Only set if you don't want the latest. (default: none). For OSS version see `elastic_variant` below.
32+
* *elastic_version*: Version number of Logstash to install (e.g. `7.10.1`). Only set if you don't want the latest. (default: none). For OSS version see `elastic_variant` below.
3333
* *logstash_enable*: Start and enable Logstash service (default: `true`)
3434
* *logstash_config_backup*: Keep backups of all changed configuration (default: `no`)
3535
* *logstash_manage_yaml*: Manage and overwrite `logstash.yml` (default: `true`)

docs/role-repos.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,21 @@ Role Variables
1818

1919
* *elastic_release*: Major release version of Elastic stack to configure. (default: `7`). `7` and `8` are supported.
2020
* *elastic_variant*: Variant of the stack to install. Valid values: `elastic` or `oss`. (default: `elastic`).
21+
* *elastic_enable_repos*: Enable repositories after creating them. (default: `true`) Only works on RPM based distributions!
2122

2223
Please note that no `oss` versions are available for Elastic Stack later than `7`. This role will fail if you try to install them.
2324

2425
Usage
2526
--------
2627

28+
Upgrades
29+
========
30+
31+
If you want to be able to update your operating system without worrying about accidentally upgrading Elastic Stack, set `elastic_enable_repos` to `false`. The roles in this collection will enable the repository in case they need it. Keep in mind that this will only work on rpm based distributions.
32+
33+
Example playbook
34+
================
35+
2736
```
2837
- hosts: all
2938
become: yes

molecule/beats_peculiar/converge.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
elastic_stack_full_stack: false
2424
filebeat_mysql_slowlog_input: true
2525
beats_auditbeat: true
26-
beats_auditbeat_version: latest
2726
auditbeat_output: logstash
2827
auditbeat_enable: false # can't run on GitHub because of permissions
2928
filebeat_journald_inputs:
@@ -36,18 +35,18 @@
3635
#filebeat_docker: true
3736
elastic_release: "{{ lookup('env', 'ELASTIC_RELEASE') | int}}"
3837
tasks:
39-
# Looks like Elastic isn't providing all old releases
40-
# anymore
41-
#
42-
#- name: Set Filebeat version on RedHat
43-
# set_fact:
44-
# beats_filebeat_version: "-7.16.1"
45-
# when: ansible_os_family == "RedHat"
4638

47-
#- name: Set Filebeat version on Debian
48-
# set_fact:
49-
# beats_filebeat_version: "=7.16.1"
50-
# when: ansible_os_family == "Debian"
39+
- name: Set Filebeat version for 7.x
40+
set_fact:
41+
elastic_version: "7.17.1"
42+
when:
43+
- elastic_release == 7
44+
45+
- name: Set Filebeat version for 8.x
46+
set_fact:
47+
elastic_version: "8.4.1"
48+
when:
49+
- elastic_release == 8
5150

5251
- name: "Include Elastics repos role"
5352
include_role:

molecule/beats_peculiar/verify.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- name: Check if Logstash configuration does what it should
44
hosts: all
5+
vars:
6+
elastic_release: "{{ lookup('env', 'ELASTIC_RELEASE') | int}}"
57
tasks:
68
- name: fetch Filebeat version
79
command: "filebeat version | grep ^filebeat"
@@ -11,8 +13,16 @@
1113
debug:
1214
var: filebeat_version.stdout
1315

14-
#- name: Fail if Filebeat has the wrong version
15-
# fail:
16-
# msg: "Filebeat has the wrong version"
16+
- name: Fail if Filebeat has the wrong version
17+
fail:
18+
msg: "Filebeat has the wrong version"
19+
when:
20+
- filebeat_version.stdout.find('7.17.1') == -1
21+
- elastic_release == 7
1722

18-
# when: filebeat_version.stdout.find('7.16.1') == -1
23+
- name: Fail if Filebeat has the wrong version
24+
fail:
25+
msg: "Filebeat has the wrong version"
26+
when:
27+
- filebeat_version.stdout.find('8.4.1') == -1
28+
- elastic_release == 8

molecule/logstash_full_stack-oss/verify.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
- name: Check if Logstash configuration does what it should
55
hosts: all
6+
vars:
7+
elastic_elasticsearch_http_port: 9200
68
tasks:
79
- name: Give some time for tools to connect
810
wait_for:

molecule/logstash_full_stack/verify.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
- name: Check if Logstash configuration does what it should
55
hosts: all
6+
vars:
7+
elastic_elasticsearch_http_port: 9200
68
tasks:
79
- name: Give some time for tools to connect
810
wait_for:

molecule/logstash_specific_version/converge.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,26 @@
1212
logstash_logging_console: false
1313
logstash_logging_slow_file: false
1414
logstash_pipeline_identifier: false
15-
elastic_release: 7
15+
elastic_release: "{{ lookup('env', 'ELASTIC_RELEASE') | int}}"
1616
elastic_stack_full_stack: false
1717
tasks:
1818

19-
- name: Set Logstash version on RedHat
20-
set_fact:
21-
logstash_version: "-7.10.1"
22-
when: ansible_os_family == "RedHat"
19+
- name: Set Filebeat version for 7.x
20+
set_fact:
21+
elastic_version: "7.17.1"
22+
when:
23+
- elastic_release == 7
2324

24-
- name: Set Logstash version on Debian
25-
set_fact:
26-
logstash_version: "=1:7.10.1-1"
27-
when: ansible_os_family == "Debian"
25+
- name: Set Filebeat version for 8.x
26+
set_fact:
27+
elastic_version: "8.4.1"
28+
when:
29+
- elastic_release == 8
2830

29-
- name: "Include Elastics repos role"
30-
include_role:
31-
name: repos
31+
- name: "Include Elastics repos role"
32+
include_role:
33+
name: repos
3234

33-
- name: "Include Logstash"
34-
include_role:
35-
name: logstash
35+
- name: "Include Logstash"
36+
include_role:
37+
name: logstash

molecule/logstash_specific_version/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dependency:
44
driver:
55
name: docker
66
platforms:
7-
- name: logstash_version
7+
- name: elastic_version
88
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
99
command: ${MOLECULE_DOCKER_COMMAND:-""}
1010
volumes:

0 commit comments

Comments
 (0)