Skip to content

Commit 2e7d808

Browse files
committed
Move and rename elasticstack_enable_repos to the repos role
This variable is only part of the `repos` role. There is no need to define it inside the `elasticstack` role.
1 parent c5b90a3 commit 2e7d808

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

docs/10-role-repos.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
Elastic Repos
2-
=========
1+
# Role `repos`
32

4-
![Test Role repos](https://github.com/netways/ansible-collection-elasticstack/actions/workflows/test_role_repos.yml/badge.svg)
3+
This role will add the Elastic repositories to the package manager (dnf/yum. apt or zypper). It will not install packages (these can be done with the role `elasticsearch`).
54

6-
The role adds Elastic repositories to the package manager. It's main use is in connection with other roles that provide installation and configuration of the Elastic Stack.
7-
8-
Requirements
9-
------------
5+
## Requirements
106

117
GPG needs to be installed on the systems to verify the package signature. This will be installed as part of the role. Below you can find a list of packages that will be installed.
128
* Debian family: `apt-transport-https`, `gpg` and `gpg-agent`
@@ -15,25 +11,28 @@ GPG needs to be installed on the systems to verify the package signature. This w
1511

1612
For SuSE hosts you will need the Ansible collection `community.general` on your Ansible controller.
1713

18-
Role Variables
19-
--------------
14+
## Variables
15+
16+
There are variables that are needed in more than one role of the collection. These are defined inside the "meta" role `elasticstack`. The role `elasticstack` is imported in this role.
2017

21-
* *elasticstack_release*: Major release version of Elastic stack to configure. (default: `7`). `7` and `8` are supported.
22-
* *elasticstack_variant*: Variant of the stack to install. Valid values: `elastic` or `oss`. (default: `elastic`).
23-
* *elasticstack_enable_repos*: Enable repositories after creating them. (default: `true`) Only works on RPM based distributions!
18+
**List of variables from `elasticsearch` used inside `repos`:**
19+
* `elasticstack_release`: Major release version of Elastic stack to configure. (default: `7`). `7` and `8` are supported.
20+
* `elasticstack_variant`: Variant of the stack to install. Valid values: `elastic` or `oss`. (default: `elastic`).
2421

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

27-
Usage
28-
--------
24+
**Variables that are explicity defined inside `repos`:**
25+
* `repos_enable_repos`: Enable repositories after creating them. Only works on RPM based distributions (default: `true`)
26+
27+
## Usage
2928

30-
Upgrades
31-
========
29+
### Upgrades
3230

33-
If you want to be able to update your operating system without worrying about accidentally upgrading Elastic Stack, set `elasticstack_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.
31+
If you want to be able to update your operating system without worrying about accidentally upgrading Elastic Stack, set `repos_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.
3432

35-
Example playbook
36-
================
33+
### Example playbook
34+
35+
The following playbook will add the Elastic repository to the package manager.
3736

3837
```
3938
- hosts: all
@@ -42,4 +41,4 @@ Example playbook
4241
- netways.elasticstack
4342
roles:
4443
- repos
45-
```
44+
```

roles/elasticstack/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ elasticstack_ca_pass: PleaseChangeMe
1313
elasticstack_ca_validity_period: 1095
1414
elasticstack_ca_will_expire_soon: false
1515
elasticstack_elasticsearch_http_port: 9200
16-
elasticstack_enable_repos: true
1716
elasticstack_collection_managed: true
1817
elasticstack_initial_passwords: /usr/share/elasticsearch/initial_passwords
1918
elasticstack_kibana_port: 5601

roles/repos/tasks/redhat.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
baseurl: https://artifacts.elastic.co/packages/{{ elasticstack_release }}.x/yum
1313
gpgcheck: yes
1414
gpgkey: "{{ elasticstack_repo_key }}"
15-
enabled: "{{ elasticstack_enable_repos | bool }}"
15+
enabled: "{{ repos_enable_repos | bool }}"
1616
when: elasticstack_variant == "elastic"
1717

1818
- name: Ensure Elastic Stack OSS yum repository is configured (RedHat)
@@ -23,5 +23,5 @@
2323
baseurl: https://artifacts.elastic.co/packages/oss-{{ elasticstack_release }}.x/yum
2424
gpgcheck: yes
2525
gpgkey: "{{ elasticstack_repo_key }}"
26-
enabled: "{{ elasticstack_enable_repos | bool }}"
26+
enabled: "{{ repos_enable_repos | bool }}"
2727
when: elasticstack_variant == "oss"

roles/repos/tasks/suse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
description: Elastic Release {{ elasticstack_release }}.x
66
repo: https://artifacts.elastic.co/packages/{{ elasticstack_release }}.x/yum
77
auto_import_keys: true
8-
enabled: "{{ elasticstack_enable_repos | bool }}"
8+
enabled: "{{ repos_enable_repos | bool }}"
99
when: elasticstack_variant == "elastic"
1010

1111
- name: Ensure Elastic Stack OSS yum repository is configured (SuSE)
@@ -14,5 +14,5 @@
1414
description: Elastic OSS Release {{ elasticstack_release }}.x
1515
repo: https://artifacts.elastic.co/packages/oss-{{ elasticstack_release }}.x/yum
1616
auto_import_keys: true
17-
enabled: "{{ elasticstack_enable_repos | bool }}"
17+
enabled: "{{ repos_enable_repos | bool }}"
1818
when: elasticstack_variant == "oss"

0 commit comments

Comments
 (0)