I have item list of IPs:
server_hosts: - { host: '1.1.1.1' } - { host: '10.10.10.10' } I want to pass only one of the items in the command line:
ansible-playbook base.yml -i ${host}, --extra-vars "env_name=lab server_hosts={host:'${1.1.1.1}'} " but this gives an error of:
{"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode' object has no attribute 'host'\n\nThe error
Any advice how to pass a specific item from list in the command line?
${host}looks bash-like.bad substitutionwhen you try to execute it. Please edit your question to include a verifiable example. Right now it's a pure fabrication and you are only wasting readers' time.with_items.