Skip to content
GitLab
Explore
Sign in
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
Tags
v0.3.0
Tags containing commit
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:
# - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) && $CI_COMMIT_TAG
-
if
:
$CI_COMMIT_TAG
before_script
:
-
apt-get update
-
apt-get install ansible -y
# Use Gitlab protected variable to provide key
-
echo "$DEPLOY_KEY" > id_rsa
-
chmod 400 id_rsa
...
...
@@ -676,14 +678,15 @@ stages:
# Add ssh key to agent
-
eval $(ssh-agent)
-
ssh-add id_rsa
# Prevent error of ansible being run in world writeable directory
-
chmod o-w .
-
ansible --version
script
:
-
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 "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
:
extends
:
.base_deploy
variables
:
...
...
This diff is collapsed.
Click to expand it.
deploy/deploy.yml
+
18
−
12
View file @
90b5fa5b
...
...
@@ -13,15 +13,13 @@
failed_when
:
git_installed.rc not in [0,1]
register
:
git_installed
-
name
:
Register tango directory status
shell
:
cd ~/tango
shell
:
cd ~/
git/
tango
args
:
chdir
:
~
changed_when
:
false
failed_when
:
tango_directory.rc not in [0,1]
register
:
tango_directory
-
name
:
Register pending changes
changed_when
:
false
failed_when
:
pending_changes.rc not in [0,1]
shell
:
|
git status | grep Changes
ret=$?
...
...
@@ -31,8 +29,11 @@
fi
exit 0
args
:
chdir
:
~/tango
chdir
:
~/git/tango
changed_when
:
false
failed_when
:
pending_changes.rc not in [0,1]
register
:
pending_changes
-
debug
:
var=pending_changes
-
name
:
Check make installation status
fail
:
msg
:
"
Make
does
not
appear
to
be
installed!"
...
...
@@ -53,27 +54,32 @@
changed_when
:
false
shell
:
"
make
stop"
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
changed_when
:
false
shell
:
"
git
checkout
{{
station_version
}}"
args
:
chdir
:
~/tango
chdir
:
~/
git/
tango
-
name
:
Pull Images
changed_when
:
false
shell
:
"
make
pull"
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
-
name
:
Build Images
changed_when
:
false
shell
:
"
make
build"
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
-
name
:
Start Database
changed_when
:
false
shell
:
"
make
minimal"
args
:
chdir
:
~/tango/docker-compose
chdir
:
~/
git/
tango/docker-compose
-
name
:
Wait for databaseds
ansible.builtin.wait_for
:
port
:
10000
...
...
@@ -82,14 +88,14 @@
changed_when
:
false
shell
:
"
./sbin/load_ConfigDb.sh
CDB/LOFAR_ConfigDb.json"
args
:
chdir
:
~/tango/
chdir
:
~/
git/
tango/
-
name
:
Update Station Database Config
changed_when
:
false
shell
:
"
./sbin/load_ConfigDb.sh
CDB/stations/{{
station_config
}}"
args
:
chdir
:
~/tango/
chdir
:
~/
git/
tango/
-
name
:
Start Station
changed_when
:
false
shell
:
"
make
start"
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