It sounds like a Vagrant issue rather than an Ansible issue. Or possibly a
niche Vagrant provider problem.

Can you share a sample Vagrantfile that's not behaving as it should and
details of the target OS of the Vagrant host, and the virtualisation
provider you're using?


On Sat, 25 Nov 2023 at 19:30, Evan Hisey <ehi...@gmail.com> wrote:

> Already tried it and it does not work, which was why I explicitly
> referenced that behavior as not working as not working in this
> scenario.While vagrant can run playbooks at provisioning time. it does not
> really proivde a way to to control when the provisioin runs. All 3 hosts
> need to be up be for the first host can be provisioned since it requires
> the ips of the later hosts. Second option does not work, as the remote
> control node does not have access to the VMs, as mentioned. Which is what
> lead to the need to trigger a second playbook.  otherwise could lust load
> the vagrant generated inventory with add_host module.
>
> IC ould do some ugly sequencing of the "vagrant up --provision" from a
> playbook to control the ansible provisioning sequence of the vms, but I am
> trying to avoid using ugly shell commands as much as I can. If I  uses a
> shell  command I could also just trigger an ansible playbook that way, but
> feels wrong.
>
>
> On Sat, Nov 25, 2023 at 12:40 PM Will McDonald <wmcdon...@gmail.com>
> wrote:
>
>> Quickly skimming the Vagrant Ansible provisioner docs, isn't this
>> precisely the behaviour you're looking for:
>>
>>
>> https://developer.hashicorp.com/vagrant/docs/provisioning/ansible#ansible-parallel-execution
>>
>>     # Only execute once the Ansible provisioner,    # when all the machines 
>> are up and ready.
>>
>> So you would spin up all your Vagrant boxes from your control node, wait
>> for that to complete, template out a static inventory of your Vagrant boxes
>> then run your subsequent Vagrant Ansible provisioner automation?
>>
>>
>>
>> On Sat, 25 Nov 2023 at 18:20, Evan Hisey <ehi...@gmail.com> wrote:
>>
>>> I am working on a scenario where the first playbook executes commands on
>>> a remote host to create a vagrant host and spins up multiple vms. Vagrant
>>> can triggers it's own ansible provisioning runs but they are only single
>>> host aware and run when the host is provisioned. That does not work in this
>>> case, as I need all VM's running BEFORE the deployment playbook can be
>>> triggered. Added wrinkle is the VMs are accessible at this time from
>>> outside the vagrant host. If they were, I could simply import the vagrant
>>> host list into the controller inventory and refresh.
>>>
>>> Right now I am looking at  the possibility of using
>>> ansible.builtin.shell to trigger the new ansible-playbook command on the
>>> vagrant host to run the vagrant VM application configuration. But while
>>> this works it is not exactly ansible clean. Suggestions on approaches?
>>>
>>> --
>>> Evan Hisey
>>> ehi...@gmail.com
>>>
>>> --
>>> 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-project+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAEcFzYwsmYmvh%3DWJwSNmJWertkxFRDiKkumnwhzAFupggP58Vg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAEcFzYwsmYmvh%3DWJwSNmJWertkxFRDiKkumnwhzAFupggP58Vg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAKtKohS2LdL4qtTyQF8VdV6pu2tjL3mx868TgvkwvAEUkRbF%3Dg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAKtKohS2LdL4qtTyQF8VdV6pu2tjL3mx868TgvkwvAEUkRbF%3Dg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEcFzYxdk%3DfA13__d1wEJTiTkpDnaR2eqEpGm%2BXy3v3L1M%3DJ9A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEcFzYxdk%3DfA13__d1wEJTiTkpDnaR2eqEpGm%2BXy3v3L1M%3DJ9A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKtKohQ8PP4n7h-ERfE4iONYxZK-nZRLaoMwvRATzSj1hnD%3Dbw%40mail.gmail.com.

Reply via email to