# How to set ulimit -n 10240 for the current session in ansible

**URL:** <https://forum.ansible.com/t/how-to-set-ulimit-n-10240-for-the-current-session-in-ansible/20676>\
**Category:** Ansible Project\
**Created:** [February 25, 2016, 10:31am UTC](https://forum.ansible.com/t/how-to-set-ulimit-n-10240-for-the-current-session-in-ansible/20676 "2016-02-25T10:31:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepa\_Yr](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@Deepa\_Yr](https://forum.ansible.com/u/Deepa_Yr)\
**Post date:** [February 25, 2016, 10:31am UTC](https://forum.ansible.com/t/how-to-set-ulimit-n-10240-for-the-current-session-in-ansible/20676/1 "2016-02-25T10:31:44Z")

</div>

Hi

Before installing my product using command module, I need to set ulimit -n 10240. I tried running

- name: Install product  
command: “{{ item }}”  
with\_items:

- “ulimit -n 10240”

- “setup -r responsefile”

When I run this way, I get

“module\_name”: “command”}, “item”: “ulimit -n 10240”, “msg”: “[Errno 2] No such file or directory”, “rc”: 2}

How can I get it working ?

---

<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:** [February 25, 2016, 2:35pm UTC](https://forum.ansible.com/t/how-to-set-ulimit-n-10240-for-the-current-session-in-ansible/20676/2 "2016-02-25T14:35:34Z")

</div>

That will not do what you think it does,even if you set the ulimit it will ONLY affect the task that is setting the ulimit …

Ansible creates new sessions/shells for every task (and in this case, item iteration), so that settign will be lost by the time you call `setup`.

What you want to do is use the shell module :

shell: umlimit -n 10240; setup -r responsefile
