opensearch-project / ansible-playbook

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

[Enhancement]Support for ubuntu 20.04 #20

Closed frankbezema closed 2 years ago

frankbezema commented 2 years ago

Support for recent ubuntu distro

Describe the solution you'd like Be able to choose between different major linux distributions like ubuntu, centos7 also centos 8

Describe alternatives you've considered Using centos7 is not possible for some environments

Additional context Add any other context or screenshots about the feature request here.

saravanan30erd commented 2 years ago

@frankbezema Sure, we will add support for Ubuntu soon. But we don't have any plan for centos 8 as its EOL cut short on Dec 31, 2021. But Centos 7 have EOL until 2024. Additionally I am working on to support Amazon linux. https://www.centos.org/centos-linux-eol/

esencia commented 2 years ago

Hi, ¿How can I help you with 20.04/Debian Bullseye support?

skevas commented 2 years ago

I started porting this for myself today (Debian 11). I had no time to really test anything. Current status:

It looks as if most works out of the box. I ended up with a good looking output for curl "https://YOURIP:9200/_cluster/health?pretty" -u 'YOUR_ADMIN:YOUR_ADMIN_PASSWORD' -k

Problems:

saravanan30erd commented 2 years ago

@skevas currently I am testing with ubuntu 20.04 and applying some fixes which breaking few steps. Will post the PR soon.

saravanan30erd commented 2 years ago

@esencia PR is ready for ubuntu 20.04, please test it and provide the feedback.

esencia commented 2 years ago

Hi @saravanan30erd This task keeps failing, the command inside de node works ok, but not the task.

TASK [centos7/opensearch : Security Plugin configuration | Initialize the opensearch security index in opensearch] *******
fatal: [os1]: FAILED! => {"changed": true, "cmd": "bash /usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh -cacert /usr/share/opensearch/config/root-ca.pem -cert /usr/share/opensearch/config/admin.pem -key /usr/share/opensearch/config/admin.key -f /usr/share/opensearch/plugins/opensearch-security/securityconfig/internal_users.yml -nhnv -icl -h 10.200.128.211\n", "delta": "0:00:00.510980", "end": "2021-12-16 19:12:23.820238", "msg": "non-zero return code", "rc": 255, "start": "2021-12-16 19:12:23.309258", "stderr": "", "stderr_lines": [], "stdout": "Security Admin v7\nWill connect to 10.200.128.211:9300\nERR: Seems there is no OpenSearch running on 10.200.128.211:9300 - Will exit", "stdout_lines": ["Security Admin v7", "Will connect to 10.200.128.211:9300", "ERR: Seems there is no OpenSearch running on 10.200.128.211:9300 - Will exit"]}

And this task supposed that curl it's present in the system. It needs to be installed from one playbook before as requirement.

TASK [centos7/opensearch : Check the opensearch status] ******************************************************************
[WARNING]: Consider using the get_url or uri module rather than running 'curl'.  If you need to use command because
get_url or uri is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in
ansible.cfg to get rid of this message.

One last thing:

Why don't use specific ansible modules for: unarchive, templating, sudo with become, etc... ?

Hope it helps.

Tested on latest Ubuntu 18.04.03 LTS / 64bits.

skevas commented 2 years ago

Hi @saravanan30erd This task keeps failing, the command inside de node works ok, but not the task.

TASK [centos7/opensearch : Security Plugin configuration | Initialize the opensearch security index in opensearch] *******
fatal: [os1]: FAILED! => {"changed": true, "cmd": "bash /usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh -cacert /usr/share/opensearch/config/root-ca.pem -cert /usr/share/opensearch/config/admin.pem -key /usr/share/opensearch/config/admin.key -f /usr/share/opensearch/plugins/opensearch-security/securityconfig/internal_users.yml -nhnv -icl -h 10.200.128.211\n", "delta": "0:00:00.510980", "end": "2021-12-16 19:12:23.820238", "msg": "non-zero return code", "rc": 255, "start": "2021-12-16 19:12:23.309258", "stderr": "", "stderr_lines": [], "stdout": "Security Admin v7\nWill connect to 10.200.128.211:9300\nERR: Seems there is no OpenSearch running on 10.200.128.211:9300 - Will exit", "stdout_lines": ["Security Admin v7", "Will connect to 10.200.128.211:9300", "ERR: Seems there is no OpenSearch running on 10.200.128.211:9300 - Will exit"]}

The pause for 3 seconds ("Pause for 3 seconds to provide sometime for OpenSearch start") is too short.

One last thing:

Why don't use specific ansible modules for: unarchive, templating, sudo with become, etc... ?

I had the same question.

saravanan30erd commented 2 years ago

Tested on latest Ubuntu 18.04.03 LTS / 64bits.

In this issue, just focused on Ubuntu 20.04 so the issues are fixed only for 20.04.

The pause for 3 seconds ("Pause for 3 seconds to provide sometime for OpenSearch start") is too short.

Instead of pause 3 seconds, I will add wait for OS service.

Why don't use specific ansible modules for: unarchive, templating, etc

I am trying to support various linux distributions within same playbook, instead of creating separate playbooks which requires more maintenance. Even I am trying to use inbuilt ansible modules for tasks wherever its possible without any duplication for different distributions. Example, Ubuntu 20.04 comes with python3 by default, Centos7/RHEL7 still uses python2.7 so some inbuilt modules requires dependency python packages which we may need to install it for some distro but not all. I am trying to avoid those steps by using common linux commands to support all distro for these scenarios.

I think we are using templates wherever its possible. sample: https://github.com/opensearch-project/ansible-playbook/blob/main/roles/centos7/opensearch/defaults/main.yml