- name: Install samba and required tools apt: name={{ item }} state=present with_items: - heimdal-clients - libnss-winbind - libpam-winbind - ntp - ntpdate - samba - winbind tags: samba_install - name: Install nsswitch passwd config lineinfile: dest=/etc/nsswitch.conf regexp="^passwd:" line="passwd{{ ':' }} files winbind" notify: restart samba tags: samba_nsswitch - name: Install nsswitch group config lineinfile: dest=/etc/nsswitch.conf regexp="^group:" line="group{{ ':' }} files winbind" notify: restart samba tags: samba_nsswitch - name: Install nsswitch shadow config lineinfile: dest=/etc/nsswitch.conf regexp="^shadow:" line="shadow{{ ':' }} files winbind" notify: restart samba tags: samba_nsswitch - name: Install samba configuration template: src=smb.conf.j2 dest=/etc/samba/smb.conf mode=0644 owner=root group=root notify: restart samba tags: samba_smbconf - name: Enable samba services service: name={{ item }} enabled=yes with_items: - smbd - nmbd - winbind tags: samba_services - name: Join domain shell: net ads join -U {{ ad_admin_username }}%{{ ad_admin_password }} notify: restart samba tags: samba_join