Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierChlouchloutte ¯\_(ツ)_/¯

Note: Jenkins - Ansible : Une ligne pour pinger une VM

26 mai 2020 à 15:55

Le Jenkinsfile utilisé :

pipeline {

    agent {
        node { label 'With-Ansible' }
    }

    environment {
        VM_CREDENTIALS = credentials('my-vm-credentials')
        VM_USER = "${VM_CREDENTIALS_USR}"
        VM_KEY = "${VM_CREDENTIALS_PSW}"

        HOST_NAME = "my-vm-host"
    }

    stages {

        stage('PING MACHINE') {
            steps {
                script {
                    println " ========== PING ${HOST_NAME} ========== "
                    sh "ansible all -i ${HOST_NAME}, -m ping -u ${VM_USER} --extra-vars=\"ansible_ssh_pass=${VM_KEY} ansible_connection=ssh ansible_port='22' ansible_ssh_common_args='-o StrictHostKeyChecking=no'\""
                }
            }
        }

    }

}

Il faut laisser la virgule :)
Permalien

❌
❌