# Problem using default(omit) in docker environment variable

**URL:** <https://forum.ansible.com/t/problem-using-default-omit-in-docker-environment-variable/20341>\
**Category:** Ansible Project\
**Created:** [January 25, 2016, 4:19pm UTC](https://forum.ansible.com/t/problem-using-default-omit-in-docker-environment-variable/20341 "2016-01-25T16:19:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chad\_McElligott](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@Chad\_McElligott](https://forum.ansible.com/u/Chad_McElligott)\
**Post date:** [January 25, 2016, 4:19pm UTC](https://forum.ansible.com/t/problem-using-default-omit-in-docker-environment-variable/20341/1 "2016-01-25T16:19:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 25, 2016, 4:25pm UTC](https://forum.ansible.com/t/problem-using-default-omit-in-docker-environment-variable/20341/2 "2016-01-25T16:25:23Z")

</div>

omit won't work for subkeys. You can omit env, but not entries inside it.

---

<div class="post-metadata">

**Author:** ![Chad\_McElligott](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@Chad\_McElligott](https://forum.ansible.com/u/Chad_McElligott)\
**Post date:** [January 25, 2016, 4:31pm UTC](https://forum.ansible.com/t/problem-using-default-omit-in-docker-environment-variable/20341/3 "2016-01-25T16:31:50Z")

</div>

Thanks Brian. Sorry for redundant post, I found a previous group post mentioning this.
