Thanks a lot  . I am able to overcome it .
I was missing the   indent after the add_host earlier for the second task 
and now I can .

On Wednesday, June 14, 2023 at 6:18:25 PM UTC+5:30 Dick Visser wrote:

>
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/add_host_module.html
>
> On Wed, 14 Jun 2023 at 14:33, Veera <[email protected]> wrote:
>
>> Hi,
>>
>> I have a  playbook book with 2 tasks in it .
>> In the first tasks, I have playbooks to create a VM  and  build OS  on 
>> it  and  able to login  to the VM manually (for testing)  , and the final 
>> play creates a temporary  inventory file like below.
>>
>> [dev-vm1]
>> mytestvm1 ansible_ssh_private_key_file: mykey.pem   ansible_ssh_user: 
>> "root" ansible_ssh_extra_args: '-o StrictHostKeyChecking=no'
>>
>> the second tasks has a bunch of plays which needs to login to the 
>> mytestvm1(using the temp inventory file)above and execute  .
>>
>> I have a main.yml like this 
>>
>> - name: main.play
>>   hosts: localhost
>>   tasks:
>>       play1:
>>       play2:
>>       play3
>>
>> - hosts:  dev-vm1    
>>   become: true 
>>   gather_facts: true 
>>   tasks: 
>>        play1:
>>        play2:
>>        play2
>> ####################################
>> I don't want to 
>>    - split them into 2 separate  playbooks
>>     - run with  -i inventory file 
>>
>> want to pass the inventory directly to be processed by the second play ...
>>     
>>
>>
>>
>>
>>
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/f94670a3-f141-49ab-94ad-7c1cdd8e3fdan%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/f94670a3-f141-49ab-94ad-7c1cdd8e3fdan%40googlegroups.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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6a346b6e-8442-4061-9836-4ab890d61cf7n%40googlegroups.com.

Reply via email to