Hi all,
Please find below;
Jenkins configuration:
(“${environment}” == “uat”) {
ansiblePlaybook(
playbook: ‘deploy.yml’,
inventory: ‘hosts’,
tags: ‘downtime’,
extraVars: [
app_env: ‘uat’,
jfrog_username:
jfrog_password:
branch: “${branch}”,
maintanance: ‘no’,
build_version: version
deploy.yml:
gather_facts: no
remote_user: ansible
become: true
serial: 1
tasks:
-
block:
-
include_tasks: main.yml
any_errors_fatal: true
vars_prompt:
prompt: “Enter JFrog username”
private: no
prompt: “Enter JFrog password”
private: yes
tags: [ downtime, nodowntime ]
gather_facts: no
remote_user: ansible
become: true
serial: 1
ignore_errors: no
any_errors_fatal: true
roles:
vars_prompt:
prompt: “Enter JFrog username”
private: no
prompt: “Enter JFrog password”
private: yes
tags: [ downtime, nodowntime ]
Jenkins Logs:
ansible-playbook deploy.yml -i hosts -t downtime -e app_env=uat -e jfrog_username= -e jfrog_password= -e branch=uat -e maintanance=no -e build_version=558
10:44:18 ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
10:44:18
10:44:18 The error appears to have been in ‘/var/jenkins_home/workspace/SG-MyInfo-Deployment/deploy.yml’: line 28, column 11, but may
10:44:18 be elsewhere in the file depending on the exact syntax problem.
10:44:18
10:44:18 The offending line appears to be:
10:44:18
10:44:18 - block:
10:44:18 - include_tasks: main.yml
10:44:18 ^ here
TASK [deploy : Check if multiple files exist and fail playbook if any file does not exist] ***
14:50:07 fatal: [10.119.39.101]: FAILED! => {“failed”: true, “msg”: “the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘item’ is undefined\n\nThe error appears to have been in ‘/var/jenkins_home/workspace/SG-MyInfo-Deployment/deploy/tasks/main.yml’: line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Check if multiple files exist and fail playbook if any file does not exist\n ^ here\n”}
14:50:07 …ignoring
14:50:07 ERROR! invalid meta action requested: end_host
14:50:07
(attachments)