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
[gameday]
grafana.domain.net
gitlab.domain.net
sonarqube.domain.net
artifactory.domain.net
prometheus.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
<---------------------------------------------