opensearch-project / ansible-playbook

🤖 A community repository for Ansible Playbook of OpenSearch Project.
https://opensearch.org/
Apache License 2.0
81 stars 97 forks source link

[BUG] OpenSearch and Dashboards - User and Groups settings in systemd service file #30

Closed skevas closed 2 years ago

skevas commented 2 years ago

Describe the bug

Hard coded user and group in service templates dashboards.service and opensearch.service.

To Reproduce

-

Expected behavior

Use settings from inventories/opensearch/group_vars/all/all.yml

Playbook Name

Opensearch and Dashboards

Screenshots

-

Host/Environment (please complete the following information):

Any

Additional context

-

Solution

Add {{ os_group }} to inventories/opensearch/group_vars/all/all.yml and replace constants in service files with {{ os_user }} and {{ os_group }}. Further recommendation: Introduce {{ dashboards_user }} and {{ dashboards_groups }}

peterzhuamazon commented 2 years ago

@saravanan30erd any thoughts?

saravanan30erd commented 2 years ago

@skevas yes, we can use variables to provide user & group instead of hardcoded values. I will do it once ubuntu and amazon linux support PR is merged. @peterzhuamazon please change the label into enhancement as its not bug.

skevas commented 2 years ago

This is a bug if you are setting the os_user variable to anything but opensearch. In this case, systemd service will fail with something like "Failed to determine user credentials".

saravanan30erd commented 2 years ago

@skevas Agree, I completely missed the part that os_user used on user creation tasks, and not here. Will fix it.

peterzhuamazon commented 2 years ago

Changing the label without reading the last two comments, it is bug again after all 😅 @saravanan30erd as discussed the AL2 and Ubuntu changes are in, I will assign you as the owner of this issue for now.

Thanks.