-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup-idmclient.yml
54 lines (46 loc) · 1.53 KB
/
setup-idmclient.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: Register host to IdM
hosts: all
vars:
ipaclient_mkhomedir: true
ipaclient_ntp_servers:
- ntp.arrowdemo.se
- time.cloudflare.com
ipaclient_ssh_trust_dns: true
use_inventory_for_hostname: false
tasks:
- name: Get the short hostname from inventory
# Normally there is dot in fqdn, vmware inventory has _ as separator
set_fact:
short_name: "{{ inventory_hostname | regex_search('^[^_.]*') }}"
when: use_inventory_for_hostname
- name: setup hostname
hostname:
name: "{{ short_name | mandatory }}.{{ ipaserver_domain }}"
use: systemd
- name: create hosts entry for idm master
lineinfile:
path: /etc/hosts
regexp: ".*{{ ipaserver_master_name }}.*"
line: >-
{{ ipaserver_master_ip }}
{{ ipaserver_master_name }}.{{ ipaserver_domain }}
{{ ipaserver_master_name }}
- name: create hosts entry for idm replica
lineinfile:
path: /etc/hosts
regexp: ".*{{ ipaserver_replica_name }}.*"
line: >-
{{ ipaserver_replica_ip }}
{{ ipaserver_replica_name }}.{{ ipaserver_domain }}
{{ ipaserver_replica_name }}
- name: add to IdM
vars:
ipaclients:
- "{{ short_name | mandatory }}.{{ ipaserver_domain }}"
state: present
ipasssd_enable_dns_updates: true
ipaclient_domain: "{{ ipaserver_domain }}"
ipaclient_force_join: true
include_role:
name: freeipa.ansible_freeipa.ipaclient