ansible/ansible — pull request #8223 by renard (2014-07-21 16:54:13+00:00)
Title: Create fstab if not exists

##### Issue Type:

Bugfix Pull Request

##### Ansible Version:

```
ansible 1.7 (devel 7c2cb58673) last updated 2014/07/17 19:42:12 (GMT +200)
```

##### Environment:

All

##### Summary:

2 issues in the `mount` moudule:

- The code allows to pass an option `fstab` whis was not documented.
- If you pass a `fstab` option you might end up with a file that does not
exist on the remote file system.

This PR comments the `fstab` option and ensures both directory and file for `fstab` actually exist on target host.

The patch had been split for atomicity purposes.

##### Steps To Reproduce:

use task:

```yaml
- name: create fstabs
mount:
name=/mnt/data
fstab=/path/to/chroot/etc/fstab
src='LABEL=DATA'
fstype=xfs
opts='rw,noatime,nobarrier,nobootwait'
state='present'
```

##### Expected Results:

No error (see actual Result below)

##### Actual Results:

```
TASK: [mdadm | create fstabs] *************************************************
failed: [target.example.com] => (item={u'src': u'LABEL=DATA', u'fstab': u'/path/to/chroot/etc/fstab', u'name': u'/mnt/data', u'opts': u'rw,noatime,nobarrier,nobootwait', u'fstype': u'xfs'}) => {"failed": true, "item": {"fstab": "/path/to/chroot/etc/fstab", "fstype": "xfs", "name": "/mnt/data", "opts": "rw,noatime,nobarrier,nobootwait", "src": "LABEL=DATA"}, "parsed": false}
invalid output was: SUDO-SUCCESS-nhgjtwbfwfivkojaaelidzyqmkjxgxhv
Traceback (most recent call last):
File "", line 1625, in
File "", line 296, in main
File "", line 115, in set_mount
IOError: [Errno 2] No such file or directory: '/path/to/chroot/etc/fstab'
```