From a668e0f85291962a5484f45b45d11039f6a64e42 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Sat, 2 Jan 2016 00:13:29 -0800 Subject: [PATCH 1/4] Support both apt and yum package managers --- tasks/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3a9f3f4..886f795 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,9 +2,7 @@ --- - name: Install Samba packages - yum: - pkg: "{{ item }}" - state: installed + action: "{{ ansible_pkg_mgr }} pkg={{ item }} state=installed" with_items: - libsemanage-python - samba-common From 1dfadb60115c48325322a1a278a984fed06d4d21 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Sat, 2 Jan 2016 00:14:04 -0800 Subject: [PATCH 2/4] SELinux support is optional --- tasks/main.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 886f795..1951f56 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,12 +4,15 @@ - name: Install Samba packages action: "{{ ansible_pkg_mgr }} pkg={{ item }} state=installed" with_items: - - libsemanage-python - samba-common - samba - samba-client tags: samba +- name: Install SELinux package + action: "{{ ansible_pkg_mgr }} pkg=libsemanage-python state=installed" + when: ansible_selinux + - name: Make sure SELinux boolean settings are correct seboolean: name: "{{ item }}" @@ -18,7 +21,7 @@ with_items: - samba_enable_home_dirs - samba_export_all_rw - tags: samba + when: ansible_selinux - name: Create Samba shares root directory file: From 751a9694d9c9bf3462486e7f9e328b92b292bd83 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Sat, 2 Jan 2016 01:16:08 -0800 Subject: [PATCH 3/4] Handle different service names across OSs --- handlers/main.yml | 4 ++-- tasks/main.yml | 10 ++++++++-- vars/default.yml | 4 ++++ vars/os_CentOS.yml | 4 ++++ vars/os_Debian.yml | 4 ++++ 5 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 vars/default.yml create mode 100644 vars/os_CentOS.yml create mode 100644 vars/os_Debian.yml 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 From 528e539a74cf450ff909752bec962815fe01e7b3 Mon Sep 17 00:00:00 2001 From: Ian Young Date: Wed, 11 May 2016 22:10:25 -0500 Subject: [PATCH 4/4] Add supported platforms to meta --- meta/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/main.yml b/meta/main.yml index 257a44a..b87bf69 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -9,6 +9,12 @@ galaxy_info: - name: EL versions: - 7 + - name: Ubuntu + versions: + - all + - name: Debian + versions: + - all categories: - system - networking