Skip to content
forked from ansible/ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.

License

Notifications You must be signed in to change notification settings

C2Devel/ansible

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

K2 Cloud Ansible Dynamic Inventory

K2 Cloud Ansible Dynamic Inventory is a scripts for managing your cloud infrastructure dynamically.

Setup

Preparing software

  1. git clone ${THIS_REPO_URL}
  2. cd ${THIS_REPO_NAME}
  3. python3.6 -m venv .venv
  4. source .venv/bin/activate
  5. pip install -r requirements.txt

Setup credentials using AWS config

To use this inventory script please set up your credentials using ~/.aws/credentials file.

Add the following to your config:

[k2]
aws_access_key_id = <YOUR_ACCESS_KEY>
aws_secret_access_key = <YOUR_SECRET_KEY>

Now specify your aws profile using environment variables export AWS_PROFILE=k2. Or you can pass this variable before every command AWS_PROFILE=k2 ansbile-playbook ...

Setup credentials using ec2.ini

You can also specify your credentials locally.
For this modify contrib/inventory/ec2.ini file with:

aws_access_key_id = <YOUR_ACCESS_KEY>
aws_secret_access_key = <YOUR_SECRET_KEY>

Examples

All examples located in examples folder.

ansible-playbook

To execute playbook on instances marked with Tag web_server

playbook.yaml:

- hosts: tag_Name_web_server  
  connection: local
  gather_facts: false
  tasks:
    - name: Example
      command: time

Use command: ansible-playbook -i contrib/inventory/ec2.py playbook.yaml

ansible-inventory

To list all your hosts use
ansible-inventory --list -i contrib/inventory/ec2.py

About

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%