Inventory conversion from static to ec2

24 views
Skip to first unread message

Karthick Thanigaimani

unread,
Jan 6, 2019, 5:49:01 PM1/6/19
to ansible...@googlegroups.com
Hi,

We currently have our inventory as like below in the on-prem and we would like to convert this to an understandable format for Ec2 instances in the AWS cloud infrastructure.
the inventory is being referred using :
inventory: 'repo/inventory/dyn',

e.g. 
HOSTNAME1:
  dataip: IP1
  environment_id: development
  role: [componentname]


HOSTNAME2:
  dataip: IP2
  environment_id: development
  role: [component2]


Can someone help or guide on how to convert this to a ec2.py format so that when the code deployment happens via the jenkins, it can be done without much changes in the ansible code?

Thank you

Regards
Karthick

Karthick Thanigaimani

unread,
Jan 7, 2019, 3:34:25 PM1/7/19
to Karthick Thanigaimani, ansible...@googlegroups.com
Hi,

can someone help on this please.

Thank you



From: Karthick Thanigaimani <karthik.th...@gmail.com>
To: "ansible...@googlegroups.com" <ansible...@googlegroups.com>
Sent: Monday, 7 January 2019 9:46 AM
Subject: Inventory conversion from static to ec2

jegan...@gmail.com

unread,
Jan 7, 2019, 11:01:53 PM1/7/19
to Ansible Project
Do you want to write dynamic inventory script for you inventory. 

Does the inventory look  as like as below which you have shared else provide exact inventory sample.

Karthick Thanigaimani

unread,
Jan 8, 2019, 12:08:18 AM1/8/19
to ansible...@googlegroups.com
Hi,

yes, it does like the below that I have shared. from the current code of ansible playbook it is given like below for the execution but this doesnt work for the EC2 / AWS instances. 

ansiblePlaybook(
                            playbook: 'web.yml',
                            inventory: 'config/inventory/dyn',
                            credentialsId: "deploy",
                            sudo: true,
                            sudoUser: "root",
                            limit: limit,
                            colorized: true,
                            extras: extraParams
                    )



From: "jegan...@gmail.com" <jegan...@gmail.com>
To: Ansible Project <ansible...@googlegroups.com>
Sent: Tuesday, 8 January 2019 3:01 PM
Subject: [ansible-project] Re: Inventory conversion from static to ec2

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2864fe7e-6b4f-41bf-bcde-b92b61a8c323%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages