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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
29868f87
Commit
29868f87
authored
Oct 26, 2022
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-983
: Partial Ansible Deploy
parent
c3039043
Branches
Branches containing commit
No related tags found
1 merge request
!469
L2SS-983: Deployment through environments and ansible
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
.gitlab-ci.yml
+16
-2
16 additions, 2 deletions
.gitlab-ci.yml
deploy/ansible.cfg
+3
-0
3 additions, 0 deletions
deploy/ansible.cfg
deploy/deploy.yml
+47
-0
47 additions, 0 deletions
deploy/deploy.yml
with
69 additions
and
2 deletions
.gitignore
+
3
−
0
View file @
29868f87
...
@@ -27,5 +27,8 @@ tangostationcontrol/docs/build
...
@@ -27,5 +27,8 @@ tangostationcontrol/docs/build
**/pending_log_messages.db
**/pending_log_messages.db
**/.eggs
**/.eggs
deploy/*.retry
deploy/hosts
docker-compose/alerta-web/alerta-secrets.json
docker-compose/alerta-web/alerta-secrets.json
docker-compose/tmp
docker-compose/tmp
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
16
−
2
View file @
29868f87
...
@@ -668,14 +668,28 @@ stages:
...
@@ -668,14 +668,28 @@ stages:
rules
:
rules
:
# - 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
:
# Use Gitlab protected variable to provide key
-
echo "$DEPLOY_KEY" > id_rsa
-
chmod 400 id_rsa
-
ssh-keygen -y -f id_rsa > id_rsa.pub
# 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 .
script
:
script
:
-
echo "start"
-
echo "Deploying version $CI_COMMIT_TAG"
-
echo "ssh $DEPLOY_USER @ $DEPLOY_HOST"
-
cd deploy || exit
1
-
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
.deploy_l2ts_base
:
.deploy_l2ts_base
:
extends
:
.base_deploy
extends
:
.base_deploy
variables
:
variables
:
DEPLOY_USER
:
$L2TS_USERNAME
DEPLOY_USER
:
$L2TS_USERNAME
DEPLOY_HOST
:
$L2TS_HOSTNAME
DEPLOY_HOST
:
$L2TS_HOSTNAME
DEPLOY_KEY
:
$L2TS_DEPLOY_KEY
deploy_l2ts_stop
:
deploy_l2ts_stop
:
extends
:
.deploy_l2ts_base
extends
:
.deploy_l2ts_base
environment
:
environment
:
...
...
This diff is collapsed.
Click to expand it.
deploy/ansible.cfg
0 → 100644
+
3
−
0
View file @
29868f87
[defaults]
host_key_checking
=
False
inventory
=
hosts
This diff is collapsed.
Click to expand it.
deploy/deploy.yml
0 → 100644
+
47
−
0
View file @
29868f87
---
-
name
:
StationControl Early Deployment
hosts
:
all
tasks
:
-
name
:
Register git installation status
command
:
which git
changed_when
:
false
failed_when
:
git_installed.rc not in [0,1]
register
:
git_installed
-
name
:
Register tango directory status
shell
:
cd ~/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=$?
echo $ret
if [ $ret -eq 0 ]; then
exit 1
fi
exit 0
args
:
chdir
:
~/tango
register
:
pending_changes
-
name
:
Check git installation status
fail
:
msg
:
"
Git
does
not
appear
to
be
installed!"
when
:
git_installed.rc not in [0]
-
name
:
Check tango directory status
fail
:
msg
:
"
Tango
directory
appears
to
be
missing!"
when
:
tango_directory.rc not in [0]
-
name
:
Check pending changes
fail
:
msg
:
"
Deployment
repository
seems
to
have
pending
changes!"
when
:
pending_changes not in [0]
-
name
:
Update sources
changed_when
:
false
shell
:
"
git
checkout
v{{
station_version
}}"
args
:
chdir
:
~/tango
\ No newline at end of file
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