Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible FreeIPA
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Ansible FreeIPA
Commits
0c5905fd
Commit
0c5905fd
authored
7 years ago
by
Thomas Woerner
Browse files
Options
Downloads
Patches
Plain Diff
library/ipadiscovery.py: Add ca_cert_file argument for discovery
parent
2253a415
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
library/ipadiscovery.py
+24
-3
24 additions, 3 deletions
library/ipadiscovery.py
roles/ipaclient/tasks/install.yml
+1
-0
1 addition, 0 deletions
roles/ipaclient/tasks/install.yml
with
25 additions
and
3 deletions
library/ipadiscovery.py
+
24
−
3
View file @
0c5905fd
...
@@ -48,6 +48,9 @@ options:
...
@@ -48,6 +48,9 @@ options:
hostname:
hostname:
description: The authorized kerberos principal used to join the IPA realm.
description: The authorized kerberos principal used to join the IPA realm.
required: false
required: false
ca_cert_file:
description: A CA certificate to use.
required: false
check:
check:
description: Check if IPA client is installed and matching.
description: Check if IPA client is installed and matching.
required: false
required: false
...
@@ -147,6 +150,22 @@ from ipaclient.install import ipadiscovery
...
@@ -147,6 +150,22 @@ from ipaclient.install import ipadiscovery
from
ipalib.install.sysrestore
import
SYSRESTORE_STATEFILE
from
ipalib.install.sysrestore
import
SYSRESTORE_STATEFILE
from
ipaplatform.paths
import
paths
from
ipaplatform.paths
import
paths
def
get_cert_path
(
cert_path
):
"""
If a CA certificate is passed in on the command line, use that.
Else if a CA file exists in paths.IPA_CA_CRT then use that.
Otherwise return None.
"""
if
cert_path
is
not
None
:
return
cert_path
if
os
.
path
.
exists
(
paths
.
IPA_CA_CRT
):
return
paths
.
IPA_CA_CRT
return
None
def
is_client_configured
():
def
is_client_configured
():
"""
"""
Check if ipa client is configured.
Check if ipa client is configured.
...
@@ -188,6 +207,7 @@ def main():
...
@@ -188,6 +207,7 @@ def main():
domain
=
dict
(
required
=
False
),
domain
=
dict
(
required
=
False
),
realm
=
dict
(
required
=
False
),
realm
=
dict
(
required
=
False
),
hostname
=
dict
(
required
=
False
),
hostname
=
dict
(
required
=
False
),
ca_cert_file
=
dict
(
required
=
False
),
check
=
dict
(
required
=
False
,
type
=
'
bool
'
,
default
=
False
),
check
=
dict
(
required
=
False
,
type
=
'
bool
'
,
default
=
False
),
),
),
# required_one_of = ( [ '', '' ] ),
# required_one_of = ( [ '', '' ] ),
...
@@ -199,6 +219,7 @@ def main():
...
@@ -199,6 +219,7 @@ def main():
opt_servers
=
module
.
params
.
get
(
'
servers
'
)
opt_servers
=
module
.
params
.
get
(
'
servers
'
)
opt_realm
=
module
.
params
.
get
(
'
realm
'
)
opt_realm
=
module
.
params
.
get
(
'
realm
'
)
opt_hostname
=
module
.
params
.
get
(
'
hostname
'
)
opt_hostname
=
module
.
params
.
get
(
'
hostname
'
)
opt_ca_cert_file
=
module
.
params
.
get
(
'
ca_cert_file
'
)
opt_check
=
module
.
params
.
get
(
'
check
'
)
opt_check
=
module
.
params
.
get
(
'
check
'
)
hostname
=
None
hostname
=
None
...
@@ -238,7 +259,7 @@ def main():
...
@@ -238,7 +259,7 @@ def main():
servers
=
opt_servers
,
servers
=
opt_servers
,
realm
=
opt_realm
,
realm
=
opt_realm
,
hostname
=
hostname
,
hostname
=
hostname
,
ca_cert_path
=
Non
e
)
ca_cert_path
=
get_cert_path
(
opt_ca_cert_fil
e
)
)
if
opt_servers
and
ret
!=
0
:
if
opt_servers
and
ret
!=
0
:
# There is no point to continue with installation as server list was
# There is no point to continue with installation as server list was
...
@@ -276,7 +297,7 @@ def main():
...
@@ -276,7 +297,7 @@ def main():
domain
=
cli_domain
,
domain
=
cli_domain
,
servers
=
opt_servers
,
servers
=
opt_servers
,
hostname
=
hostname
,
hostname
=
hostname
,
ca_cert_path
=
Non
e
)
ca_cert_path
=
get_cert_path
(
opt_ca_cert_fil
e
)
)
if
not
cli_domain
:
if
not
cli_domain
:
if
ds
.
domain
:
if
ds
.
domain
:
...
@@ -299,7 +320,7 @@ def main():
...
@@ -299,7 +320,7 @@ def main():
domain
=
cli_domain
,
domain
=
cli_domain
,
servers
=
cli_server
,
servers
=
cli_server
,
hostname
=
hostname
,
hostname
=
hostname
,
ca_cert_path
=
Non
e
)
ca_cert_path
=
get_cert_path
(
opt_ca_cert_fil
e
)
)
else
:
else
:
# Only set dnsok to True if we were not passed in one or more servers
# Only set dnsok to True if we were not passed in one or more servers
...
...
This diff is collapsed.
Click to expand it.
roles/ipaclient/tasks/install.yml
+
1
−
0
View file @
0c5905fd
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
servers
:
"
{{
groups.ipaservers
|
default(omit)
}}"
servers
:
"
{{
groups.ipaservers
|
default(omit)
}}"
realm
:
"
{{
ipaclient_realm
|
default(omit)
}}"
realm
:
"
{{
ipaclient_realm
|
default(omit)
}}"
hostname
:
"
{{
ansible_fqdn
}}"
hostname
:
"
{{
ansible_fqdn
}}"
#ca_cert_file: "{{ ipaclient_ca_cert_file | default(omit) }}"
check
:
yes
check
:
yes
register
:
ipadiscovery
register
:
ipadiscovery
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment