86 lines
1.8 KiB
YAML
86 lines
1.8 KiB
YAML
---
|
|
|
|
# ---
|
|
# Samba Server
|
|
# ---
|
|
|
|
- name: (samba-install.yml) Ensure samba packages server (buster) are installed.
|
|
package:
|
|
pkg: '{{ apt_install_server_samba }}'
|
|
state: present
|
|
when:
|
|
- "groups['samba_server']|string is search(inventory_hostname)"
|
|
tags:
|
|
- samba-server
|
|
|
|
# ---
|
|
# /etc/samba/smb.conf
|
|
# ---
|
|
|
|
- name: (samba-install.yml) Check if file '/etc/samba/smb.conf.ORIG exists'
|
|
stat:
|
|
path: /etc/samba/smb.conf.ORIG
|
|
register: smb_conf_exists
|
|
when:
|
|
- "groups['samba_server']|string is search(inventory_hostname)"
|
|
tags:
|
|
- samba-server
|
|
|
|
- name: (samba-install.yml) Backup existing file /etc/samba/smb.conf
|
|
command: cp -a /etc/samba/smb.conf /etc/samba/smb.conf.ORIG
|
|
when:
|
|
- "groups['samba_server']|string is search(inventory_hostname)"
|
|
- smb_conf_exists.stat.exists == False
|
|
tags:
|
|
- samba-server
|
|
|
|
|
|
- name: (samba-install.yml) Ensure file /etc/samba/users.map exists
|
|
copy:
|
|
src: "{{ role_path + '/files//etc/samba/users.map' }}"
|
|
dest: /etc/samba/users.map
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
when:
|
|
- "groups['samba_server']|string is search(inventory_hostname)"
|
|
notify:
|
|
- Restart smbd
|
|
- Restart nmbd
|
|
tags:
|
|
- samba-server
|
|
|
|
|
|
- name: (samba-install.yml) /etc/samba/smb.conf
|
|
template:
|
|
dest: /etc/samba/smb.conf
|
|
src: etc/samba/smb.conf.j2
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
when:
|
|
- "groups['samba_server']|string is search(inventory_hostname)"
|
|
notify:
|
|
- Restart smbd
|
|
- Restart nmbd
|
|
tags:
|
|
- samba-server
|
|
|
|
|
|
# ---
|
|
# Samba clients
|
|
# ---
|
|
|
|
- name: (samba-install.yml) Ensure samba packages clients are installed.
|
|
package:
|
|
pkg: "{{ apt_install_client_samba }}"
|
|
state: present
|
|
when:
|
|
- "groups['nis_client']|string is search(inventory_hostname)"
|
|
- ansible_distribution == "Ubuntu"
|
|
tags:
|
|
- samba-client
|
|
|
|
|
|
|