| 123456789101112131415161718192021222324252627282930313233343536373839 |
- ---
- - name: Access an SMB share
- hosts: servera.lab.example.com
- become: true
- vars_files:
- - smb_vars.yml
- tasks:
- - name: the cifs-utils package is installed
- yum:
- name: cifs-utils
- state: present
- - name: the credential file exists
- copy:
- content: "username={{ samba_usermount }}\n\
- password={{ samba_passmount }}\n"
- dest: /etc/samba/creds.txt
- owner: root
- group: root
- mode: '0600'
- no_log: true
- - name: the SMB share is mounted
- mount:
- path: "{{ mount_point }}"
- src: "//serverd.lab.example.com/{{ share_name }}"
- opts: "credentials=/etc/samba/creds.txt,multiuser,seal"
- state: mounted
- fstype: cifs
- - name: the Linux users exist
- user:
- name: "{{ item.name }}"
- shell: /bin/bash
- password: "{{ item.password | \
- password_hash('sha512', 'redhatsalt') }}"
- loop: "{{ samba_users }}"
- no_log: true
|