bash-4.2$ vim config.yml
- hosts: localhost
roles:
- jenkins
tags: jenkins
bash-4.2$ vim roles/jenkins/tasks/main.yml
- name: build a project via Jenkins CLI
command: bash /applications/qa/users/qa/ANSIBLE/apps/build-project.sh
- name: waiting for Jenkins built successfully
#wait_for:
# path: /net/qaserver/fs_Qa/QA/builds/AUTO/build_ELIVALITOR_r14033
#wait_for:
uri:
url: "http://jenkins/view/Build/job/build_(ELIVALITOR)/lastBuild/api/json"
status_code: 200
return_content: yes
body_format: json
register: response
until: response.json.result == "SUCCESS"
retries: 10
delay: 30
- name: copy the results to the PATCH directory
command: cp -r /net/qaserver/fs_Qa/QA/builds/AUTO/build_ELIVALITOR_r14033 /applications/qa/users/qa/ANSIBLE/PATCHES/DMTDMP-XYZ
bash-4.2$ ansible-playbook -i hosts config.yml