Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scaleway instances template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
systemes-dinformation
alpha
pocs
Cloud Machinist
cloud machinist templates
scaleway instances template
Commits
275d9143
Commit
275d9143
authored
1 year ago
by
Nathan Rodet
Browse files
Options
Downloads
Patches
Plain Diff
script update
parent
b56a679a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#78833
failed
1 year ago
Stage: prepare
Stage: validate
Stage: build
Stage: deploy
Stage: destroy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+4
-16
4 additions, 16 deletions
.gitlab-ci.yml
scripts/build-ansible-hosts.sh
+4
-6
4 additions, 6 deletions
scripts/build-ansible-hosts.sh
scripts/hosts.yaml
+5
-0
5 additions, 0 deletions
scripts/hosts.yaml
with
13 additions
and
22 deletions
.gitlab-ci.yml
+
4
−
16
View file @
275d9143
...
...
@@ -3,7 +3,8 @@ default:
variables
:
ANSIBLE_ROOT
:
${CI_PROJECT_DIR}/ansible
HOST_FILE_PATH
:
${ANSIBLE_ROOT}/hosts.yaml
ANSIBLE_HOST_FILE_PATH
:
${CI_PROJECT_DIR}/ansible/hosts.yaml
SCRIPTS_ROOT
:
${CI_PROJECT_DIR}/scripts
TF_ROOT
:
${CI_PROJECT_DIR}/terraform
TF_ADDRESS
:
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${TF_STATE_NAME}
TF_STATE_NAME
:
${ENVIRONMENT}-update
...
...
@@ -33,21 +34,8 @@ ssh_key:
ansible_hosts_file
:
stage
:
prepare
script
:
-
ls
-
ls ${ANSIBLE_ROOT}
-
|+
# 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}
-
cat ${ANSIBLE_ROOT}/hosts.yaml
-
chmod +x ./${SCRIPTS_ROOT}/build-ansible-hosts.sh
-
./${SCRIPTS_ROOT}/build-ansible-hosts.sh
init
:
stage
:
prepare
...
...
This diff is collapsed.
Click to expand it.
scripts/build-ansible-hosts.sh
+
4
−
6
View file @
275d9143
#!/bin/bash
{
HOST_FILE_PATH
}=
$ANSIBLE_ROOT
/hosts.yaml
# Create hosts.yaml file with base configuration
echo
"instances:
hosts:"
>
$
{
HOST_FILE_PATH
}
echo
"instances:
"
>
$ANSIBLE_HOST_FILE_PATH
echo
"
hosts:"
>
>
$
ANSIBLE_
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
"
$ENVIRONMENT
-
$
i
.cma.alpha.grandlyon.com:"
>>
$
ANSIBLE_
HOST_FILE_PATH
done
\ No newline at end of file
This diff is collapsed.
Click to expand it.
scripts/hosts.yaml
0 → 100644
+
5
−
0
View file @
275d9143
instances
:
hosts
:
dev-0.cma.alpha.grandlyon.com
:
dev-1.cma.alpha.grandlyon.com
:
dev-2.cma.alpha.grandlyon.com
:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment