forked from LibreSchool/libreschool-nfs
wip
This commit is contained in:
parent
35e0e47b43
commit
fa86a2d9fb
23
.editorconfig
Normal file
23
.editorconfig
Normal file
@ -0,0 +1,23 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[**.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.{js,coffee,html,less,css,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[**.md]
|
||||
trim_trailing_whitespace = false
|
@ -1,7 +1,7 @@
|
||||
Summary: LibreSchool NFS home profiles configuration
|
||||
Name: libreschool-nfs
|
||||
Version: 6.9
|
||||
Release: 1
|
||||
Version: 1.0
|
||||
Release: 1.ns7
|
||||
License: GPL
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
@ -9,9 +9,14 @@ Source0: %{name}-%{version}.tar.gz
|
||||
Source1: COPYING
|
||||
URL: %{url_prefix}/%{name}
|
||||
Requires: libreschool-release
|
||||
Requires: nethserver-directory
|
||||
Requires: libreschool-client-manager
|
||||
Requires: nethserver-directory oppure nfs quell'altro
|
||||
Requires: nfs-utils
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
BuildRequires: nethserver-devtools
|
||||
BuildRequires: systemd
|
||||
|
||||
%description
|
||||
LibreSchool NFS home profiles configuration
|
||||
@ -43,8 +48,9 @@ chkconfig rpcbind on
|
||||
UDPPort 111 \
|
||||
access private
|
||||
/sbin/e-smith/expand-template /etc/exports
|
||||
/sbin/service nfs start >/dev/null 2>&1 || :
|
||||
/sbin/service rpcbind start >/dev/null 2>&1 || :
|
||||
/sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml
|
||||
/usr/bin/systemctl --no-block start nfs >/dev/null 2>&1 || :
|
||||
/usr/bin/systemctl --no-block start rpmbind >/dev/null 2>&1 || :
|
||||
/usr/sbin/exportfs -r
|
||||
/sbin/e-smith/signal-event firewall-adjust
|
||||
/usr/bin/ldapmodify -Y EXTERNAL -f /usr/share/libreschool-nfs/patch.ldif >/dev/null 2>&1 || :
|
||||
@ -55,10 +61,11 @@ chkconfig rpcbind on
|
||||
#fi
|
||||
if [ "$1" = 0 ]; then
|
||||
#uninstallation
|
||||
/sbin/e-smith/expand-template /etc/exports
|
||||
echo > /etc/exports
|
||||
/sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml
|
||||
/usr/sbin/exportfs -r
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Sat Nov 4 2017 Paolo Asperti <paolo@asperti.com> - 6.9-1
|
||||
- First release
|
||||
* Sun Apr 28 2019 Paolo Asperti <paolo@asperti.com> - 1.0-1.ns7
|
||||
- First release for NethServer 7
|
||||
|
3
root/etc/ansible/roles/nfs-client/handlers/main.yml
Normal file
3
root/etc/ansible/roles/nfs-client/handlers/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart libnss-ldap
|
||||
service: name=libnss-ldap state=restarted
|
154
root/etc/ansible/roles/nfs-client/tasks/main.yml
Normal file
154
root/etc/ansible/roles/nfs-client/tasks/main.yml
Normal file
@ -0,0 +1,154 @@
|
||||
---
|
||||
|
||||
- name: Installing nfs client packages
|
||||
apt:
|
||||
name: [ 'nfs-common' ]
|
||||
state: latest
|
||||
|
||||
- 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: 1
|
||||
dump: 0
|
||||
state: mounted
|
||||
|
||||
- name: Check if lightdm is installed
|
||||
shell: dpkg-query -W -f='${Status}' lightdm | grep 'install ok installed'
|
||||
register: lightdm_installed
|
||||
failed_when: no
|
||||
changed_when: no
|
||||
|
||||
- name: Check if gdm3 is installed
|
||||
shell: dpkg-query -W -f='${Status}' gdm3 | grep 'install ok installed'
|
||||
register: gdm3_installed
|
||||
failed_when: no
|
||||
changed_when: no
|
||||
|
||||
- name: Adjusting lightdm settings
|
||||
template:
|
||||
src: 'lightdm.conf'
|
||||
dest: '/usr/share/lightdm/lightdm.conf.d/50-libreschool.conf'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: 0644
|
||||
when: lightdm_installed.rc == 0
|
||||
|
||||
- name: Adjust gdm3 settings
|
||||
ini_file:
|
||||
path: /etc/gdm3/greeter.dconf-defaults
|
||||
section: org/gnome/login-screen
|
||||
option: disable-user-list
|
||||
value: "true"
|
||||
no_extra_spaces: yes
|
||||
when: gdm3_installed.rc == 0
|
||||
|
||||
- name: Set bind DN
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/binddn
|
||||
value: cn=ldapservice,dc=directory,dc=nh
|
||||
vtype: string
|
||||
|
||||
- name: Set root bind DN
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/rootbinddn
|
||||
value: cn=ldapservice,dc=directory,dc=nh
|
||||
vtype: string
|
||||
|
||||
- name: Set base DN
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/ldapns/base-dn
|
||||
value: dc=directory,dc=nh
|
||||
vtype: string
|
||||
|
||||
- name: Set login required
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/dblogin
|
||||
value: true
|
||||
vtype: boolean
|
||||
|
||||
- name: Set root login required
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/dbrootlogin
|
||||
value: true
|
||||
vtype: boolean
|
||||
|
||||
- name: Set ldap override
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/override
|
||||
value: true
|
||||
vtype: boolean
|
||||
|
||||
- name: Set move-to-debconf
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/move-to-debconf
|
||||
value: true
|
||||
vtype: boolean
|
||||
|
||||
|
||||
|
||||
|
||||
- name: Set pam password
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/pam_password
|
||||
value: md5
|
||||
vtype: select
|
||||
|
||||
|
||||
|
||||
|
||||
# TODO: use ansible variables
|
||||
- name: Set LDAP server
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/ldapns/ldap-server
|
||||
value: ldap://pdc.test.domain:389/
|
||||
vtype: string
|
||||
|
||||
- name: Set LDAP server version
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/ldapns/ldap_version
|
||||
value: 3
|
||||
vtype: select
|
||||
|
||||
- name: Set bind password
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/bindpw
|
||||
value: {{ lookup('file', '/var/lib/nethserver/secrets/ldapservice') }}
|
||||
vtype: password
|
||||
|
||||
- name: Set root bind password
|
||||
debconf:
|
||||
name: ldap-auth-config
|
||||
question: ldap-auth-config/rootbindpw
|
||||
value: {{ lookup('file', '/var/lib/nethserver/secrets/ldapservice') }}
|
||||
vtype: password
|
||||
|
||||
# - name: ldap configuration
|
||||
# template:
|
||||
# src: 'ldap.secret'
|
||||
# dest: '/etc/ldap.secret'
|
||||
# owner: 'root'
|
||||
# group: 'root'
|
||||
# mode: 0600
|
||||
|
||||
|
||||
- name: Installing client packages
|
||||
apt:
|
||||
name: [ 'ldap-auth-config' ]
|
||||
state: latest
|
9
root/etc/ansible/roles/nfs-client/templates/ldap.conf
Normal file
9
root/etc/ansible/roles/nfs-client/templates/ldap.conf
Normal file
@ -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
|
1
root/etc/ansible/roles/nfs-client/templates/ldap.secret
Normal file
1
root/etc/ansible/roles/nfs-client/templates/ldap.secret
Normal file
@ -0,0 +1 @@
|
||||
{{ lookup('file', '/var/lib/nethserver/secrets/ldapservice') }}
|
4
root/etc/ansible/roles/nfs-client/templates/lightdm.conf
Normal file
4
root/etc/ansible/roles/nfs-client/templates/lightdm.conf
Normal file
@ -0,0 +1,4 @@
|
||||
[Seat:*]
|
||||
allow-guest=false
|
||||
greeter-hide-users=true
|
||||
greeter-show-manual-login=true
|
@ -0,0 +1 @@
|
||||
- nfs-client
|
@ -1,12 +1,10 @@
|
||||
#
|
||||
# 50libreschool-nfs
|
||||
#
|
||||
{
|
||||
use esmith::InterfacesDB;
|
||||
my $ndb = esmith::InterfacesDB->open_ro() || return;
|
||||
{
|
||||
use esmith::NetworksDB;
|
||||
my $ndb = esmith::NetworksDB->open_ro() || return;
|
||||
my $LocalIP = $ndb->green()->prop('ipaddr') || return;
|
||||
my $LocalNM = $ndb->green()->prop('netmask') || return;
|
||||
sprintf "/var/lib/nethserver/home\t%s/%s(rw,no_root_squash,sync,no_subtree_check)\n", $LocalIP, $LocalNM;
|
||||
sprintf "/var/lib/nethserver/home\t%s/%s(rw,no_root_squash,sync,no_subtree_check)\n", $LocalIP, $LocalNM;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user