pipeline操作ansible

    技术2026-08-12  3

    安装ansible软件 yum -y install ansible

    pipeline { agent any options{ timestamps () } environment { book="/tmp/nas/test.yml" } stages { stage('syntax-check') { steps { ansiblePlaybook ( //inventory: '${hos}', colorized: true, playbook: '${book}', limit: '10.22.8.33,10.22.32.2', extras: '--syntax-check' ) } } stage('Deloy') { steps { ansiblePlaybook ( playbook: '${book}', limit: '10.22.8.33,10.22.32.2', ) } } } }

    效果如下

    Processed: 0.008, SQL: 9