Let me post the playbook to help you understand it better
I have two playbooks 1: Install azure vm 2 install mongo db and tomcat I want to integrate both so first one send ip to second playbook and second play book does its job/ First playbook code is here: AzurePlaybook.yml -----All the other tasks---- azure_rm_publicipaddress: resource_group: Solutioning allocation_method: Static name: PublicIP register: output_ip_address - name: Include another playbook import_playbook: install_MongoDb_and_Tomcat.yml In Install MongoDB and Tomcat Playbook here is the code install_MongoDb_and_Tomcat.yml --- - name: install Mongo and Tomcat hosts: demo1 become: yes become_method: sudo # Set become method remote_user: azureuser # Update username for remote server vars: tomcat_ver: 9.0.30 # Tomcat version to install ui_manager_user: manager # User who can access the UI manager section only ui_manager_pass: Str0ngManagerP@ssw3rd # UI manager user password ui_admin_username: admin # User who can access bpth manager and admin UI sections ui_admin_pass: Str0ngAdminP@ssw3rd # UI admin password roles: - install_mongodb - mongo_post_install - install_tomcat - tomcat_post_install I have used import playbook and I want to pass the IP address instead of taking it from inventory file currently install_MongoDb_and_Tomcat.yml playboook taking it from hosts: demo1 which is declared in the inventory file On Saturday, June 5, 2021 at 6:36:37 AM UTC-4 Rajaniesh Kaushikk wrote: > I tried doing it but it did not worked because imported playbook still > taking the ip address from inventory file. > > On Sat, Jun 5, 2021, 1:59 AM Dick Visser <dick....@geant.org> wrote: > >> >> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/add_host_module.html >> >> >> On Sat, 5 Jun 2021 at 05:55, Rajaniesh Kaushikk <raja...@gmail.com> >> wrote: >> >>> I have developed the playbook which created a vm in azure(playbook name >>> is CreateAzureVM.yml) and I have another playbooks which Installs softwares >>> on the VM(install_software.yml). >>> >>> I have imported install_software.yml in the CreateAzureVM.yml playbook. >>> install_software.yml takes the host info from inventory file which contains >>> ansible_connection=ssh ansible_ssh_pass=XYZ ansible_host=IPaddressOfTheHost >>> >>> Now my requirement is that I want to pass the IP address of the newly >>> created machine to the Imported playbook so instead of taking the static IP >>> provided in the inventory it can take it dynamically from the >>> CreateAzureVM.yml. >>> >>> I already tried to update the inventory file but looks like updating the >>> inventory file in the middle of CreateAzureVM playbook does not help >>> because inventory file is already loaded and updating it afterward does not >>> help. >>> >>> Any quick help would be greatly appreciated. >>> >>> Regards >>> >>> Rajaniesh >>> >>> -- >>> 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-proje...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/b258177c-e912-4c61-9df0-1bf7c06bdad7n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ansible-project/b258177c-e912-4c61-9df0-1bf7c06bdad7n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> Sent from a mobile device - please excuse the brevity, spelling and >> punctuation. >> >> -- >> > You received this message because you are subscribed to a topic in the >> Google Groups "Ansible Project" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/ansible-project/9EUeAeApdUc/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> ansible-proje...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNfSEcC473SaxKrr1VgCCFaHoy-bRhBh%3DLpJCtZNjmQHg%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwNfSEcC473SaxKrr1VgCCFaHoy-bRhBh%3DLpJCtZNjmQHg%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/d0baa321-2c44-4a4a-9709-147efa341f4dn%40googlegroups.com.