diff --git a/handlers/main.yml b/handlers/main.yml index faf6924..a12f4dd 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,10 +2,10 @@ --- - name: Restart Samba service: - name: smb + name: "{{ samba_service }}" state: restarted - name: Restart WinBind service: - name: nmb + name: "{{ winbind_service }}" state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 1951f56..cb8f10c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,12 @@ # File: roles/samba/tasks/main.yml --- +- include_vars: "{{ item }}" + with_first_found: + - "os_{{ ansible_distribution }}.yml" + - "os_{{ ansible_os_family }}.yml" + - "default.yml" + - name: Install Samba packages action: "{{ ansible_pkg_mgr }} pkg={{ item }} state=installed" with_items: @@ -72,14 +78,14 @@ - name: Start Samba service service: - name: smb + name: "{{ samba_service }}" state: started enabled: yes tags: samba - name: Start WindBind service service: - name: nmb + name: "{{ winbind_service }}" state: started enabled: yes tags: samba diff --git a/vars/default.yml b/vars/default.yml new file mode 100644 index 0000000..3705309 --- /dev/null +++ b/vars/default.yml @@ -0,0 +1,4 @@ +--- + +samba_service: smbd +winbind_service: nmbd diff --git a/vars/os_CentOS.yml b/vars/os_CentOS.yml new file mode 100644 index 0000000..2a4155d --- /dev/null +++ b/vars/os_CentOS.yml @@ -0,0 +1,4 @@ +--- + +samba_service: smb +winbind_service: nmb diff --git a/vars/os_Debian.yml b/vars/os_Debian.yml new file mode 100644 index 0000000..3705309 --- /dev/null +++ b/vars/os_Debian.yml @@ -0,0 +1,4 @@ +--- + +samba_service: smbd +winbind_service: nmbd