Skip to content

Commit 69a2877

Browse files
committed
[FIX] bugs fixed
1 parent 2010393 commit 69a2877

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

Ansible/elasticsearch/install.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,22 @@
1010
apt:
1111
name: "{{ item }}"
1212
state: present
13-
with_items:
13+
loop:
1414
- apt-transport-https
1515
- wget
1616
- gnupg
1717
when: ansible_os_family == "Debian"
1818

19-
- name: Download Elasticsearch GPG key
20-
ansible.builtin.get_url:
19+
- name: Download and add Elasticsearch GPG key for Debian/Ubuntu
20+
apt_key:
2121
url: "{{ elastic_gpg_key }}"
22-
dest: /usr/share/keyrings/elasticsearch-keyring.gpg
23-
mode: '0644'
24-
when: ansible_os_family == "Debian"
25-
26-
- name: Add Elasticsearch APT repository
27-
ansible.builtin.apt_repository:
28-
repo: "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] {{ elastic_repo_url_apt }} stable main"
22+
state: present
2923
when: ansible_os_family == "Debian"
3024

31-
- name: Create Elasticsearch repository file for Debian/Ubuntu
32-
template:
33-
src: templates/elasticsearch-apt.j2
34-
dest: /etc/apt/sources.list.d/elastic-{{ elastic_version }}.x.list
25+
- name: Add Elasticsearch APT repository for Debian/Ubuntu
26+
apt_repository:
27+
repo: "deb {{ elastic_repo_url_apt }} stable main"
28+
state: present
3529
when: ansible_os_family == "Debian"
3630

3731
- name: Update APT cache for Debian/Ubuntu
@@ -73,6 +67,7 @@
7367
shell: |
7468
curl -s http://localhost:9200 | grep '"number"' | awk -F '"' '{print $4}'
7569
register: elasticsearch_version_output
70+
changed_when: false
7671

7772
- name: Display Elasticsearch version
7873
debug:

Ansible/elasticsearch/vars.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
elastic_version: "8" # 7 or 8
33
elastic_gpg_key: "https://artifacts.elastic.co/GPG-KEY-elasticsearch"
44
elastic_repo_url_apt: "https://artifacts.elastic.co/packages/{{ elastic_version }}.x/apt"
5-
elastic_repo_url_yum: "https://artifacts.elastic.co/packages/{{ elastic_version }}.x/yum"
5+
elastic_repo_url_yum: "https://artifacts.elastic.co/packages/{{ elastic_version }}.x/yum"

0 commit comments

Comments
 (0)