I have a scenario where I need to specify multiple tags in the ansibleplugin. I tried multiple ways to specify the list of tags, but I keep getting the below error. How do I specify multiple tags?
java.lang.ClassCastException: class org.jenkinsci.plugins.ansible.workflow.AnsiblePlaybookStep.setTags() expects class java.lang.String but received class java.util.ArrayList
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:492)
ansiColor('xterm') {
ansiblePlaybook(
playbook: "test.yml",
inventory: "test-inventory.yml",
vaultCredentialsId: "ansible-vault-password",
extras: '-v',
tags: [
"test1",
"test2"
],
extraVars: [
examplefname: "bob",
exampleLname: "${PROFILE}",
],
hostKeyChecking: false,
colorized: true
)
}
While it would make much more sense to assign a List<String>
value for the tags
parameter like you did, the documentation does show the value should be a String
. What the documentation does not explain is what the delimiter is for multiple tags. If we check the Github repository README example snippet for the plugin, we see that the tags
parameter String value should be comma delimited for multiple Ansible tags. For your specific use case, this parameter would appear like:
tags: 'test1,test2'