Skip to content

Commit e600529

Browse files
authored
Update freeipa_server role (#219)
Signed-off-by: Webster Mudge <[email protected]>
1 parent 72a4128 commit e600529

File tree

17 files changed

+931
-313
lines changed

17 files changed

+931
-313
lines changed

roles/freeipa_server/README.md

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,61 @@
1-
<!--
2-
Copyright 2024 Cloudera, Inc.
1+
# freeipa_server
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+
Install FreeIPA server with support for DNS, Kerberos, TLS, and LDAP.
74

8-
https://www.apache.org/licenses/LICENSE-2.0
5+
The role is typically used to support an internal domain, e.g. `.internal`.
96

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-
-->
7+
The role will:
8+
- Enable local IPv6 networking, per FreeIPA installation requirements.
9+
- Install FreeIPA server packages.
10+
- Install and configure FreeIPA server for DNS, Kerberos, TLS, and LDAP.
11+
- Set up an ACL for DNS recursion.
12+
- Establish DNS zones for the defined domain.
1613

17-
# freeipa_server
14+
## Requirements
15+
16+
None.
17+
18+
## Dependencies
19+
20+
- `freeipa.ansible`
21+
22+
## Examples
23+
24+
```yaml
25+
- name: Install FreeIPA server for DNS, Kerberos, TLS, and LDAP.
26+
ansible.builtin.import_role:
27+
name: freeipa_server
28+
vars:
29+
ipaserver_forwarders: [ "1.1.1.1" ]
30+
ipaserver_cidr: [ "10.0.0.1/20" ]
31+
ipaserver_recursion_acl_cidr: [ "10.0.0.1/20" ]
32+
ipaserver_domain: "example.internal"
33+
ipaserver_realm: "EXAMPLE.INTERNAL"
34+
ipaadmin_password: "krb_example"
35+
ipadm_password: "dir_example"
36+
```
37+
38+
To bind to explicit IP addresses, provide optional (push-down) parameters:
39+
40+
```yaml
41+
ipaserver_ip_addresses: [ "10.0.0.14"] # Bind DNS to these IP addresses only
42+
ipaclient_ip_address: "10.0.1.122" # Join with this IP address
43+
```
44+
45+
## License
46+
47+
```
48+
Copyright 2024 Cloudera, Inc.
49+
50+
Licensed under the Apache License, Version 2.0 (the "License");
51+
you may not use this file except in compliance with the License.
52+
You may obtain a copy of the License at
53+
54+
https://www.apache.org/licenses/LICENSE-2.0
55+
56+
Unless required by applicable law or agreed to in writing, software
57+
distributed under the License is distributed on an "AS IS" BASIS,
58+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59+
See the License for the specific language governing permissions and
60+
limitations under the License.
61+
```
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
---
2-
3-
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
1+
# Copyright 2024 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_realm: "{{ krb5_realm | upper }}"
18-
#ipaserver_domain: "{{ krb5_domain | default(krb5_realm | lower) }}"
19-
#ipaserver_setup_firewalld: "no"
20-
#ipaserver_setup_dns: "{{ freeipa_autodns | default(omit) }}"
21-
#ipaserver_auto_forwarders:
22-
#ipadm_password:
15+
# ipaserver_packages: []
16+
17+
ipaserver_domain: "{{ undef(hint='Please define the DNS domain') }}"
18+
ipaserver_realm: "{{ undef(hint='Please define the Kerberos realm') }}"
19+
20+
ipaserver_cidr: "{{ undef(hint='Please define the CIDR list under management for the DNS service.') }}"
21+
ipaserver_forwarders: "{{ undef(hint='Please define the upstream DNS servers') }}"
22+
ipaserver_recursion_acl_cidr: "{{ undef(hint='Please define the CIDR list for the DNS recursion ACL') }}"
23+
24+
ipaserver_ca_subject: "CN=CLDR-RootCA,O={{ ipaserver_domain }}"
25+
26+
ipaadmin_principal: admin
27+
ipaadmin_password: "{{ undef(hint='Please define the FreeIPA administrator principal password') }}"
2328

24-
# ipaserver_recursion_acl_cidr:
25-
ipaserver_resolv_nameservers: ["8.8.8.8"]
26-
ipaserver_server_recursion: true
27-
enable_dns: false
28-
needs_python2: true
29+
ipadm_password: "{{ undef(hint='Please define the FreeIPA Directory Manager admin password') }}"
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
---
2-
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
1+
# Copyright 2024 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+
# named-pkcs11 is masked, so restart named
16+
- name: Restart DNS
1717
ansible.builtin.service:
18-
name: NetworkManager
19-
state: restarted
20-
21-
- name: Restart dns
22-
ansible.builtin.service:
23-
name: named-pkcs11
18+
name: named
2419
state: restarted
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
argument_specs:
16+
main:
17+
short_description: Set up FreeIPA server
18+
description: |
19+
Set up FreeIPA server with support for DNS, Kerberos, TLS, and LDAP.
20+
Optionally, install the FreeIPA server packages.
21+
author: Cloudera Labs
22+
options:
23+
ipaserver_packages:
24+
description:
25+
- List of FreeIPA packages to install.
26+
- If not defined, the role will default to the packages defined in the P(freeipa.ansible_freeipa.ipaserver#role) role.
27+
type: list
28+
elements: str
29+
ipaserver_domain:
30+
description:
31+
- Domain name to set as the root zone.
32+
required: true
33+
ipaserver_realm:
34+
description:
35+
- Realm to set for the Kerberos service.
36+
required: true
37+
ipaserver_cidr:
38+
description:
39+
- List of CIDR blocks to manage for the DNS service.
40+
type: list
41+
elements: str
42+
required: true
43+
ipaserver_forwarders:
44+
description:
45+
- List of upstream name servers for the DNS service.
46+
type: list
47+
elements: str
48+
required: true
49+
ipaserver_recursion_acl_cidr:
50+
description:
51+
- List of CIDR blocks to define the access ACL for DNS recursion.
52+
type: list
53+
elements: str
54+
required: true
55+
ipaserver_ca_subject:
56+
description:
57+
- Certificate Authority subject for the self-signed root CA.
58+
default: "CN=CLDR-RootCA,O=ipaserver_domain"
59+
ipaadmin_principal:
60+
description:
61+
- Kerberos principal for the FreeIPA administrator account.
62+
default: admin
63+
ipaadmin_password:
64+
description:
65+
- Password for the FreeIPA adminstrator Kerberos principal.
66+
required: true
67+
ipadm_password:
68+
description:
69+
- Password for the FreeIPA Directory Services administrator.
70+
required: true

roles/freeipa_server/meta/main.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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: all
17+
gather_facts: true
18+
become: true
19+
tasks:
20+
- name: Extract the VPC subnet ID from the Molecule platform configuration
21+
ansible.builtin.set_fact:
22+
test_subnet_id: "{{ molecule_yml.platforms | selectattr('name', 'eq', inventory_hostname) | map(attribute='vpc_subnet_id') | first }}"
23+
24+
- name: Retrieve the VPC subnet details
25+
amazon.aws.ec2_vpc_subnet_info:
26+
subnet_id: "{{ test_subnet_id }}"
27+
register: __subnet
28+
become: false
29+
delegate_to: localhost
30+
31+
- name: Retrieve the VPC details
32+
amazon.aws.ec2_vpc_net_info:
33+
vpc_ids: "{{ __subnet.subnets | map(attribute='vpc_id') | first }}"
34+
register: __vpc
35+
become: false
36+
delegate_to: localhost
37+
38+
- name: Install FreeIPA server
39+
ansible.builtin.import_role:
40+
name: freeipa_server
41+
vars:
42+
# See https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html
43+
vpc_cidr: "{{ __vpc.vpcs | map(attribute='cidr_block') | list }}"
44+
ipaserver_cidr: "{{ vpc_cidr }}"
45+
ipaserver_forwarders: "{{ vpc_cidr | map('ansible.utils.ipmath', '2') | list }}"
46+
ipaserver_recursion_acl_cidr: "{{ vpc_cidr }}"

0 commit comments

Comments
 (0)