- name: systemd daemon-reload
  systemd:
    daemon_reload: yes

- name: Enable & Start Samba service ({{ smb_service }}) and NetBIOS name service ({{ nmb_service }}) if samba_enabled
  systemd:
    name: "{{ item }}"
    state: started
    enabled: yes
  when: samba_enabled
  with_items:
    - "{{ smb_service }}"
    - "{{ nmb_service }}"

- name: Disable & Stop Samba service ({{ smb_service }}) and NetBIOS name service ({{ nmb_service }}) if not samba_enabled
  systemd:
    name: "{{ item }}"
    state: stopped
    enabled: no
  when: not samba_enabled
  with_items:
    - "{{ smb_service }}"
    - "{{ nmb_service }}"
