Problem using default(omit) in docker environment variable

24 views
Skip to first unread message

Chad McElligott

unread,
Jan 25, 2016, 11:24:49 AM1/25/16
to Ansible Project
I am trying to use the `| default(omit)` filter in the environment variable declaration of my docker role, for example:

- name: start container
  docker:
    name: foo
    image: foo
    state: reloaded
    pull: always
    restart_policy: always
    env:
      COMMAND: '{{ command|default(omit) }}'
    net: default

Then I'm using the role in the playbook without specifying the command variable, which I would expect would omit any value from being set to the environment variable. Instead, this is what is in the environment when the container is started:

COMMAND=__omit_place_holder__4aee0541e67c9db52882aecb3a955196572ae0f8


any ideas what I could be doing wrong?



Brian Coca

unread,
Jan 25, 2016, 11:25:29 AM1/25/16
to Ansible Project
omit won't work for subkeys. You can omit env, but not entries inside it.


--
Brian Coca

Chad McElligott

unread,
Jan 25, 2016, 11:31:51 AM1/25/16
to Ansible Project
Thanks Brian. Sorry for redundant post, I found a previous group post mentioning this.
Reply all
Reply to author
Forward
0 new messages