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: []: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "failed": true, "module_stderr": "Shared connection to 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 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See for more information."]}}, "msg": "The following modules failed to execute: setup\n"}
Sep 21, 2020 in Ansible by akhtar
• 38,210 points

1 answer to this question.

0 votes


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
  - name: Install httpd
      name: httpd
      state: present
answered Sep 21, 2020 by MD
• 95,300 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
+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
+2 votes
1 answer
0 votes
1 answer