On Tue, 10 Feb 2015 09:27 -0800, [email protected] wrote:
> roles:
> - role: infra/internal/vmware/Host --> this
> role create vmware guest by clonning and return {{
> provisionning_temporary_ip }}
>
> post_tasks:
> - name: add_host in memory
> local_action:
> module: add_host
> hostname: "{{ inventory_hostname }}"
> ansible_ssh_host: "{{ provisionning_temporary_ip }}"
> groups: hostsInProvisionningNetwork
>
>
> - name: Configure/Check Network (OS / Infra)
> hosts: hostsInProvisionningNetwork
> gather_facts: ---> ( when true : Error SSH can't
> connect at "GATHERING FACTS" step )
> ( when false: SSH error on
> first tasks who try to connect ) lost
> information of ansible_ssh_host set
>
> roles:
> - role: os/network
Personally I wouldn't do this with roles, at least not for the
provisioning phase.
I haven't worked with the vsphere_guest module yet, but my suggestion is
to have 2 plays in your playbook: first provision, add the new VM to
your group, then a second play to configure the hosts (and apply roles).
---
- name: provision servers
gather_facts: no
hosts: localhost
tasks:
- name: provision server
vsphere_guest: .....
register: new_guest
- name: show properties
debug:
var: new_guest
- name: add to group
add_host:
name: {{ name from new_guest }}
groups: provision_group
- name: configure servers
gather_facts: yes
hosts: provision_group
sudo: yes
roles: ...
tasks: ...
Giovanni
--
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/1423823281.4022363.227043393.00B6BFAF%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.