I'm trying to install elasticsearch from a "common" role but ansible can't find the package to install.
i'm getting the following error when i'm executing playbook:
failed: [vm1] (item=elasticsearch) => {
"ansible_facts": {
"pkg_mgr": "dnf"
},
"ansible_loop_var": "item",
"changed": false,
"failures": [
"No package elasticsearch available."
],
"item": "elasticsearch",
"rc": 1,
"results": []
}
MSG:
Failed to install some of the specified packages
Here's the code from the main.yml from tasks.
- name: install java
yum:
state: latest
update_cache: yes
with_items:
- default-jdk
- name: install elasticsearch rpm key
rpm_key:
key: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
become: true
- name: install elasticsearch 8.x rpm repository
yum_repository:
name: Elasticsearch repository for 8.x packages
description: Elasticsearch repository for 8.x packages
baseurl: https://artifacts.elastic.co/packages/8.x/yum
gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled: 0
become: true
- name: install elasticsearch 8.x
yum:
name: "{{ item }}"
state: present
update_cache: true
with_items:
- elasticsearch
become: true
- name: reload systemd config
systemd: daemon_reload=yes
- name: enable service elasticsearch and ensure it is not masked
systemd:
name: elasticsearch
enabled: yes
masked: no
In the vm i can that the in /etc/yum.repos.d/ the repo is being inserted normally.