|
75 | 75 | Array[String] $ldap_tls_cipher_suite = ['HIGH','-SSLv2'], |
76 | 76 | Boolean $use_service_discovery = true, |
77 | 77 | ) { |
78 | | - if $use_service_discovery { |
79 | | - $_ipa_server = ['_srv_'] + $ipa_server |
80 | | - } |
81 | | - else { |
82 | | - $_ipa_server = $ipa_server |
| 78 | + # Build configuration lines in order (matching expected test output) |
| 79 | + # IPA domain configuration (required) |
| 80 | + $ipa_domain_line = ["ipa_domain = ${ipa_domain}"] |
| 81 | + |
| 82 | + # IPA server configuration with service discovery logic |
| 83 | + $ipa_server_line = $use_service_discovery ? { |
| 84 | + true => ["ipa_server = _srv_,${ipa_server.join(',')}"], |
| 85 | + false => ["ipa_server = ${ipa_server.join(',')}"] |
83 | 86 | } |
84 | 87 |
|
| 88 | + # IPA backup server configuration (optional) |
| 89 | + $ipa_backup_server_line = $ipa_backup_server ? { undef => [], default => ["ipa_backup_server = ${ipa_backup_server.join(',')}"] } |
| 90 | + |
| 91 | + # IPA boolean settings (required) |
| 92 | + $ipa_enable_dns_sites_line = ["ipa_enable_dns_sites = ${ipa_enable_dns_sites}"] |
| 93 | + $ipa_hostname_line = ["ipa_hostname = ${ipa_hostname}"] |
| 94 | + $ipa_server_mode_line = ["ipa_server_mode = ${ipa_server_mode}"] |
| 95 | + |
| 96 | + # Dynamic DNS settings |
| 97 | + $dyndns_auth_line = ["dyndns_auth = ${dyndns_auth}"] |
| 98 | + $dyndns_force_tcp_line = $dyndns_force_tcp ? { undef => [], default => ["dyndns_force_tcp = ${dyndns_force_tcp}"] } |
| 99 | + $dyndns_iface_line = $dyndns_iface ? { undef => [], default => ["dyndns_iface = ${dyndns_iface.join(',')}"] } |
| 100 | + $dyndns_refresh_interval_line = $dyndns_refresh_interval ? { undef => [], default => ["dyndns_refresh_interval = ${dyndns_refresh_interval}"] } |
| 101 | + $dyndns_server_line = $dyndns_server ? { undef => [], default => ["dyndns_server = ${dyndns_server}"] } |
| 102 | + $dyndns_ttl_line = $dyndns_ttl ? { undef => [], default => ["dyndns_ttl = ${dyndns_ttl}"] } |
| 103 | + $dyndns_update_line = ["dyndns_update = ${dyndns_update}"] |
| 104 | + $dyndns_update_ptr_line = $dyndns_update_ptr ? { undef => [], default => ["dyndns_update_ptr = ${dyndns_update_ptr}"] } |
| 105 | + |
| 106 | + # IPA-specific optional settings |
| 107 | + $ipa_automount_location_line = $ipa_automount_location ? { undef => [], default => ["ipa_automount_location = ${ipa_automount_location}"] } |
| 108 | + $ipa_hbac_refresh_line = $ipa_hbac_refresh ? { undef => [], default => ["ipa_hbac_refresh = ${ipa_hbac_refresh}"] } |
| 109 | + $ipa_hbac_search_base_line = $ipa_hbac_search_base ? { undef => [], default => ["ipa_hbac_search_base = ${ipa_hbac_search_base}"] } |
| 110 | + $ipa_hbac_selinux_line = $ipa_hbac_selinux ? { undef => [], default => ["ipa_hbac_selinux = ${ipa_hbac_selinux}"] } |
| 111 | + $ipa_host_search_base_line = $ipa_host_search_base ? { undef => [], default => ["ipa_host_search_base = ${ipa_host_search_base}"] } |
| 112 | + $ipa_master_domains_search_base_line = $ipa_master_domains_search_base ? { undef => [], default => ["ipa_master_domains_search_base = ${ipa_master_domains_search_base}"] } |
| 113 | + $ipa_selinux_search_base_line = $ipa_selinux_search_base ? { undef => [], default => ["ipa_selinux_search_base = ${ipa_selinux_search_base}"] } |
| 114 | + $ipa_subdomains_search_base_line = $ipa_subdomains_search_base ? { undef => [], default => ["ipa_subdomains_search_base = ${ipa_subdomains_search_base}"] } |
| 115 | + $ipa_views_search_base_line = $ipa_views_search_base ? { undef => [], default => ["ipa_views_search_base = ${ipa_views_search_base}"] } |
| 116 | + |
| 117 | + # Kerberos settings |
| 118 | + $krb5_confd_path_line = $krb5_confd_path ? { undef => [], default => ["krb5_confd_path = ${krb5_confd_path}"] } |
| 119 | + $krb5_realm_line = $krb5_realm ? { undef => [], default => ["krb5_realm = ${krb5_realm}"] } |
| 120 | + $krb5_store_password_if_offline_line = ["krb5_store_password_if_offline = ${krb5_store_password_if_offline}"] |
| 121 | + |
| 122 | + # LDAP TLS settings (required) |
| 123 | + $ldap_tls_cacert_line = ["ldap_tls_cacert = ${ldap_tls_cacert}"] |
| 124 | + $ldap_tls_cipher_suite_line = ["ldap_tls_cipher_suite = ${ldap_tls_cipher_suite.join(':')}"] |
| 125 | + |
| 126 | + # Combine all lines in order |
| 127 | + $config_lines = ( |
| 128 | + $ipa_domain_line + |
| 129 | + $ipa_server_line + |
| 130 | + $ipa_backup_server_line + |
| 131 | + $ipa_enable_dns_sites_line + |
| 132 | + $ipa_hostname_line + |
| 133 | + $ipa_server_mode_line + |
| 134 | + $dyndns_auth_line + |
| 135 | + $dyndns_force_tcp_line + |
| 136 | + $dyndns_iface_line + |
| 137 | + $dyndns_refresh_interval_line + |
| 138 | + $dyndns_server_line + |
| 139 | + $dyndns_ttl_line + |
| 140 | + $dyndns_update_line + |
| 141 | + $dyndns_update_ptr_line + |
| 142 | + $ipa_automount_location_line + |
| 143 | + $ipa_hbac_refresh_line + |
| 144 | + $ipa_hbac_search_base_line + |
| 145 | + $ipa_hbac_selinux_line + |
| 146 | + $ipa_host_search_base_line + |
| 147 | + $ipa_master_domains_search_base_line + |
| 148 | + $ipa_selinux_search_base_line + |
| 149 | + $ipa_subdomains_search_base_line + |
| 150 | + $ipa_views_search_base_line + |
| 151 | + $krb5_confd_path_line + |
| 152 | + $krb5_realm_line + |
| 153 | + $krb5_store_password_if_offline_line + |
| 154 | + $ldap_tls_cacert_line + |
| 155 | + $ldap_tls_cipher_suite_line |
| 156 | + ) |
| 157 | + |
| 158 | + # Join all configuration lines |
| 159 | + $content = $config_lines.join("\n") |
| 160 | + |
85 | 161 | sssd::config::entry { "puppet_provider_${name}_ipa": |
86 | | - content => epp( |
87 | | - "${module_name}/provider/ipa.epp", |
88 | | - { |
89 | | - 'title' => $title, |
90 | | - 'ipa_domain' => $ipa_domain, |
91 | | - 'ipa_server' => $ipa_server, |
92 | | - 'ipa_backup_server' => $ipa_backup_server, |
93 | | - 'ipa_enable_dns_sites' => $ipa_enable_dns_sites, |
94 | | - 'ipa_hostname' => $ipa_hostname, |
95 | | - 'ipa_server_mode' => $ipa_server_mode, |
96 | | - 'dyndns_auth' => $dyndns_auth, |
97 | | - 'dyndns_force_tcp' => $dyndns_force_tcp, |
98 | | - 'dyndns_iface' => $dyndns_iface, |
99 | | - 'dyndns_refresh_interval' => $dyndns_refresh_interval, |
100 | | - 'dyndns_server' => $dyndns_server, |
101 | | - 'dyndns_ttl' => $dyndns_ttl, |
102 | | - 'dyndns_update' => $dyndns_update, |
103 | | - 'dyndns_update_ptr' => $dyndns_update_ptr, |
104 | | - 'ipa_automount_location' => $ipa_automount_location, |
105 | | - 'ipa_hbac_refresh' => $ipa_hbac_refresh, |
106 | | - 'ipa_hbac_search_base' => $ipa_hbac_search_base, |
107 | | - 'ipa_hbac_selinux' => $ipa_hbac_selinux, |
108 | | - 'ipa_host_search_base' => $ipa_host_search_base, |
109 | | - 'ipa_master_domains_search_base' => $ipa_master_domains_search_base, |
110 | | - 'ipa_selinux_search_base' => $ipa_selinux_search_base, |
111 | | - 'ipa_subdomains_search_base' => $ipa_subdomains_search_base, |
112 | | - 'ipa_views_search_base' => $ipa_views_search_base, |
113 | | - 'krb5_confd_path' => $krb5_confd_path, |
114 | | - 'krb5_realm' => $krb5_realm, |
115 | | - 'krb5_store_password_if_offline' => $krb5_store_password_if_offline, |
116 | | - 'ldap_tls_cacert' => $ldap_tls_cacert, |
117 | | - 'ldap_tls_cipher_suite' => $ldap_tls_cipher_suite, |
118 | | - 'use_service_discovery' => $use_service_discovery, |
119 | | - } |
120 | | - ), |
| 162 | + content => epp("${module_name}/provider/ipa.epp", { |
| 163 | + 'title' => $title, |
| 164 | + 'content' => $content, |
| 165 | + }), |
121 | 166 | } |
122 | 167 | } |
0 commit comments