# With Ansible Runner, how to reset the \`env/cmdline\` file that is generated post execution?

**URL:** <https://forum.ansible.com/t/with-ansible-runner-how-to-reset-the-env-cmdline-file-that-is-generated-post-execution/43539>\
**Category:** Get Help\
**Tags:** ansible-runner\
**Created:** [June 24, 2025, 6:54pm UTC](https://forum.ansible.com/t/with-ansible-runner-how-to-reset-the-env-cmdline-file-that-is-generated-post-execution/43539 "2025-06-24T18:54:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShanDesai](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@ShanDesai](https://forum.ansible.com/u/ShanDesai)\
**Post date:** [June 24, 2025, 6:54pm UTC](https://forum.ansible.com/t/with-ansible-runner-how-to-reset-the-env-cmdline-file-that-is-generated-post-execution/43539/1 "2025-06-24T18:54:04Z")

</div>

I am using `ansible-runner` with a `Click` CLI application. I am using the `run` function to execute my playbooks in the `project` directory.

I am using some `skip-tags` to execute specific tasks and skips some other.

Programatically,

```python
from ansible_runner import run

conf = {
  'private_data_dir': '.', # in root dir
  'playbook': 'some_playbook.yml',
}

if some_click_option:
    conf['cmdline'] = '--skip-tags=tagA'

out, rc = run(**conf)

```

The core logic is sound and works, however the root directory creates the `env/cmdline` file.

Since he `env/cmdline` contains the `--skip-tags=tagA` persists the playbook seems to skips the tasks upon execution even when my CLI doesn’t set the specific option.

Any smart way to purge the `env/cmdline` post execution?

The only way I can come around is remove the file based on the return code `rc` value.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [June 24, 2025, 7:46pm UTC](https://forum.ansible.com/t/with-ansible-runner-how-to-reset-the-env-cmdline-file-that-is-generated-post-execution/43539/2 "2025-06-24T19:46:21Z")

</div>

The way this is generally handled is by using process\_isolation, and/or `directory_isolation_base_path`. If using a non-container process-isolation such as bubblewrap, then the project dir is copied into the `directory_isolation_base_path`, to prevent modification of the source project dir.

Outside of this using bubblewrap, or container based isolation, you could implement the same behavior by copying the project to a tempdir, and use that, rather than directly executing against the source project dir. You would then also have to clean up that tempdir yourself afterwards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 24, 2025, 7:47pm UTC](https://forum.ansible.com/t/with-ansible-runner-how-to-reset-the-env-cmdline-file-that-is-generated-post-execution/43539/3 "2025-07-24T19:47:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
