Hello all, I’m veyr new on ansible and currently trying to make some automation with mount. Should be veyr simple, but please take a look at this.
This is part of my playbook:
- mount:
name: “{{ instance.value.mount }}”
src: “/dev/{{ instance.value.volume }}/{{ instance.key }}”
state: present
fstype: ext4 - mount:
name: “{{ instance.value.mount }}”
src: “/dev/{{instance.value.volume }}/{{ instance.key }}”
state: mounted
fstype: ext4
Whenever I run this, the first mount works as expected (creating the line on /etc/fstab), however, the second mount fails with:
fatal: [brsptla0101]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Error mounting /u01/diebs01: /bin/mount: invalid option – ‘T’\nUsage: mount -V : print version\n mount -h : print this help\n mount : list mounted filesystems\n mount -l : idem, including volume labels\nSo far the informational part. Next the mounting.\nThe command is `mount [-t fstype] something somewhere’.\nDetails found in /etc/fstab may be omitted.\n mount -a [-t|-O] … : mount all stuff from /etc/fstab\n mount device : mount device at the known place\n mount directory : mount known device here\n mount -t type dev dir : ordinary mount command\nNote that one does not really mount a device, one mounts\na filesystem (of the given type) found on the device.\nOne can also mount an already visible directory tree elsewhere:\n mount --bind olddir newdir\nor move a subtree:\n mount --move olddir newdir\nOne can change the type of mount containing the directory dir:\n mount --make-shared dir\n mount --make-slave dir\n mount --make-private dir\n mount --make-unbindable dir\nOne can change the type of all the mounts in a mount subtree\ncontaining the directory dir:\n mount --make-rshared dir\n mount --make-rslave dir\n mount --make-rprivate dir\n mount --make-runbindable dir\nA device can be given by name, say /dev/hda1 or /dev/cdrom,\nor by label, using -L label or by uuid, using -U uuid .\nOther options: [-nfFrsvw] [-o options] [-p passwdfd].\nFor many more details, say man 8 mount .\n”}
I thinks it’s passing -T instead of -t, how can I fix this?
The only workaround I found is to use the shell command to mount the filesystem
I’m using ansible 2.2.0
Thank you.