module stdout Please login as the user ec2-user rather than the user root r n r n msg MODULE FAILURE nSee stdout stderr for the exact error

0 votes

Hi Guys,

I m trying to connect to the EC2 instance using Ansible Playbook. But it is showing me the below error.

fatal: [3.7.248.36]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "failed": true, "module_stderr": "Shared connection to 3.7.248.36 closed.\r\n", "module_stdout": "Please login as the user \"ec2-user\" rather than the user \"root\".\r\n\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 0, "warnings": ["Platform unknown on host 3.7.248.36 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information."]}}, "msg": "The following modules failed to execute: setup\n"}
Sep 21, 2020 in Ansible by akhtar
• 38,260 points
3,802 views

1 answer to this question.

0 votes

Hi@akhtar,

You are trying to connect to your EC2 instance. But your playbook is trying to do SSH with root user. But your instance is expecting ec2-user as a username. So you need to set your remote_user=ec2-user in your playbook as shown below.

- hosts: all
  remote_user: ec2-user
  become: yes
  tasks:
  - name: Install httpd
    package:
      name: httpd
      state: present
answered Sep 21, 2020 by MD
• 95,460 points

Related Questions In Ansible

0 votes
1 answer

Error saying "msg: unsupported parameter for module: deb"

Hey @Laksha, I think an older version ...READ MORE

answered Feb 1, 2019 in Ansible by Ansiha
2,423 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,061 views
+2 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP