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

https://github.com/edx/configuration/blob/master/playbooks/roles/launch_ec2/tasks/main.yml#L84
https://github.com/arbabnazar/ansible-aws-vpc-ha-wordpress/blob/master/aws/tasks/webserver.yml#L66

Hope that might help you

On Monday, December 19, 2016 at 3:17:19 PM UTC-5, [email protected] wrote:
>
> 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
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8dcef29c-fae2-4f5f-ba69-90b0108ff835%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to