setup.sh 715 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. sudo apt update && sudo apt upgrade -y
  3. sudo apt install software-properties-common
  4. sudo apt-add-repository ppa:ansible/ansible
  5. sudo apt update
  6. sudo apt install ansible -y
  7. sudo mkdir -p /opt/ansible
  8. sudo chown $USER:$GROUP /opt/ansible/
  9. wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py -P /opt/ansible/
  10. wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini -P /opt/ansible/
  11. sudo apt install python-pip
  12. pip install boto
  13. mkdir -p ~/.aws/
  14. cat << EOF >> ~/.aws/credentials
  15. [default]
  16. aws_access_key_id = <your_key_id>
  17. aws_secret_access_key = <your_secret_key>
  18. EOF
  19. chmod +x /opt/ansible/ec2.py
  20. export ANSIBLE_INVENTORY=/opt/ansible/ec2.py