On Sun, 26 Apr 2020 23:18:40 -0700 (PDT)
דודו דודו <[email protected]> wrote:

> I have a task that mounts devices in a Linux machine.
> I wish to run the task only if the device is not mounted, therefore I'm 
> running a mount command and save the output in a register. 
> 
> On the mount task, I'm trying to use *when *by searching the device in the 
> register output - and I'm failing to do so.
> The task is running even that /dev/sdb1 is included in the register  

The module "mount" does the job and creates the directory if needed.
https://docs.ansible.com/ansible/latest/modules/mount_module.html

  "state: If mounted, the device will be actively mounted and appropriately
  configured in fstab. If the mount point is not present, the mount point
  will be created."

HTH,

        -vlado

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200427084329.21dd79cf%40gmail.com.

Attachment: pgpQXhYr_vcuH.pgp
Description: OpenPGP digital signature

Reply via email to