Jenkins file

24 views
Skip to first unread message

Ashok Reddy

unread,
May 11, 2022, 6:51:08 AM5/11/22
to Jenkins Users
I have written the following code to execute the ansible playbook, but got the following error:

stage('Artifacts') {
           when {
               expression {
                   params.version =~ /SNAPSHOT/
               }
           }
            steps {
                dir('feature') {
                     checkout resolveScm(source: [$class: 'GitSCMSource', credentialsId: 'svcPsdGit-ssh', id: '_', remote: 'ssh://git@psdgit.:7999/tt040/it-infra.git', traits: [gitBranchDiscovery()]], targets: [params.main_branch])
                     sh '''  
                        echo "`pwd`"
                        env | sort
                        cd ansible/playbooks
                        ansible-playbook --extra-vars="artifactory_folder=gssd-dev-snapshots-local" playbooks/deploy.yml
                     '''  
                }
            }
        }

Error:

cd ansible/playbooks + ansible-playbook --extra-vars=artifactory_folder=gssd-dev-snapshots-local playbooks/deploy.yml /home/centos/workspace/MY/Snapshot_deployment/feature@tmp/durable-1c0f5688/script.sh: line 5: ansible-playbook: command not found [Pipeline] } [Pipeline] // dir [Pipeline] }


Can you please help me out?

Ivan Fernandez Calvo

unread,
May 11, 2022, 1:21:22 PM5/11/22
to Jenkins Users
ansible-playbook is not in the PATH
Reply all
Reply to author
Forward
0 new messages