smb_client.yml 760 B

123456789101112131415161718192021222324252627282930
  1. ---
  2. - name: Access an SMB share
  3. hosts: servera.lab.example.com
  4. become: true
  5. vars_files:
  6. - smb_vars.yml
  7. tasks:
  8. - name: the package to mount SMB shares is installed
  9. yum:
  10. name: cifs-utils
  11. state: present
  12. - name: the credential file exists
  13. copy:
  14. content: "username={{ samba_usermount }}\n\
  15. password={{ samba_passmount }}\n"
  16. dest: /etc/samba/creds.txt
  17. owner: root
  18. group: root
  19. mode: '0600'
  20. no_log: true
  21. - name: the SMB share is mounted
  22. mount:
  23. path: "{{ mount_point }}"
  24. src: "//serverd.lab.example.com/{{ share_name }}"
  25. opts: "credentials=/etc/samba/creds.txt,multiuser,seal"
  26. state: mounted
  27. fstype: cifs