Add task 'nis.yml'.
This commit is contained in:
parent
059d158680
commit
b0d212deec
@ -86,6 +86,14 @@ samba_shares:
|
|||||||
- margit
|
- margit
|
||||||
- musa
|
- musa
|
||||||
|
|
||||||
|
nis_domain: sprachenatelier.netz
|
||||||
|
|
||||||
|
nis_server_address: 192.168.92.10
|
||||||
|
|
||||||
|
nis_common_packages:
|
||||||
|
- nis
|
||||||
|
- nscd
|
||||||
|
|
||||||
nis_deleted_user:
|
nis_deleted_user:
|
||||||
- name: test-user
|
- name: test-user
|
||||||
- name: gast
|
- name: gast
|
||||||
|
1
hosts
1
hosts
@ -43,6 +43,7 @@ cl106.sprachenatelier.netz
|
|||||||
cl107.sprachenatelier.netz
|
cl107.sprachenatelier.netz
|
||||||
cl108.sprachenatelier.netz
|
cl108.sprachenatelier.netz
|
||||||
cl109.sprachenatelier.netz
|
cl109.sprachenatelier.netz
|
||||||
|
thunderbolt.local.netz
|
||||||
|
|
||||||
[file_server]
|
[file_server]
|
||||||
file-spr.sprachenatelier.netz
|
file-spr.sprachenatelier.netz
|
||||||
|
@ -8,6 +8,14 @@
|
|||||||
- import_tasks: nfs.yml
|
- import_tasks: nfs.yml
|
||||||
tags:
|
tags:
|
||||||
- nfs
|
- nfs
|
||||||
|
|
||||||
|
# tags supported inside nfs.yml:
|
||||||
|
#
|
||||||
|
# nis-install
|
||||||
|
- import_tasks: nis.yml
|
||||||
|
tags:
|
||||||
|
- nis
|
||||||
|
|
||||||
# tags supported inside nis_samba_user.yml:
|
# tags supported inside nis_samba_user.yml:
|
||||||
#
|
#
|
||||||
# samba-user
|
# samba-user
|
||||||
|
100
roles/common/tasks/nis.yml
Normal file
100
roles/common/tasks/nis.yml
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: (nis.yml) Set (nis) default domain (/etc/defaultdomain)
|
||||||
|
template:
|
||||||
|
dest: /etc/defaultdomain
|
||||||
|
src: etc/defaultdomain.j2
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
tags:
|
||||||
|
nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Create preconfigured /etc/yp.conf on nis clients
|
||||||
|
template:
|
||||||
|
dest: /etc/yp.conf
|
||||||
|
src: etc/yp.conf.j2
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
when: "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
tags:
|
||||||
|
nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Install nis common packages
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
with_items: "{{ nis_common_packages }}"
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Add '+::::::' to file /etc/passwd
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/passwd
|
||||||
|
line: '+::::::'
|
||||||
|
insertafter: EOF
|
||||||
|
state: present
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
when: "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Add '+:::' to file /etc/group
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/group
|
||||||
|
line: '+:::'
|
||||||
|
insertafter: EOF
|
||||||
|
state: present
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
when: "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Add '+::::::::' to file /etc/shadow
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/shadow
|
||||||
|
line: '+::::::::'
|
||||||
|
insertafter: EOF
|
||||||
|
state: present
|
||||||
|
owner: root
|
||||||
|
group: shadow
|
||||||
|
mode: '0640'
|
||||||
|
when: "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Check if file '/etc/nsswitch.conf.ORIG' exists
|
||||||
|
stat:
|
||||||
|
path: /etc/nsswitch.conf.ORIG
|
||||||
|
register: nsswitch_conf_orig_exists
|
||||||
|
when:
|
||||||
|
- "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Backup existing file /etc/nsswitch.conf
|
||||||
|
command: cp -a /etc/nsswitch.conf /etc/nsswitch.conf.ORIG
|
||||||
|
when:
|
||||||
|
- "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
- nsswitch_conf_orig_exists.stat.exists == False
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
- name: (nis.yml) Adjust file /etc/nsswitch.conf
|
||||||
|
replace:
|
||||||
|
path: /etc/nsswitch.conf
|
||||||
|
regexp: '(hosts:\s+files)\s+([^nis].*)'
|
||||||
|
replace: '\1 nis \2'
|
||||||
|
when: "groups['nis_client']|string is search(inventory_hostname)"
|
||||||
|
tags:
|
||||||
|
- nis-install
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# /etc/defaul/nis
|
||||||
|
# /etc/systemd/system/systemd-logind.service.d/nis_allow_network.conf
|
||||||
|
# /etc/systemd/system/rpcbind.socket.d/override.conf
|
1
roles/common/templates/etc/defaultdomain.j2
Normal file
1
roles/common/templates/etc/defaultdomain.j2
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{ nis_domain }}
|
24
roles/common/templates/etc/yp.conf.j2
Normal file
24
roles/common/templates/etc/yp.conf.j2
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
# /etc/yp.conf - ypbind configuration file
|
||||||
|
# Valid entries are
|
||||||
|
#
|
||||||
|
# domain NISDOMAIN server HOSTNAME
|
||||||
|
# Use server HOSTNAME for the domain NISDOMAIN.
|
||||||
|
#
|
||||||
|
# domain NISDOMAIN broadcast
|
||||||
|
# Use broadcast on the local net for domain NISDOMAIN
|
||||||
|
#
|
||||||
|
# domain NISDOMAIN slp
|
||||||
|
# Query local SLP server for ypserver supporting NISDOMAIN
|
||||||
|
#
|
||||||
|
# ypserver HOSTNAME
|
||||||
|
# Use server HOSTNAME for the local domain. The
|
||||||
|
# IP-address of server must be listed in /etc/hosts.
|
||||||
|
#
|
||||||
|
# broadcast
|
||||||
|
# If no server for the default domain is specified or
|
||||||
|
# none of them is rechable, try a broadcast call to
|
||||||
|
# find a server.
|
||||||
|
#
|
||||||
|
domain {{ nis_domain }} server {{ nis_server_address }}
|
Loading…
Reference in New Issue
Block a user