Skip to content

Commit 40b6cff

Browse files
committed
move freeipa validation back to validate task
1 parent 014c70d commit 40b6cff

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

ansible/roles/freeipa/tasks/server.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
# Based on https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/installing_identity_management/preparing-the-system-for-ipa-server-installation_installing-identity-management#host-name-and-dns-requirements-for-ipa_preparing-the-system-for-ipa-server-installation
22

3-
- name: Get hostname as reported by command
4-
command: hostname
5-
register: _freeipa_validate_hostname
6-
changed_when: false
7-
8-
- name: Ensure hostname is fully-qualified
9-
# see section 2.7 of redhat guide to installing identity management
10-
assert:
11-
that: _freeipa_validate_hostname.stdout | split('.') | length >= 3
12-
fail_msg: "freeipa_server hostname '{{ _freeipa_validate_hostname.stdout }}' is not fully-qualified (a.b.c)"
13-
14-
- name: Check for virtual servers in httpd configuration of freeipa_server
15-
# e.g. fatimage with OOD config; community.general.ipa_host fails with "401 Unauthorized: No session cookie found"
16-
# https://lists.fedoraproject.org/archives/list/[email protected]/message/7RH7XDFR35KDPYJ7AQCQI2H2EOWIZCWA/
17-
find:
18-
path: /etc/httpd/conf.d/
19-
contains: '<VirtualHost'
20-
read_whole_file: false
21-
pattern: '*.conf'
22-
register: _find_httpd_conf
23-
24-
- name: Assert no other name-based virtual servers on freeipa_server
25-
assert:
26-
that: item.path == '/etc/httpd/conf.d/ssl.conf' # this one is OK
27-
fail_msg: "freeipa_server host must not have other virtual servers defined: see {{ item.path }}"
28-
loop: "{{ _find_httpd_conf.files }}"
29-
303
- name: Install freeipa server packages
314
dnf:
325
name: '@idm:DL1/dns'

ansible/roles/freeipa/tasks/validate.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
- name: Get hostname as reported by command
2+
command: hostname
3+
register: _freeipa_validate_hostname
4+
changed_when: false
5+
when: "'freeipa_server' in group_names"
6+
7+
- name: Ensure hostname is fully-qualified
8+
# see section 2.7 of redhat guide to installing identity management
9+
assert:
10+
that: _freeipa_validate_hostname.stdout | split('.') | length >= 3
11+
fail_msg: "freeipa_server hostname '{{ _freeipa_validate_hostname.stdout }}' is not fully-qualified (a.b.c)"
12+
when: "'freeipa_server' in group_names"
13+
14+
- name: Check for virtual servers in httpd configuration of freeipa_server
15+
# e.g. fatimage with OOD config; community.general.ipa_host fails with "401 Unauthorized: No session cookie found"
16+
# https://lists.fedoraproject.org/archives/list/[email protected]/message/7RH7XDFR35KDPYJ7AQCQI2H2EOWIZCWA/
17+
find:
18+
path: /etc/httpd/conf.d/
19+
contains: '<VirtualHost'
20+
read_whole_file: false
21+
pattern: '*.conf'
22+
register: _find_httpd_conf
23+
when: "'freeipa_server' in group_names"
24+
25+
- name: Assert no other name-based virtual servers on freeipa_server
26+
assert:
27+
that: item.path == '/etc/httpd/conf.d/ssl.conf' # this one is OK
28+
fail_msg: "freeipa_server host must not have other virtual servers defined: see {{ item.path }}"
29+
loop: "{{ _find_httpd_conf.files }}"
30+
when: "'freeipa_server' in group_names"
31+
132
- name: Ensure control node has persistent storage defined
233
assert:
334
that: "{{ 'appliances_state_dir' in hostvars[groups['control'] | first ] }}"

0 commit comments

Comments
 (0)