aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/samba/tasks/main.yml
blob: 97aff986ec2b18e417284271d854c97e3f10595a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
- name: Install Samba
  become: true
  ansible.builtin.package:
    name: samba
    state: present

- name: Create /etc/samba
  become: true
  ansible.builtin.file:
    path: /etc/samba
    state: directory
    owner: root
    group: root
    mode: '755'

- name: Format smb.conf
  become: true
  ansible.builtin.template:
    src: smb.conf.j2
    dest: /etc/samba/smb.conf
    owner: root
    group: root
    mode: '644'
    validate: '/usr/bin/testparm --suppress-prompt %s'
  notify: samba_configured

- name: Enable & start Samba
  become: true
  ansible.builtin.systemd_service:
    name: smbd
    enabled: true
    state: started

- name: Restart Samba service if necessary
  ansible.builtin.meta: flush_handlers

# Enable network discovery on Windows.
- name: Install wsdd
  become: true
  ansible.builtin.package:
    name: wsdd
    state: present

- name: Enable & start wsdd
  become: true
  ansible.builtin.systemd_service:
    name: wsdd
    enabled: true
    state: started