Skip to content
Snippets Groups Projects
Commit b56a679a authored by Nathan Rodet's avatar Nathan Rodet
Browse files

reworked script

parent 2d53a9c7
No related branches found
No related tags found
No related merge requests found
Pipeline #78821 failed
......@@ -35,11 +35,15 @@ ansible_hosts_file:
script:
- ls
- ls ${ANSIBLE_ROOT}
- echo "instances:" > ${HOST_FILE_PATH}
- cat ${HOST_FILE_PATH}
- echo " hosts:" >> ${HOST_FILE_PATH}
- cat ${HOST_FILE_PATH}
- echo "$(for ((i=0; i<=${TF_VAR_INSTANCE_COUNT}; i++)); do echo " ${TF_VAR_ENVIRONMENT}-${i}.cma.alpha.grandlyon.com:"; done)" >> ${HOST_FILE_PATH}
- |+
# Create hosts.yaml file with base configuration
echo "instances: " > ${HOST_FILE_PATH}
echo " hosts:" >> ${HOST_FILE_PATH}
# Add host url for each instance
for ((i=0; i<=${TF_VAR_INSTANCE_COUNT}; i++)); do
echo " ${TF_VAR_ENVIRONMENT}-${i}.cma.alpha.grandlyon.com:" >> ${HOST_FILE_PATH}
done
- cat ${HOST_FILE_PATH}
- ls
- ls ${ANSIBLE_ROOT}
......
#!/bin/bash
HOST_FILE_PATH=$ANSIBLE_ROOT/hosts.yaml
{HOST_FILE_PATH}=$ANSIBLE_ROOT/hosts.yaml
# Create hosts.yaml file with base configuration
echo "instances:
hosts:" > $HOST_FILE_PATH
hosts:" > ${HOST_FILE_PATH}
# Add host url for each instance
for ((i=0; i<=$TF_VAR_INSTANCE_COUNT; i++)); do
echo " $TF_VAR_ENVIRONMENT-${i}.cma.alpha.grandlyon.com:" >> $HOST_FILE_PATH
for ((i=0; i<=${TF_VAR_INSTANCE_COUNT}; i++)); do
echo " ${TF_VAR_ENVIRONMENT}-${i}.cma.alpha.grandlyon.com:" >> ${HOST_FILE_PATH}
done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment