aboutsummaryrefslogtreecommitdiffstats
path: root/roles/elasticsearch-repos/tasks/main.yml
blob: a76ad43af4f87ab802205bc24b5dc817c555925e (plain) (blame)
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
---
- name: Install GPG
  package:
    name: gpg
    state: present
  tags:
    - role::elasticsearch-repos

- name: Install Elasticsearch signing key
  # noqa command-instead-of-module
  shell: >-
    set -o pipefail && wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch |
    gpg --yes --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
  args:
    creates: /usr/share/keyrings/elasticsearch-keyring.gpg
  tags:
    - role::elasticsearch-repos

- name: Add Elasticsearch repository to apt
  copy:
    content: >-
      deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg]
      https://artifacts.elastic.co/packages/8.x/apt stable main
    dest: /etc/apt/sources.list.d/elastic-8.x.list
    owner: root
    group: root
    mode: 0644
  tags:
    - role::elasticsearch-repos
  notify:
    - apt update