title: Mount smb share temprorarily with Ansible using module instead of shell
body: <p>I need to mount a smb share to have access on large, shared installation files in Ansible. This works using CLI:</p>
  
  <pre><code>- name: Mount share
    become: yes
    shell: "mount.cifs {{ smb_share.path }} {{ smb_share.mount_point }} -o user={{ smb_share.user }},password={{ smb_share.password }},mfsymlinks,exec"
  </code></pre>
  
  <p>However, this has two disadvantages: </p>
  
  <ul>
  <li>Doesn't follow best practices of using modules instead of shell commands when required</li>
  <li>No detection if already mounted - I'd need to implement this, e.g. by grep for the mountpoint in <code>mount</code></li>
  </ul>
  
  <p>There is a <a href="https://docs.ansible.com/ansible/latest/modules/mount_module.html" rel="nofollow noreferrer"><code>mount</code></a> module in Ansible. But since this share ist just for installation and uses credentials, I don't want to have it permanently mounted. The <code>boot</code> parameter looks what I need, sadly not for Linux:</p>
  
  <pre><code>Determines if the filesystem should be mounted on boot.
  Only applies to Solaris systems.
  </code></pre>
  
  <p>I still tried to set <code>boot: no</code> but as described in the docs, it still creates an <code>/etc/fstab</code> entry with the plain text password.</p>
  
  <p>Is there any alternative to have a Windows share temprorarily mounted on CentOS 7 with any Ansible module?</p>