Deploy application on a newly created AWS

26 views
Skip to first unread message

fara...@gmail.com

unread,
Dec 19, 2016, 3:17:19 PM12/19/16
to Ansible Project

I am creating an Ansible playbook that has two roles: one role that creates an AWS instance (from a pre-made AMI which includes Ansible), then another role that deploys Sonatype Nexus into that instance. I've tested the roles separately (and locally) to make sure they're working fine and they work as expected, however, my problem is figuring out how to deploy Nexus into that newly created instance.


Is my approach wrong (having two separate roles for this)? I need some guidance as I'm new to Ansible.


Thanks

fara...@gmail.com

unread,
Dec 19, 2016, 3:17:21 PM12/19/16
to Ansible Project

Arbab Nazar

unread,
Dec 20, 2016, 6:07:28 PM12/20/16
to Ansible Project
You need to make your playbook like this:

---
 - hosts: local
   connection: local
   gather_facts: no
   roles:
     - aws_instance_create_role

 - hosts: webserver # make this group during instance creation, take help from below mentioned links
   become: yes 
   remote_user: ubuntu (user in case of ubuntu instance)
   gather_facts: yes
   roles:
     - your_role_that_you_want_to_run


Hope that might help you
Reply all
Reply to author
Forward
0 new messages