Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write an ansible playbook to automate the starting of ec2 instance.

Answer Posted / Sitesh Kumar

To start an EC2 instance using Ansible, you first need to set up an inventory file with your AWS credentials and the instance details. Here's a simple example of an Ansible playbook that starts an EC2 instance:nn```yamln- name: Start EC2 instancen hosts: my_ec2_instancesnn tasks:n - name: Wait for EC2 instance to be runningn amazon.aws.wait_for_instance:n instance_ids: '{{ instance_id }}'nn - name: Start the EC2 instancen amazon.aws.ec2: n region: us-west-2n instance_id: '{{ instance_id }}'n state: runningn register: ec2_startednn vars:n - name: instance_idn value: i-0123456789abcdef0

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I access shell environment variables?

3


What’s the use of ansible?

3


How would you access a variable of the first host in a group?

3


Compare ansible with chef.

3


Explain callback_plugin in ansible?

4


Enlist the differences between variable name and environment variables.

3


Does ansible support aws?

3


When should I use {{ }}?

2


How ansible different from the playbook?

3


How can one interpolate variables or dynamic variable names?

3


Explain different modules in ansible.

3


Suppose you’re using ansible to configure the production environment and your playbook uses an encrypted file. Encrypted files prompt the user to enter passwords. But since ansible is used for automation, can this process be automated?

3


Is ansible is an open source tool?

3


How to install ansible?

3


Give a comparison between ansible and puppet.

3