Skip to content

Commit 866731e

Browse files
authored
Update freeipa_client role (#220)
Signed-off-by: Webster Mudge <wmudge@cloudera.com>
1 parent e600529 commit 866731e

File tree

15 files changed

+975
-174
lines changed

15 files changed

+975
-174
lines changed

roles/freeipa_client/README.md

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,54 @@
1-
<!--
2-
Copyright 2024 Cloudera, Inc.
1+
# freeipa_client
32

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
3+
Set up FreeIPA client, registering the host with a FreeIPA server, configured for DNS updates.
74

8-
https://www.apache.org/licenses/LICENSE-2.0
5+
The role will:
6+
- Update `cloud-init` configuration to disable hostname management, if needed
7+
- Update the hostname to the Ansible `inventory_hostname`
8+
- Update `/etc/hosts` with the Ansible `inventory_hostname` and default IPv4 address
9+
- Create and activate a `cldr` connection ethernet profile in `NetworkManager` for the Ansible default IPv4 alias to set domain search and name servers, if needed
10+
- Update the DHCP client configuration to set domain search and name servers, if needed
11+
- Update `/etc/resolv.conf` directly to set domain search and name servers, if needed
12+
- Set the SSSD configuration to enumerate users and groups, if needed.
13+
- Install defined FreeIPA client packages, if needed
14+
- Set up and register FreeIPA client with the FreeIPA servers.
915

10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
-->
16+
## Requirements
1617

17-
# freeipa_client
18+
None.
19+
20+
## Dependencies
21+
22+
- `freeipa.ansible_freeipa.ipaclient`
23+
24+
## Examples
25+
26+
```yaml
27+
- name: Install FreeIPA client
28+
ansible.builtin.import_role:
29+
name: freeipa_client
30+
vars:
31+
ipaclient_domain: example.internal
32+
ipaclient_realm: EXAMPLE.INTERNAL
33+
ipaclient_servers: [ "freeipa.example.internal" ]
34+
ipaclient_dns_servers: [ "10.0.0.4" ]
35+
ipaadmin_password: "SomEpassWord"
36+
```
37+
38+
## License
39+
40+
```
41+
Copyright 2024 Cloudera, Inc.
42+
43+
Licensed under the Apache License, Version 2.0 (the "License");
44+
you may not use this file except in compliance with the License.
45+
You may obtain a copy of the License at
46+
47+
https://www.apache.org/licenses/LICENSE-2.0
48+
49+
Unless required by applicable law or agreed to in writing, software
50+
distributed under the License is distributed on an "AS IS" BASIS,
51+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52+
See the License for the specific language governing permissions and
53+
limitations under the License.
54+
```
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
---
2-
3-
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
1+
# Copyright 2025 Cloudera, Inc.
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");
64
# you may not use this file except in compliance with the License.
75
# You may obtain a copy of the License at
86
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# https://www.apache.org/licenses/LICENSE-2.0
108
#
119
# Unless required by applicable law or agreed to in writing, software
1210
# distributed under the License is distributed on an "AS IS" BASIS,
1311
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1412
# See the License for the specific language governing permissions and
1513
# limitations under the License.
1614

17-
# ipaserver_domain:
18-
# ipaserver_realm:
19-
# ipa_hosts: # List of FQDN of IPA hosts
20-
# ipa_server_ips: # List of IP of IPA hosts
21-
# ipaadmin_principal:
22-
# ipaadmin_password:
15+
# ipaclient_packages: []
16+
17+
ipaclient_domain: "{{ undef(hint='Please define the DNS domain') }}"
18+
ipaclient_realm: "{{ undef(hint='Please define the Kerberos realm') }}"
19+
20+
ipaclient_servers: "{{ undef(hint='Please define the hostnames of the FreeIPA servers') }}"
21+
ipaclient_dns_servers: "{{ undef(hint='Please define the IP addresses of the DNS servers') }}"
22+
23+
ipaclient_sssd_enumeration: false
2324

24-
enable_dns: false
25-
fallback_nameservers: ["8.8.8.8"]
25+
ipaadmin_principal: admin
26+
ipaadmin_password: "{{ undef(hint='Please define the FreeIPA adminstrator principal password') }}"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
Copyright 2025 Cloudera, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
18+
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
19+
<busconfig>
20+
<limit name="service_start_timeout">360000</limit>
21+
<limit name="reply_timeout">360000</limit>
22+
</busconfig>
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
1-
---
2-
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
1+
# Copyright 2025 Cloudera, Inc.
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
65
# You may obtain a copy of the License at
76
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# https://www.apache.org/licenses/LICENSE-2.0
98
#
109
# Unless required by applicable law or agreed to in writing, software
1110
# distributed under the License is distributed on an "AS IS" BASIS,
1211
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
# See the License for the specific language governing permissions and
1413
# limitations under the License.
1514

16-
- name: Restart network
15+
- name: Restart host
16+
ansible.builtin.reboot:
17+
18+
- name: Restart SSSD
19+
ansible.builtin.service:
20+
name: "{{ sssd_service }}"
21+
state: restarted
22+
23+
# RHEL only
24+
- name: Restart DBUS
25+
ansible.builtin.systemd:
26+
name: dbus
27+
enabled: true
28+
masked: false
29+
state: restarted
30+
31+
# RHEL only
32+
- name: Restart logind
1733
ansible.builtin.service:
18-
name: NetworkManager
34+
name: systemd-logind
1935
state: restarted
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2025 Cloudera, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
argument_specs:
16+
main:
17+
short_description: Set up FreeIPA client
18+
description:
19+
- Set up FreeIPA client, registering the host with a FreeIPA server, configured for DNS updates.
20+
- Set up DNS search domain and DNS forwarders for name resolution.
21+
- Install either defined or default FreeIPA client packages.
22+
- Optionally, configure SSSD to enumerate users and groups.
23+
author: Cloudera Labs
24+
version_added: "5.0.0"
25+
options:
26+
ipaclient_packages:
27+
description:
28+
- List of FreeIPA packages to install.
29+
- If not defined, the role will default to the packages defined in the
30+
L(freeipa.ansible_freeipa.ipaclient,https://github.com/freeipa/ansible-freeipa/tree/master/roles/ipaclient) role.
31+
type: list
32+
elements: str
33+
ipaclient_domain:
34+
description:
35+
- Domain name for DNS search and FreeIPA registration.
36+
required: true
37+
ipaclient_realm:
38+
description:
39+
- Realm for the Kerberos service.
40+
required: true
41+
ipaclient_servers:
42+
description:
43+
- List of hostnames of the FreeIPA servers.
44+
type: list
45+
elements: str
46+
required: true
47+
ipaclient_dns_servers:
48+
description:
49+
- List of IP address of the DNS servers to use for resolution.
50+
- Typically, the IP addresses of the FreeIPA DNS servers.
51+
type: list
52+
elements: str
53+
required: true
54+
ipaclient_sssd_enumeration:
55+
description:
56+
- Flag to enable the C(enumeration) setting in the SSSD configuration file.
57+
type: bool
58+
default: false
59+
ipaadmin_principal:
60+
description:
61+
- Principal of the FreeIPA user with elevated priviledges allowing host registration.
62+
default: admin
63+
ipaadmin_password:
64+
description:
65+
- Password of the FreeIPA user with elevated priviledges allowing host registration.
66+
required: true

roles/freeipa_client/meta/main.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2024 Cloudera, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
- name: Converge
16+
hosts: clients
17+
gather_facts: true
18+
become: true
19+
tasks:
20+
- name: Gather network details from the FreeIPA servers
21+
ansible.builtin.setup:
22+
gather_subset: default_ipv4
23+
delegate_to: "{{ __ipa_server }}"
24+
delegate_facts: true
25+
loop: "{{ groups['server'] }}"
26+
loop_control:
27+
loop_var: __ipa_server
28+
29+
- name: Install FreeIPA client
30+
ansible.builtin.import_role:
31+
name: freeipa_client
32+
vars:
33+
ipaclient_domain: "{{ ipaserver_domain }}"
34+
ipaclient_realm: "{{ ipaserver_realm }}"
35+
ipaclient_servers: "{{ groups['server'] }}" # hostnames of FreeIPA servers
36+
ipaclient_dns_servers: "{{ groups['server'] | map('extract', hostvars, ['ansible_default_ipv4', 'address']) | list }}"

0 commit comments

Comments
 (0)