File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed
Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 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
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 :
Original file line number Diff line number Diff line change 22elastic_version : " 8" # 7 or 8
33elastic_gpg_key : " https://artifacts.elastic.co/GPG-KEY-elasticsearch"
44elastic_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"
You can’t perform that action at this time.
0 commit comments