Skip to content

Instantly share code, notes, and snippets.

@venoodkhatuva12
Forked from diegopacheco/ansible-aws.md
Created November 14, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venoodkhatuva12/e8f6f9a25109b05324d53a7533cb57e8 to your computer and use it in GitHub Desktop.
Save venoodkhatuva12/e8f6f9a25109b05324d53a7533cb57e8 to your computer and use it in GitHub Desktop.
How to Install Ansible on Amazon Linux / CentOS?
sudo su
yum update
yum install -y git
cd /usr/local/src
yum -y install git python-jinja2 python-paramiko PyYAML make MySQL-python
git clone git://github.com/ansible/ansible.git
cd ansible
git submodule update --init --recursive
make install
CTRL + D
sudo echo "[localhost]" > ~/ansible_hosts
sudo echo "localhost ansible_connection=local" >> ~/ansible_hosts
export ANSIBLE_INVENTORY=~/ansible_hosts
sudo vim /etc/ansible/hosts 
[127.0.0.1]
127.0.0.1 ansible_connection=local

[localhost]
127.0.0.1 ansible_connection=local
export AWS_ACCESS_KEY_ID='AK123'
export AWS_SECRET_ACCESS_KEY='abc123'

[test.yml]

---
- name: implicit localhost test...
  hosts: localhost
  tasks:
  - debug: msg="hello world" 
ansible-playbook test.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment