Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][opensearch]The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'roles' #49

Open
patsevanton opened this issue Apr 7, 2022 · 8 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@patsevanton
Copy link
Contributor

Describe the bug
The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'roles'

Run playbook

git clone https://github.com/opensearch-project/ansible-playbook.git opensearch-project
ansible-playbook -vvv -i host.ini opensearch-project/opensearch.yml -b

Inventory

master0 ansible_host=51.250.110.211 ip=192.168.10.5 roles=master,ingest
data0 ansible_host=51.250.103.164 ip=192.168.10.18 roles=data
data1 ansible_host=51.250.103.114 ip=192.168.10.19 roles=data
dashboard0 ansible_host=51.250.100.220 ip=192.168.10.14

[os-cluster]
master0
data0
data1
dashboard0

[master]
master0

[dashboard]
dashboard0

[all:vars]
ansible_user=ubuntu
ansible_ssh_private_key_file=~/.ssh/id_rsa
domain_name=opensearch.local
os_download_url=https://artifacts.opensearch.org/releases/bundle/opensearch
os_version=1.3.0
os_user=opensearch
cluster_type=multi-node
os_cluster_name=opensearch
xms_value=8
xmx_value=8

error:

TASK [linux/opensearch : OpenSearch Install | Copy Configuration File]
************************************************************************
fatal: [dashboard0]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'roles'

    The error appears to be in '/home/user/github/infrastructure-as-a-code-example/opensearch-cluster/opensearch-project/roles/linux/opensearch/tasks/opensearch.yml': line 28, column 3, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:


    - name: OpenSearch Install | Copy Configuration File
      ^ here

Version

ansible [core 2.12.2]
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]

Server where ansible

cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"

Remote server

cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
@patsevanton patsevanton added the bug Something isn't working label Apr 7, 2022
@patsevanton
Copy link
Contributor Author

patsevanton commented Apr 22, 2022

@saravanan30erd
Could you share inventory and playbook for multiple node setup ? Thanks

@saravanan30erd
Copy link
Collaborator

@patsevanton Actually I am using same configuration as it is.
https://github.com/opensearch-project/ansible-playbook/blob/main/inventories/opensearch/group_vars/all/all.yml

only change I am doing is, editing the host file for updating the nodes IP address details, thats all.
https://github.com/opensearch-project/ansible-playbook/blob/main/inventories/opensearch/hosts

It works fine, you can refer logs here

@patsevanton
Copy link
Contributor Author

wait merge #51 for full test this issue

@peterzhuamazon
Copy link
Member

wait merge #51 for full test this issue

Hi @patsevanton that PR is merged now you can test again.
Thanks.

@patsevanton
Copy link
Contributor Author

patsevanton commented May 2, 2022

But opensearch-multi-node.yml have code:

node.roles: [{{ hostvars[inventory_hostname]['roles'] }}]

In this PR https://github.com/opensearch-project/ansible-playbook/pull/13/files

inventories/opensearch/hosts
without dashboard

quiestion:
Is dashboard0 requirenment roles or not?

@peterzhuamazon
Copy link
Member

But opensearch-multi-node.yml have code:

node.roles: [{{ hostvars[inventory_hostname]['roles'] }}]

In this PR https://github.com/opensearch-project/ansible-playbook/pull/13/files

inventories/opensearch/hosts without dashboard

quiestion: Is dashboard0 requirenment roles or not?

@saravanan30erd

@ssi444
Copy link
Contributor

ssi444 commented Jun 29, 2022

@patsevanton remove item "dashboard0" from "[os-cluster]"

[os-cluster]
master0
data0
data1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

4 participants