# How would you?...

**URL:** <https://forum.ansible.com/t/how-would-you/15371>\
**Category:** Ansible Project\
**Created:** [May 29, 2014, 8:29pm UTC](https://forum.ansible.com/t/how-would-you/15371 "2014-05-29T20:29:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [May 29, 2014, 8:29pm UTC](https://forum.ansible.com/t/how-would-you/15371/1 "2014-05-29T20:29:28Z")

</div>

Greetings,

I have been asked to automate a software installation task, and the actual installation is relatively simple so I’m not having any problems there…

Manual steps…  
mount an nfs directory on the client  
run a shell script from within the nfs directory (vendor provided installation script, with options)  
unmount the nfs directory.

I can automate all of these steps easily, and even make the shell script dependent on whether a file exists (it creates several files, so that’s easy…)

The question I have is whether there is a better way to deal with the mount/unmount so it’s only done if the software needs to be installed?

Any thoughts?

Thanks,

Adam

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [May 29, 2014, 8:37pm UTC](https://forum.ansible.com/t/how-would-you/15371/2 "2014-05-29T20:37:05Z")

</div>

Alternatively if you have any suggestions for how to conditionally skip a role? I can assert, or fail which will error out, but I can’t find a “skip”, “step”, “next”, or similar that would allow me to skip an entire role based on some condition…

Adam

---

<div class="post-metadata">

**Author:** ![Gonzalo\_Servat](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Gonzalo\_Servat](https://forum.ansible.com/u/Gonzalo_Servat)\
**Post date:** [May 29, 2014, 9:22pm UTC](https://forum.ansible.com/t/how-would-you/15371/3 "2014-05-29T21:22:56Z")

</div>

The condition you set for whether the software needs to be installed is up to you and easy enough, but for the auto mounting you might want to look into autofs.

- Gonzalo

---

<div class="post-metadata">

**Author:** ![Barry\_Morrison](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@Barry\_Morrison](https://forum.ansible.com/u/Barry_Morrison)\
**Post date:** [May 29, 2014, 11:22pm UTC](https://forum.ansible.com/t/how-would-you/15371/4 "2014-05-29T23:22:01Z")

</div>

Maybe with one of these [http://docs.ansible.com/playbooks\_conditionals.html](http://docs.ansible.com/playbooks_conditionals.html) on the condition that the software doesn’t exist.

---

<div class="post-metadata">

**Author:** ![Nathan\_Howell](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Nathan\_Howell](https://forum.ansible.com/u/Nathan_Howell)\
**Post date:** [May 29, 2014, 11:54pm UTC](https://forum.ansible.com/t/how-would-you/15371/5 "2014-05-29T23:54:47Z")

</div>

I think you want this: [http://docs.ansible.com/playbooks\_conditionals.html#applying-when-to-roles-and-includes](http://docs.ansible.com/playbooks_conditionals.html#applying-when-to-roles-and-includes)

Nathan
