123456789101112131415161718192021 |
- #!/bin/bash
- sudo apt update && sudo apt upgrade -y
- sudo apt install software-properties-common
- sudo apt-add-repository ppa:ansible/ansible
- sudo apt update
- sudo apt install ansible -y
- sudo mkdir -p /opt/ansible
- sudo chown $USER:$GROUP /opt/ansible/
- wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py -P /opt/ansible/
- wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini -P /opt/ansible/
- sudo apt install python-pip
- pip install boto
- mkdir -p ~/.aws/
- cat << EOF >> ~/.aws/credentials
- [default]
- aws_access_key_id = <your_key_id>
- aws_secret_access_key = <your_secret_key>
- EOF
- chmod +x /opt/ansible/ec2.py
- export ANSIBLE_INVENTORY=/opt/ansible/ec2.py
|