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][ansible-playbook] conflicting variable name used in different roles #141

Open
MattBianco opened this issue Sep 8, 2023 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@MattBianco
Copy link

MattBianco commented Sep 8, 2023

Describe the bug
Variable os_plugin_bin_path is used for different purposes in the dashboards role and the opensearch role.
For the dashboards plays, it's intended to point to the opensearch-dashboards-plugin executable, whilst for the opensearch plays, it should point to the opensearch-plugin executable.

This means that you're basically forced to install everything under /usr/share/ (unless you want to clone the repo twice, and maintain separate trees for opensearch and for opensearch-dashboards),
or to edit the ./roles/linux/dashboards/defaults/main.yml and ./roles/linux/opensearch/defaults/main.yml separately for your custom settings.

I would expect ./inventories/opensearch/group_vars/all/all.yml to be the place for custom overrides of the defaults ?

To Reproduce
Steps to reproduce the behavior:

  1. Clone the ansible-playbook repository
  2. Tweak inventories/opensearch/group_vars/all/all.yml to your liking, adding something like this to the bottom:
iac_enable: true
os_home: /opt/opensearch
os_conf_dir: /opt/opensearch/config
  1. Add some hosts to the inventory, with at least 1 dashboards host and at least 1 os-cluster host
  2. Run the playbook according to README.md
  3. See the task TASK [linux/opensearch : Security Plugin configuration | Initialize the opensearch security index in opensearch with default configs] ***** fail with:
bash: /usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh: No such file or directory
  1. Add to inventories/opensearch/group_vars/all/all.yml:
os_plugin_bin_path: /opt/opensearch/bin/opensearch-plugin
os_sec_plugin_conf_path: /opt/opensearch/config/opensearch-security
os_sec_plugin_tools_path: /opt/opensearch/plugins/opensearch-security/tools
  1. Run the playbook again, like in step 5.
  2. See the task TASK [linux/dashboards : Get all the installed dashboards plugins] fail
    with sudo: /opt/opensearch/bin/opensearch-plugin: command not found.

Expected behavior
I expected it to be possible to install opensearch-dashboards with this playbook, even with opensearch data/master data installed on it's own file system mounted somewhere else than underneath /usr/share/.

Playbook Name
opensearch.yml

Role name
linux/dashboards

Screenshots

TASK [linux/dashboards : Get all the installed dashboards plugins] ************************************************************************
fatal: [dashboards-hostname]: FAILED! => {"changed": true, "cmd": ["sudo", "-u", "opensearch-dashboards", "/opt/opensearch/bin/opensearch-plugin", "list"], "delta": "0:00:00.018502", "end": "2023-09-08 12:24:12.839548", "msg": "non-zero return code", "rc": 1, "start": "2023-09-08 12:24:12.821046", "stderr": "sudo: /opt/opensearch/bin/opensearch-plugin: command not found", "stderr_lines": ["sudo: /opt/opensearch/bin/opensearch-plugin: command not found"], "stdout": "", "stdout_lines": []}

Host/Environment (please complete the following information):

  • Ansible Version: 2.14.5
  • Playbook Version: commit 1b9c5f9
@MattBianco MattBianco added bug Something isn't working untriaged labels Sep 8, 2023
@MattBianco
Copy link
Author

MattBianco commented Sep 8, 2023

I think it would perhaps be better to extrapolate the binaries' paths from os_home and os_dashboards_home instead of having a dedicated variable with the pathname of the plugin executable?
Possibly even deducing "everything" from os_home, such as configs, tools, etc.

And /usr/share/ is a very strange location for storing changing, node-specific, data, by the way...

@peterzhuamazon peterzhuamazon added the good first issue Good for newcomers label Sep 13, 2023
@Divyaasm
Copy link
Contributor

Divyaasm commented Oct 10, 2023

Hi @MattBianco, please feel free to contribute for the issue. Thanks

@peterzhuamazon
Copy link
Member

Probably changing os_plugin_bin_path to os_dashboards_plugin_bin_path is better?

@bbarani
Copy link
Member

bbarani commented Jan 22, 2024

@peterzhuamazon @MattBianco Do you have any updates?

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