

Using Ansible ec2.py Directly
source link: https://fuzzyblog.io/blog/ansible/2019/05/18/using-ansible-ec2-py-directly.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Using Ansible ec2.py Directly
May 18, 2019
This is a shorty but it is incredibly useful when you need to diagnose Ansible weirdness.
Note: I know this is obvious but when you have used Ansible and AWS extensively, you get used to ec2.py just being a component to Ansible and you don’t even think about calling it directly.
We recently had a situation where all of our Ansible driven deploys were failing. And the reason for this wasn’t easy to diagnose because all of our deploys were wrapped up in fairly complex shell logic. What helped us sort it out was breaking the underlying Ansible execution pipeline apart and calling ec2.py directly. ec2.py is the open source bit that talks to an AWS environment and returns a massive data structure that represents the "inventory" of servers, volumes, network connections, etc.
Here’s the way to call ec2.py directly
AWS_ACCESS_KEY_ID=some_access_key AWS_SECRET_ACCESS_KEY=some_secret_key /etc/ansible/inventory/ec2.py
As long as your ec2.py is executable (and it damn well should be), this will return the normal giant JSON hash of data that represents your AWS environment. And if it doesn't return a giant JSON hash, well, then you know you have a problem.
Recommend
-
9
Ansible at Grofers (Part 3) — Managing EC2 Instances
-
5
Nibble Stew A gathering of development thoughts of Jussi Pakkanen. Some of you may know him as the creator of the Meson build...
-
5
NAKIVO Blog > Data Protection > Basics of Backing Up Amazon EC2 Instances with EC2 Snapshots...
-
8
Create an EC2 instance on AWS using Terraform In this article, we will see how to create an EC2 Instance using Terraform. Before proceeding, I assume that you are familiar with the basics of Terraform and AWS EC2 Instance. If you wa...
-
10
Reading Time: 4 minutes Introduction to Guacamole Hey readers, so today we will be looking into Guacamole and how can we connect to an AWS EC2 instance using Guacamole. Apache Guacamole is free and open-source software...
-
6
Introducing the New Console Home in AWS On January 12, 2022 AWS introduced a new user interface for the management console. Users can now access various services and features from the front pag...
-
1
AWS Using AWS EC2 to Deploy NodeJS and MongoDB Application ByAzzan...
-
4
How to create an EC2 instance in AWS using Ansible workflow Skip to main content...
-
5
How to create an EC2 instance in AWS using Ansible CLI Skip to main content ...
-
10
How to create an EC2 instance in AWS using Ansible automation Skip to main con...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK