Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
90b5fa5b
Commit
90b5fa5b
authored
2 years ago
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-983
: Install ansible in gitlab-ci
parent
0c6d815e
No related branches found
No related tags found
1 merge request
!469
L2SS-983: Deployment through environments and ansible
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+7
-4
7 additions, 4 deletions
.gitlab-ci.yml
deploy/deploy.yml
+18
-12
18 additions, 12 deletions
deploy/deploy.yml
with
25 additions
and
16 deletions
.gitlab-ci.yml
+
7
−
4
View file @
90b5fa5b
...
@@ -669,6 +669,8 @@ stages:
...
@@ -669,6 +669,8 @@ stages:
# - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) && $CI_COMMIT_TAG
# - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) && $CI_COMMIT_TAG
-
if
:
$CI_COMMIT_TAG
-
if
:
$CI_COMMIT_TAG
before_script
:
before_script
:
-
apt-get update
-
apt-get install ansible -y
# Use Gitlab protected variable to provide key
# Use Gitlab protected variable to provide key
-
echo "$DEPLOY_KEY" > id_rsa
-
echo "$DEPLOY_KEY" > id_rsa
-
chmod 400 id_rsa
-
chmod 400 id_rsa
...
@@ -676,14 +678,15 @@ stages:
...
@@ -676,14 +678,15 @@ stages:
# Add ssh key to agent
# Add ssh key to agent
-
eval $(ssh-agent)
-
eval $(ssh-agent)
-
ssh-add id_rsa
-
ssh-add id_rsa
# Prevent error of ansible being run in world writeable directory
-
ansible --version
-
chmod o-w .
script
:
script
:
-
echo "Deploying version $CI_COMMIT_TAG"
-
echo "Deploying version $CI_COMMIT_TAG"
-
cd deploy || exit
1
-
cd deploy
# Prevent error of ansible being run in world writeable directory
-
chmod o-w .
-
echo "[all]" > hosts
-
echo "[all]" > hosts
-
echo "stat ansible_host=$DEPLOY_HOST ansible_user=$DEPLOY_USER" >> hosts
-
echo "stat ansible_host=$DEPLOY_HOST ansible_user=$DEPLOY_USER" >> hosts
-
ansible-playbook deploy.yml --extra-vars station_version=$CI_COMMIT_TAG --extra-vars station_config=CS001_ConfigDb.json
-
ansible-playbook
-v
deploy.yml --extra-vars station_version=$CI_COMMIT_TAG --extra-vars station_config=CS001_ConfigDb.json
.deploy_l2ts_base
:
.deploy_l2ts_base
:
extends
:
.base_deploy
extends
:
.base_deploy
variables
:
variables
:
...
...
This diff is collapsed.
Click to expand it.
deploy/deploy.yml
+
18
−
12
View file @
90b5fa5b
...
@@ -13,15 +13,13 @@
...
@@ -13,15 +13,13 @@
failed_when
:
git_installed.rc not in [0,1]
failed_when
:
git_installed.rc not in [0,1]
register
:
git_installed
register
:
git_installed
-
name
:
Register tango directory status
-
name
:
Register tango directory status
shell
:
cd ~/tango
shell
:
cd ~/
git/
tango
args
:
args
:
chdir
:
~
chdir
:
~
changed_when
:
false
changed_when
:
false
failed_when
:
tango_directory.rc not in [0,1]
failed_when
:
tango_directory.rc not in [0,1]
register
:
tango_directory
register
:
tango_directory
-
name
:
Register pending changes
-
name
:
Register pending changes
changed_when
:
false
failed_when
:
pending_changes.rc not in [0,1]
shell
:
|
shell
:
|
git status | grep Changes
git status | grep Changes
ret=$?
ret=$?
...
@@ -31,8 +29,11 @@
...
@@ -31,8 +29,11 @@
fi
fi
exit 0
exit 0
args
:
args
:
chdir
:
~/tango
chdir
:
~/git/tango
changed_when
:
false
failed_when
:
pending_changes.rc not in [0,1]
register
:
pending_changes
register
:
pending_changes
-
debug
:
var=pending_changes
-
name
:
Check make installation status
-
name
:
Check make installation status
fail
:
fail
:
msg
:
"
Make
does
not
appear
to
be
installed!"
msg
:
"
Make
does
not
appear
to
be
installed!"
...
@@ -53,27 +54,32 @@
...
@@ -53,27 +54,32 @@
changed_when
:
false
changed_when
:
false
shell
:
"
make
stop"
shell
:
"
make
stop"
args
:
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/git/tango/docker-compose
-
name
:
Git Fetch All
changed_when
:
false
shell
:
"
git
fetch
--all"
args
:
chdir
:
~/git/tango
-
name
:
Update Sources
-
name
:
Update Sources
changed_when
:
false
changed_when
:
false
shell
:
"
git
checkout
{{
station_version
}}"
shell
:
"
git
checkout
{{
station_version
}}"
args
:
args
:
chdir
:
~/tango
chdir
:
~/
git/
tango
-
name
:
Pull Images
-
name
:
Pull Images
changed_when
:
false
changed_when
:
false
shell
:
"
make
pull"
shell
:
"
make
pull"
args
:
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
-
name
:
Build Images
-
name
:
Build Images
changed_when
:
false
changed_when
:
false
shell
:
"
make
build"
shell
:
"
make
build"
args
:
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
-
name
:
Start Database
-
name
:
Start Database
changed_when
:
false
changed_when
:
false
shell
:
"
make
minimal"
shell
:
"
make
minimal"
args
:
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
-
name
:
Wait for databaseds
-
name
:
Wait for databaseds
ansible.builtin.wait_for
:
ansible.builtin.wait_for
:
port
:
10000
port
:
10000
...
@@ -82,14 +88,14 @@
...
@@ -82,14 +88,14 @@
changed_when
:
false
changed_when
:
false
shell
:
"
./sbin/load_ConfigDb.sh
CDB/LOFAR_ConfigDb.json"
shell
:
"
./sbin/load_ConfigDb.sh
CDB/LOFAR_ConfigDb.json"
args
:
args
:
chdir
:
~/tango/
chdir
:
~/
git/
tango/
-
name
:
Update Station Database Config
-
name
:
Update Station Database Config
changed_when
:
false
changed_when
:
false
shell
:
"
./sbin/load_ConfigDb.sh
CDB/stations/{{
station_config
}}"
shell
:
"
./sbin/load_ConfigDb.sh
CDB/stations/{{
station_config
}}"
args
:
args
:
chdir
:
~/tango/
chdir
:
~/
git/
tango/
-
name
:
Start Station
-
name
:
Start Station
changed_when
:
false
changed_when
:
false
shell
:
"
make
start"
shell
:
"
make
start"
args
:
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
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