Ansible
Ansible is configuration management tool written in python.
Ansible is a simple IT automation system. It handles configuration management, application deployment, cloud provisioning, ad-hoc task execution, network automation, and multi-node orchestration. More information on the Ansible documentation.
Configure Ansible for AWS
Create an EC2 role with required permissions so Ansible can read EC2 system information via the AWS API. Attach this role to the EC2 instance where Ansible is installed.

Install Ansible on EC2 instance an prepare configuration files
ansible.cfg
[inventory]
enable_plugins = auto
[defaults]
inventory = eu-west-1.aws_ec2.yaml
deprecation_warnings = Falseaws_ec2.yaml
---
plugin: aws_ec2
regions:
- eu-west-1
filters:
instance-state-name : running
hostnames:
- tag:Nameeu-west-1.aws_ec2.yaml
Run ansible commands
Display the configured inventory as Ansible sees it.
Get Kernel information from all hosts
Configure Ansible for GCP
Create a Google Service Account with required permissions so Ansible can read GCP instance information via the API.

Install Ansible on GCP instance an prepare configuration files.
ansible.cfg
environment.gcp_compute.yaml
serviceaccount.json
Tagging / Grouping
When spinning up new EC2 or GCP instances add labels to each instance. Ansible will use this labels to create groups. When running ansible commands you can use this groups to execute commands only on a subset of servers.
Terraform Snippet for adding labels
Last updated