aboutsummaryrefslogtreecommitdiff
path: root/roles/samba/tasks/main.yaml
blob: 5207ac52097e4523ae9bb94451a278182e26c65f (plain)
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
# https://pimylifeup.com/raspberry-pi-samba/
---

- name: 'Install required apt packages'
  apt:
    name:
      - 'samba'
      - 'samba-common-bin'
    state: 'present'
    update_cache: true

- name: 'Copy conf files'
  template:
    src: 'smb.conf'
    dest: '/etc/samba/smb.conf'
    mode: '644'

- name: 'Add Samba user'
  expect:
    command: 'sudo smbpasswd -a {{ samba_user }}'
    responses:
      (?i)password: "{{ samba_user_pass }}"

- name: 'Restart Samba'
  systemd:
    name: '{{ item }}'
    state: 'restarted'
  loop:
    - 'smbd'