2
votes

I have just started learning Ansible configuration management tool and I was going through Linux Academy tutorials to run implement ansible commands, everything was good and easy with the linux-academy servers but when I tried to replicate the same in AWS EC2 instance i was unable to locate the "cd /etc/ansible/hosts". I have installed ansible using pip command i.e., "$sudo pip install ansible". I have been tried to resolve the issue but unable to find any proper documentation. The links I tried to install and configure ansible are as follows:

http://docs.ansible.com/ansible/intro_installation.html

http://www.cyberciti.biz/python-tutorials/linux-tutorial-install-ansible-configuration-management-and-it-automation-tool/

Guide me to configure the ansible hosts path to run the ansible commands and playbooks according to my requirements.

2

2 Answers

1
votes

If you are using Ubuntu EC2 instance, follow this: http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu

If you are using Amazon Linux EC2 instance, follow this: http://docs.ansible.com/ansible/intro_installation.html#latest-release-via-yum

Installing via these package managers will create the /etc/ansible/hosts file for you.

0
votes

Steps to install Ansible on EC2 instance [RHEL-8]:

  1. sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

  2. sudo dnf config-manager --set-enabled codeready-builder-for-rhel-8-rhui-rpms

  3. dnf install ansible

  4. ansible --version

Use dnf for faster dependency resolution.