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
561cd4fb
Commit
561cd4fb
authored
4 years ago
by
Rafael Guterres Jeffman
Browse files
Options
Downloads
Patches
Plain Diff
Add support for FreeIPA API service_del `continue` option.
parent
4ad10336
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README-service.md
+1
-0
1 addition, 0 deletions
README-service.md
plugins/modules/ipaservice.py
+18
-3
18 additions, 3 deletions
plugins/modules/ipaservice.py
tests/service/test_service.yml
+26
-0
26 additions, 0 deletions
tests/service/test_service.yml
with
45 additions
and
3 deletions
README-service.md
+
1
−
0
View file @
561cd4fb
...
@@ -310,6 +310,7 @@ Variable | Description | Required
...
@@ -310,6 +310,7 @@ Variable | Description | Required
`allow_retrieve_keytab_group` \| `ipaallowedtoperform_read_keys_group` | Groups allowed to retrieve a keytab of this host. | no
`allow_retrieve_keytab_group` \| `ipaallowedtoperform_read_keys_group` | Groups allowed to retrieve a keytab of this host. | no
`allow_retrieve_keytab_host` \| `ipaallowedtoperform_read_keys_host` | Hosts allowed to retrieve a keytab from of host. | no
`allow_retrieve_keytab_host` \| `ipaallowedtoperform_read_keys_host` | Hosts allowed to retrieve a keytab from of host. | no
`allow_retrieve_keytab_hostgroup` \| `ipaallowedtoperform_read_keys_hostgroup` | Host groups allowed to retrieve a keytab of this host. | no
`allow_retrieve_keytab_hostgroup` \| `ipaallowedtoperform_read_keys_hostgroup` | Host groups allowed to retrieve a keytab of this host. | no
`continue` | Continuous mode: don't stop on errors. Valid only if `state` is `absent`. Default: `no` (bool) | no
`action` | Work on service or member level. It can be on of `member` or `service` and defaults to `service`. | no
`action` | Work on service or member level. It can be on of `member` or `service` and defaults to `service`. | no
`state` | The state to ensure. It can be one of `present`, `absent`, or `disabled`, default: `present`. | no
`state` | The state to ensure. It can be one of `present`, `absent`, or `disabled`, default: `present`. | no
...
...
This diff is collapsed.
Click to expand it.
plugins/modules/ipaservice.py
+
18
−
3
View file @
561cd4fb
...
@@ -135,6 +135,12 @@ options:
...
@@ -135,6 +135,12 @@ options:
required: false
required: false
type: list
type: list
aliases: [
"
ipaallowedtoperform_read_keys_hostgroup
"
]
aliases: [
"
ipaallowedtoperform_read_keys_hostgroup
"
]
continue:
description:
Continuous mode. Don
'
t stop on errors. Valid only if `state` is `absent`.
required: false
default: True
type: bool
action:
action:
description: Work on service or member level
description: Work on service or member level
default: service
default: service
...
@@ -284,7 +290,9 @@ def check_parameters(module, state, action, names, parameters):
...
@@ -284,7 +290,9 @@ def check_parameters(module, state, action, names, parameters):
module
.
fail_json
(
msg
=
"
Only one service can be added at a time.
"
)
module
.
fail_json
(
msg
=
"
Only one service can be added at a time.
"
)
if
action
==
'
service
'
:
if
action
==
'
service
'
:
invalid
=
[]
invalid
=
[
'
delete_continue
'
]
else
:
invalid
.
append
(
'
delete_continue
'
)
elif
state
==
'
absent
'
:
elif
state
==
'
absent
'
:
if
len
(
names
)
<
1
:
if
len
(
names
)
<
1
:
...
@@ -292,9 +300,12 @@ def check_parameters(module, state, action, names, parameters):
...
@@ -292,9 +300,12 @@ def check_parameters(module, state, action, names, parameters):
if
action
==
"
service
"
:
if
action
==
"
service
"
:
invalid
.
extend
(
invalid_not_member
)
invalid
.
extend
(
invalid_not_member
)
else
:
invalid
.
extend
(
'
delete_continue
'
)
elif
state
==
'
disabled
'
:
elif
state
==
'
disabled
'
:
invalid
.
extend
(
invalid_not_member
)
invalid
.
extend
(
invalid_not_member
)
invalid
.
append
(
'
delete_continue
'
)
if
action
!=
"
service
"
:
if
action
!=
"
service
"
:
module
.
fail_json
(
module
.
fail_json
(
msg
=
"
Invalid action
'
%s
'
for state
'
%s
'"
%
(
action
,
state
))
msg
=
"
Invalid action
'
%s
'
for state
'
%s
'"
%
(
action
,
state
))
...
@@ -303,7 +314,7 @@ def check_parameters(module, state, action, names, parameters):
...
@@ -303,7 +314,7 @@ def check_parameters(module, state, action, names, parameters):
module
.
fail_json
(
msg
=
"
Invalid state
'
%s
'"
%
(
state
))
module
.
fail_json
(
msg
=
"
Invalid state
'
%s
'"
%
(
state
))
for
_invalid
in
invalid
:
for
_invalid
in
invalid
:
if
parameters
[
_invalid
]
is
not
None
:
if
_invalid
in
parameters
and
parameters
[
_invalid
]
is
not
None
:
module
.
fail_json
(
module
.
fail_json
(
msg
=
"
Argument
'
%s
'
can not be used with state
'
%s
'
,
"
msg
=
"
Argument
'
%s
'
can not be used with state
'
%s
'
,
"
"
action
'
%s
'"
%
(
_invalid
,
state
,
action
))
"
action
'
%s
'"
%
(
_invalid
,
state
,
action
))
...
@@ -360,6 +371,8 @@ def init_ansible_module():
...
@@ -360,6 +371,8 @@ def init_ansible_module():
allow_retrieve_keytab_hostgroup
=
dict
(
allow_retrieve_keytab_hostgroup
=
dict
(
type
=
"
list
"
,
required
=
False
,
type
=
"
list
"
,
required
=
False
,
aliases
=
[
'
ipaallowedtoperform_read_keys_hostgroup
'
]),
aliases
=
[
'
ipaallowedtoperform_read_keys_hostgroup
'
]),
delete_continue
=
dict
(
type
=
"
bool
"
,
required
=
False
,
aliases
=
[
'
continue
'
]),
# action
# action
action
=
dict
(
type
=
"
str
"
,
default
=
"
service
"
,
action
=
dict
(
type
=
"
str
"
,
default
=
"
service
"
,
choices
=
[
"
member
"
,
"
service
"
]),
choices
=
[
"
member
"
,
"
service
"
]),
...
@@ -417,6 +430,7 @@ def main():
...
@@ -417,6 +430,7 @@ def main():
ansible_module
,
"
allow_create_keytab_host
"
)
ansible_module
,
"
allow_create_keytab_host
"
)
allow_retrieve_keytab_hostgroup
=
module_params_get
(
allow_retrieve_keytab_hostgroup
=
module_params_get
(
ansible_module
,
"
allow_retrieve_keytab_hostgroup
"
)
ansible_module
,
"
allow_retrieve_keytab_hostgroup
"
)
delete_continue
=
module_params_get
(
ansible_module
,
"
delete_continue
"
)
# action
# action
action
=
module_params_get
(
ansible_module
,
"
action
"
)
action
=
module_params_get
(
ansible_module
,
"
action
"
)
...
@@ -699,7 +713,8 @@ def main():
...
@@ -699,7 +713,8 @@ def main():
elif
state
==
"
absent
"
:
elif
state
==
"
absent
"
:
if
action
==
"
service
"
:
if
action
==
"
service
"
:
if
res_find
is
not
None
:
if
res_find
is
not
None
:
commands
.
append
([
name
,
'
service_del
'
,
{}])
args
=
{
'
continue
'
:
True
if
delete_continue
else
False
}
commands
.
append
([
name
,
'
service_del
'
,
args
])
elif
action
==
"
member
"
:
elif
action
==
"
member
"
:
if
res_find
is
None
:
if
res_find
is
None
:
...
...
This diff is collapsed.
Click to expand it.
tests/service/test_service.yml
+
26
−
0
View file @
561cd4fb
...
@@ -515,6 +515,32 @@
...
@@ -515,6 +515,32 @@
register
:
result
register
:
result
failed_when
:
result.changed
failed_when
:
result.changed
-
name
:
Ensure services are absent.
ipaservice
:
ipaadmin_password
:
SomeADMINpassword
name
:
-
"
HTTP/{{
svc_fqdn
}}"
-
HTTP/www.ansible.com
-
HTTP/svc.ihavenodns.info
-
HTTP/no.idontexist.local
continue
:
yes
state
:
absent
register
:
result
failed_when
:
not result.changed
-
name
:
Ensure services are absent.
ipaservice
:
ipaadmin_password
:
SomeADMINpassword
name
:
-
"
HTTP/{{
svc_fqdn
}}"
-
HTTP/www.ansible.com
-
HTTP/svc.ihavenodns.info
-
HTTP/no.idontexist.local
continue
:
yes
state
:
absent
register
:
result
failed_when
:
result.changed
# cleanup
# cleanup
-
name
:
Ensure services are absent.
-
name
:
Ensure services are absent.
...
...
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