Jenkinsfile toegevoegd
This commit is contained in:
30
Jenkinsfile
vendored
Normal file
30
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
// Definieer de SSH credentials ID die in Jenkins is opgeslagen
|
||||
SSH_CREDENTIALS_ID = 'truenas-ssh-key'
|
||||
TRUENAS_HOST = '192.168.2.31' // Pas aan naar het IP-adres van de TrueNAS server
|
||||
SSH_USER = 'truenas-user' // Pas aan naar de SSH-gebruikersnaam
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Connect to TrueNAS') {
|
||||
steps {
|
||||
script {
|
||||
// Gebruik SSH-agent om een verbinding te maken
|
||||
sshagent([SSH_CREDENTIALS_ID]) {
|
||||
// Command uitvoeren op de TrueNAS server via SSH
|
||||
sh """
|
||||
ssh -o StrictHostKeyChecking=no ${SSH_USER}@${TRUENAS_HOST} << EOF
|
||||
echo "Verbinding succesvol met TrueNAS"
|
||||
hostname
|
||||
exit
|
||||
EOF
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user