I have in my playbook this var:
- name: Deploy nodejs app
vars:
nodejs:
name: myapp
version: 0.1.1
settings:
port: 3000
log: /var/log
I want to replace or override version and port in this nodejs variable at runtime. I’ve tried:
-
–extra-vars ‘nodejs.version=0.1.2 nodejs.settings.port=4000’
-
–extra-vars ‘nodejs[“version”]=0.1.2 nodejs[“settings”][“port”]=4000’
-
–extra-vars ‘{“nodejs”: {“version”: “0.1.2”, “settings”: {“port”: 4000}}}’
None of them worked. In 1) and 2), the values of version and port are not passed in, and in 3), nodejs variable was entirely replaced so that all the other values like name and log are gone.
So is there a way to use --extra-vars to override part of a complex variable?
Thanks.