From 0cf97f50b58b14f90914fc569e1cc4a9d01b595b Mon Sep 17 00:00:00 2001 From: paspo Date: Sun, 12 Nov 2017 18:10:15 +0100 Subject: [PATCH] initial commit --- .../roles/nfs-client/handlers/main.yml | 3 + .../ansible/roles/nfs-client/tasks/main.yml | 61 +++++++++++++++++++ .../roles/nfs-client/templates/ldap.conf | 9 +++ 3 files changed, 73 insertions(+) create mode 100644 root/etc/ansible/roles/nfs-client/handlers/main.yml create mode 100644 root/etc/ansible/roles/nfs-client/tasks/main.yml create mode 100644 root/etc/ansible/roles/nfs-client/templates/ldap.conf diff --git a/root/etc/ansible/roles/nfs-client/handlers/main.yml b/root/etc/ansible/roles/nfs-client/handlers/main.yml new file mode 100644 index 0000000..bc9b3d9 --- /dev/null +++ b/root/etc/ansible/roles/nfs-client/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: restart libnss-ldap + service: name=libnss-ldap state=restarted diff --git a/root/etc/ansible/roles/nfs-client/tasks/main.yml b/root/etc/ansible/roles/nfs-client/tasks/main.yml new file mode 100644 index 0000000..8b3f170 --- /dev/null +++ b/root/etc/ansible/roles/nfs-client/tasks/main.yml @@ -0,0 +1,61 @@ +--- + +- name: Installing client packages + apt: + name: '{{ item }}' + state: latest + with_items: + - nfs-common + - libnss-ldap + +- name: Create directory for user homes + file: path=/var/lib/nethserver/home state=directory owner=root group=root mode=0755 + +- name: Add mount to fstab + mount: + path: /var/lib/nethserver/home + src: "{{ esmith.SystemName }}.{{ esmith.DomainName }}:/var/lib/nethserver/home" + fstype: nfs4 + opts: rw,async,_netdev + passno: 0 + dump: 0 + state: mounted + +# forse questo non serve +- name: Tweak idmap.conf + ini_file: + path: /etc/idmapd.conf + section: Translation + option: Method + value: nsswitch + mode: 0644 + +- name: nsswitch settings for passwd + lineinfile: + path: /etc/nsswitch.conf + state: present + regexp: '^passwd\:' + line: 'passwd: files ldap' + +- name: nsswitch settings for group + lineinfile: + path: /etc/nsswitch.conf + state: present + regexp: '^group\:' + line: 'group: files ldap' + +- name: nsswitch settings for shadow + lineinfile: + path: /etc/nsswitch.conf + state: present + regexp: '^shadow\:' + line: 'shadow: files ldap' + +- name: ldap configuration + template: + src: 'ldap.conf' + dest: '/etc/ldap.conf' + owner: 'root' + group: 'root' + mode: 0600 + notify: restart libnss-ldap diff --git a/root/etc/ansible/roles/nfs-client/templates/ldap.conf b/root/etc/ansible/roles/nfs-client/templates/ldap.conf new file mode 100644 index 0000000..4cbe7b5 --- /dev/null +++ b/root/etc/ansible/roles/nfs-client/templates/ldap.conf @@ -0,0 +1,9 @@ +base dc=directory,dc=nh +uri ldap://{{ esmith.SystemName }}.{{ esmith.DomainName }}:389/ +ldap_version 3 +binddn cn=libuser,dc=directory,dc=nh +bindpw {{ lookup('file', '/var/lib/nethserver/secrets/libuser') }} +rootbinddn cn=libuser,dc=directory,dc=nh +pam_password md5 +#ssl start_tls +nss_initgroups_ignoreusers avahi,avahi-autoipd,backup,bin,colord,daemon,dnsmasq,games,gnats,hplip,irc,kernoops,libuuid,lightdm,list,lp,mail,man,messagebus,news,proxy,pulse,root,rtkit,saned,speech-dispatcher,sshd,statd,sync,sys,syslog,usbmux,uucp,whoopsie,www-data