-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathrepo.sls
40 lines (37 loc) · 1.34 KB
/
repo.sls
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
{% from "elasticsearch/settings.sls" import elasticsearch with context %}
{%- if elasticsearch.major_version >= 5 %}
{%- set repo_url = 'https://artifacts.elastic.co/packages/' ~ (elasticsearch.major_version|string) ~ '.x' %}
{%- else %}
{%- set repo_url = 'http://packages.elastic.co/elasticsearch/2.x' %}
{%- endif %}
{%- if elasticsearch.major_version >= 5 and grains['os_family'] == 'Debian' %}
apt-transport-https:
pkg.installed
{%- endif %}
elasticsearch_repo:
pkgrepo.managed:
- humanname: Elasticsearch {{ elasticsearch.major_version }}
{%- if grains.get('os_family') == 'Debian' %}
- name: >
deb [arch={{ grains['osarch'] }} signed-by=/etc/apt/keyrings/elastic-archive-keyring.gpg]
{%- if elasticsearch.major_version >= 5 %}
{{ repo_url }}/apt stable main
{%- else %}
{{ repo_url }}/debian stable main
{%- endif %}
- dist: stable
- file: /etc/apt/sources.list.d/elastic.list
- key_url: https://packages.elastic.co/GPG-KEY-elasticsearch
- aptkey: false
- clean_file: true
{%- elif grains['os_family'] == 'RedHat' %}
- name: elasticsearch
{%- if elasticsearch.major_version >= 5 %}
- baseurl: {{ repo_url }}/yum
{%- else %}
- baseurl: {{ repo_url }}/centos
{%- endif %}
- enabled: 1
- gpgcheck: 1
- gpgkey: http://artifacts.elastic.co/GPG-KEY-elasticsearch
{%- endif %}