sprachenatelier/roles/common/tasks/nis.yml
2019-08-28 04:01:06 +02:00

101 lines
2.4 KiB
YAML

---
- 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