diff options
| author | 2022-03-15 20:03:07 +0000 | |
|---|---|---|
| committer | 2022-03-15 20:03:07 +0000 | |
| commit | 6a52110bf13187c2f4b0cab41c4ce33ffbc17882 (patch) | |
| tree | 86f023fd3989fcbe0b1dc6340c4da812d17a8228 | |
| parent | Install and configure fail2ban (diff) | |
Add Elasticsearch
| -rw-r--r-- | roles/elasticsearch/README.md | 3 | ||||
| -rw-r--r-- | roles/elasticsearch/tasks/main.yml | 45 | 
2 files changed, 48 insertions, 0 deletions
| diff --git a/roles/elasticsearch/README.md b/roles/elasticsearch/README.md new file mode 100644 index 0000000..1896679 --- /dev/null +++ b/roles/elasticsearch/README.md @@ -0,0 +1,3 @@ +# Role "elasticsearch" + +The elasticsearch role installs and configures Elasticsearch. diff --git a/roles/elasticsearch/tasks/main.yml b/roles/elasticsearch/tasks/main.yml new file mode 100644 index 0000000..a9362d6 --- /dev/null +++ b/roles/elasticsearch/tasks/main.yml @@ -0,0 +1,45 @@ +--- +- name: Install GPG +  package: +    name: gpg +    state: present +  tags: +    - role::elasticsearch + +- name: Install Elasticsearch signing key +  shell: >- +    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 + +- 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 +  register: add_elastic_repo + +- name: Install Elasticsearch +  apt: +    pkg: elasticsearch +    state: present +    update_cache: "{{ add_elastic_repo.changed }}" +  tags: +    - role::elasticsearch + +- name: Start and enable Elasticsearch +  service: +    name: elasticsearch +    state: started +    enabled: true +  tags: +    - role::elasticsearch | 
