// Jenkins Pipeline для AnsibleLab // Автор: Сергей Антропов // Сайт: https://devops.org.ru pipeline { agent any environment { ANSIBLE_FORCE_COLOR = 'true' DOCKER_TLS_CERTDIR = '' } stages { stage('Checkout') { steps { checkout scm } } stage('Install Dependencies') { steps { sh ''' pip install --upgrade pip pip install molecule[docker] ansible-lint ansible-galaxy collection install -r requirements.yml ''' } } stage('Lint') { steps { sh 'ansible-lint molecule/universal/' } } stage('Test') { steps { dir('molecule/universal') { sh 'molecule test -s universal' } } } } post { always { archiveArtifacts artifacts: 'molecule/universal/.molecule/**/*', allowEmptyArchive: true publishTestResults testResultsPattern: 'molecule/universal/.molecule/reports/junit.xml' } success { echo 'Pipeline completed successfully!' } failure { echo 'Pipeline failed!' } } }