try {{ inventory_hostname }}
Regards
Srini
On Wed, Feb 26, 2020 at 4:49 PM Vishal Bobade <[email protected]>
wrote:
> Hello ,
>
> I have a inventory file with some 5-6 hosts and I want use them in some of
> my tasks/main.yml file. Could some one please suggest how can I do that .
>
> Lets say below is my inventory file
>
> <inventory file>
>
> [gameday]grafana.domain.netgitlab.domain.netsonarqube.domain.netartifactory.domain.netprometheus.domain.net
>
>
>
> I want to use them in some shell script which is going to be run as a part of
> some tasks.
>
>
> for example below is some script where I want to replace
> "sonarqube.dummy.domain.net" this with the one in inventory file which is
> "sonarqube.domain.net"
>
>
> *shell script :*
>
>
> ---------------------------------------------->
>
> read -p "Enter a server name for Sonarqube : " SQ
>
> if [ -z "$SQ" ]; then
>
> echo "DNS name for sonarqube not provided, cannot proceed"
>
> exit 1
>
> else
>
> sed -i s/sonarqube.dummy.domain.net/$SQ/g /opt/sonarqube/*.json
>
> fi
>
> <---------------------------------------------
>
> --
> 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/915a168d-4b8f-4437-80e9-f45cf3af9d35%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/915a168d-4b8f-4437-80e9-f45cf3af9d35%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/CAG-N3P6ZN-f_mtUXzc3NjARCB3Na69Ad_tiYyj8hAZhLWo%2Bd5g%40mail.gmail.com.