title: Ansible mount for different directories on different servers
body: <p>we have different mount points configured in <code>/etc/fstab</code> file for different servers. How can i achieve the same using Ansible?</p>
  
  <p><strong>For example:</strong> </p>
  
  <p>server A has a <strong>source</strong> <code>node1:/data/col1/RMAN</code> mounted at <strong>path</strong> <code>/mountPointA</code></p>
  
  <p>Above can we achieved using Ansible's mount module such as</p>
  
  <hr>
  
  <pre><code>- name: Add Mount Points
  mount:
    path: /mnt/dvd
    src : /dev/sr0
    fstype: iso09660
    opts: ro
    boot: yes
    state: present
  </code></pre>
  
  <blockquote>
    <p><strong>BUT</strong></p>
  </blockquote>
  
  <p>What if i have another <strong>server "B"</strong> which has <strong>source</strong> <code>/node1:/data/col1/directoryB</code> needs to be mounted at <strong>path</strong> /<code>mountPointB</code>. However this server does not need the first mount point to be configured.</p>
  
  <p>Is it possible to achieve it in single yml file?</p>
  
  <p><strong>In other words</strong> </p>
  
  <pre><code>Host      source                   dest
  
  hostA    /source/directoryA     /mnt
  
  hostB    /source/directoryB     /mnt or /mnt/subdirectory #assuming subdir exists
  </code></pre>
  
  <p>i hope this make sense. sorry for the confusion. This playbook will be run on bulk of hosts, how do i make sure the right host is automatically selected to be using the right mount points</p>