jenkinsci/ansible-plugin

Extra-variables of type list are ignored and not passed to ansible-playbook

Opened this issue · 0 comments

Jenkins and plugins versions report

Environment
Jenkins: 2.401.1
OS: Linux - 3.10.0-693.11.6.el7.x86_64
Java: 11.0.3 - Amazon.com Inc. (OpenJDK 64-Bit Server VM)
---
ansible:240.vc26740a_625c0

What Operating System are you using (both controller, and any agents involved in the problem)?

CentOS 7

Reproduction steps

  1. Create debug task that prints extra-var you've submitted
- name: print foobars
  debug:
    var: foobars
  1. Run the script through Jenkins:
ansiblePlaybook(
    playbook: "playbook.yml",
    extraVars: [foobars: ["foo","bar"]]
)

Expected Results

[Pipeline] ansiblePlaybook
[WARN] Omitting extra var foobars: check value is a supported type.
[playbook] $ /app/ansible44/venv/bin/ansible-playbook jenkins/ansible/playbook.yml -i jenkins/ansible/localhost.ini -e ********

PLAY [playbook] **********************************************

TASK [print foobars] ***
ok: [localhost] => {
    "foobars": [
        "foo",
        "bar"
    ]
}

Actual Results

[Pipeline] ansiblePlaybook
[playbook] $ /app/ansible44/venv/bin/ansible-playbook jenkins/ansible/playbook.yml -i jenkins/ansible/localhost.ini 

PLAY [playbook] **********************************************

TASK [print foobars] ***
ok: [localhost] => {
    "foobars": "VARIABLE IS NOT DEFINED!"
}

Anything else?

Apparently #88 broke list-related logic, because with LTS 2.387 this was working.

Proposal: pass extra variables as json to Ansible.