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] sudo: a password is required #45

Closed patsevanton closed 2 years ago

patsevanton commented 2 years ago

Describe the bug sudo: a password is required

Run Playbook

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

Inventory

master0 ansible_host=xxxxx ip=192.168.10.34 roles=master,ingest
data0 ansible_host=xxxxx ip=192.168.10.26 roles=data
data1 ansible_host=xxxxx ip=192.168.10.19 roles=data
dashboard0 ansible_host=xxxxx ip=192.168.10.18

[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 : Security Plugin configuration | Create local temporary directory for certificates generation] *******************************************************************
Friday 01 April 2022  11:54:03 +0600 (0:00:01.821)       0:00:15.542 **********
fatal: [master0 -> localhost]: FAILED! => changed=false
  module_stderr: |-
    sudo: a password is required
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

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)"
peterzhuamazon commented 2 years ago

Did you exchange keys for your local to ssh to host with root? This ansible playbook only runs on root. Didnt try other users tho but if you use anything that is not root you need to have nopassed sudo permission for that user.

cc: @saravanan30erd

saravanan30erd commented 2 years ago

@patsevanton As @peterzhuamazon said, we tested this playbook only with root user. I can see you ran with some user which have sudo privileges and faced some error, fixed issue. We will check and test the PR. Thanks