mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 11:54:47 +00:00
Merge pull request #1035 from t-woerner/new_module_github_user_fix
Fixes and enhancements for utils/new_module and templates
This commit is contained in:
@@ -63,7 +63,7 @@ for (( i=0; i<OPTIND-1; i++)); do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${#@} -ne 3 ]; then
|
if [ ${#@} -ne 4 ]; then
|
||||||
usage;
|
usage;
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -78,7 +78,7 @@ if [ -z "$name" ] || [ -z "$author" ] || [ -z "$email" ] || [ -z "$github_user"
|
|||||||
[ -z "$name" ] && echo "ERROR: name is not valid"
|
[ -z "$name" ] && echo "ERROR: name is not valid"
|
||||||
[ -z "$author" ] && echo "ERROR: author is not valid"
|
[ -z "$author" ] && echo "ERROR: author is not valid"
|
||||||
[ -z "$email" ] && echo "ERROR: email is not valid"
|
[ -z "$email" ] && echo "ERROR: email is not valid"
|
||||||
[ -z "$githubuser" ] && echo "ERROR: github_user is not valid"
|
[ -z "$github_user" ] && echo "ERROR: github_user is not valid"
|
||||||
echo
|
echo
|
||||||
usage;
|
usage;
|
||||||
exit 1;
|
exit 1;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Example playbook to make sure $name "NAME" is present:
|
|||||||
---
|
---
|
||||||
- name: Playbook to manage IPA $name.
|
- name: Playbook to manage IPA $name.
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
become: no
|
become: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- ipa$name:
|
- ipa$name:
|
||||||
@@ -60,7 +60,7 @@ Example playbook to make sure $name "NAME" member PARAMETER2 VALUE is present:
|
|||||||
---
|
---
|
||||||
- name: Playbook to manage IPA $name PARAMETER2 member.
|
- name: Playbook to manage IPA $name PARAMETER2 member.
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
become: no
|
become: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- ipa$name:
|
- ipa$name:
|
||||||
@@ -78,7 +78,7 @@ Example playbook to make sure $name "NAME" member PARAMETER2 VALUE is absent:
|
|||||||
---
|
---
|
||||||
- name: Playbook to manage IPA $name PARAMETER2 member.
|
- name: Playbook to manage IPA $name PARAMETER2 member.
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
become: no
|
become: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- ipa$name:
|
- ipa$name:
|
||||||
@@ -96,7 +96,7 @@ Example playbook to make sure $name "NAME" is absent:
|
|||||||
---
|
---
|
||||||
- name: Playbook to manage IPA $name.
|
- name: Playbook to manage IPA $name.
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
become: no
|
become: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- ipa$name:
|
- ipa$name:
|
||||||
@@ -117,7 +117,7 @@ Variable | Description | Required
|
|||||||
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
|
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
|
||||||
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
||||||
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
|
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
|
||||||
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to yes. (bool) | no
|
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to true. (bool) | no
|
||||||
`name` \| `ALIAS` | The list of $name name strings. | yes
|
`name` \| `ALIAS` | The list of $name name strings. | yes
|
||||||
`PARAMETER1` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
`PARAMETER1` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
||||||
`PARAMETER2` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
`PARAMETER2` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Example playbook to make sure $name "NAME" is present:
|
|||||||
---
|
---
|
||||||
- name: Playbook to manage IPA $name.
|
- name: Playbook to manage IPA $name.
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
become: no
|
become: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- ipa$name:
|
- ipa$name:
|
||||||
@@ -61,7 +61,7 @@ Example playbook to make sure $name "NAME" is absent:
|
|||||||
---
|
---
|
||||||
- name: Playbook to manage IPA $name.
|
- name: Playbook to manage IPA $name.
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
become: no
|
become: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- ipa$name:
|
- ipa$name:
|
||||||
@@ -82,7 +82,7 @@ Variable | Description | Required
|
|||||||
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
|
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
|
||||||
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
||||||
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
|
`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
|
||||||
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to yes. (bool) | no
|
`ipaapi_ldap_cache` | Use LDAP cache for IPA connection. The bool setting defaults to true. (bool) | no
|
||||||
`name` \| `ALIAS` | The list of $name name strings. | yes
|
`name` \| `ALIAS` | The list of $name name strings. | yes
|
||||||
`PARAMETER1` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
`PARAMETER1` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
||||||
`PARAMETER2` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
`PARAMETER2` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def main():
|
|||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
# general
|
# general
|
||||||
name=dict(type="list", elements="str", required=True,
|
name=dict(type="list", elements="str", required=True,
|
||||||
aliases=["API_PARAMETER_NAME"],
|
aliases=["API_PARAMETER_NAME"]),
|
||||||
# present
|
# present
|
||||||
PARAMETER1=dict(required=False, type='str',
|
PARAMETER1=dict(required=False, type='str',
|
||||||
aliases=["API_PARAMETER_NAME"], default=None),
|
aliases=["API_PARAMETER_NAME"], default=None),
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
---
|
---
|
||||||
- name: Test $name
|
- name: Test $name
|
||||||
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
||||||
# Change "become" or "gather_facts" to "yes",
|
# It is normally not needed to set "become" to "true" for a module test.
|
||||||
# if you test playbook requires any.
|
# Only set it to true if it is needed to execute commands as root.
|
||||||
become: no
|
become: false
|
||||||
gather_facts: no
|
# Enable "gather_facts" only if "ansible_facts" variable needs to be used.
|
||||||
|
gather_facts: false
|
||||||
|
module_defaults:
|
||||||
|
ipa$name:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
@@ -12,7 +17,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent
|
- name: Ensure $name NAME is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
@@ -22,8 +26,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is present
|
- name: Ensure $name NAME is present
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
# Add needed parameters here
|
# Add needed parameters here
|
||||||
register: result
|
register: result
|
||||||
@@ -31,8 +33,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is present again
|
- name: Ensure $name NAME is present again
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
# Add needed parameters here
|
# Add needed parameters here
|
||||||
register: result
|
register: result
|
||||||
@@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME member PARAMETER2 VALUE is present
|
- name: Ensure $name NAME member PARAMETER2 VALUE is present
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
PARAMETER2: VALUE
|
PARAMETER2: VALUE
|
||||||
action: member
|
action: member
|
||||||
@@ -50,8 +48,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME member PARAMETER2 VALUE is present again
|
- name: Ensure $name NAME member PARAMETER2 VALUE is present again
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
PARAMETER2: VALUE
|
PARAMETER2: VALUE
|
||||||
action: member
|
action: member
|
||||||
@@ -60,8 +56,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME member PARAMETER2 VALUE is absent
|
- name: Ensure $name NAME member PARAMETER2 VALUE is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
PARAMETER2: VALUE
|
PARAMETER2: VALUE
|
||||||
action: member
|
action: member
|
||||||
@@ -71,8 +65,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME member PARAMETER2 VALUE is absent again
|
- name: Ensure $name NAME member PARAMETER2 VALUE is absent again
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
PARAMETER2: VALUE
|
PARAMETER2: VALUE
|
||||||
action: member
|
action: member
|
||||||
@@ -84,8 +76,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent
|
- name: Ensure $name NAME is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
@@ -93,8 +83,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent again
|
- name: Ensure $name NAME is absent again
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
@@ -104,7 +92,5 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent
|
- name: Ensure $name NAME is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
---
|
---
|
||||||
- name: Test $name
|
- name: Test $name
|
||||||
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
||||||
# Change "become" or "gather_facts" to "yes",
|
# It is normally not needed to set "become" to "true" for a module test.
|
||||||
# if you test playbook requires any.
|
# Only set it to true if it is needed to execute commands as root.
|
||||||
become: no
|
become: false
|
||||||
gather_facts: no
|
# Enable "gather_facts" only if "ansible_facts" variable needs to be used.
|
||||||
|
gather_facts: false
|
||||||
|
module_defaults:
|
||||||
|
ipa$name:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
@@ -12,8 +17,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent
|
- name: Ensure $name NAME is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
@@ -23,7 +26,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is present
|
- name: Ensure $name NAME is present
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
name: NAME
|
name: NAME
|
||||||
# Add needed parameters here
|
# Add needed parameters here
|
||||||
register: result
|
register: result
|
||||||
@@ -31,8 +33,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is present again
|
- name: Ensure $name NAME is present again
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
# Add needed parameters here
|
# Add needed parameters here
|
||||||
register: result
|
register: result
|
||||||
@@ -42,8 +42,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent
|
- name: Ensure $name NAME is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
@@ -51,8 +49,6 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent again
|
- name: Ensure $name NAME is absent again
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
@@ -62,6 +58,5 @@
|
|||||||
|
|
||||||
- name: Ensure $name NAME is absent
|
- name: Ensure $name NAME is absent
|
||||||
ipa$name:
|
ipa$name:
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
name: NAME
|
name: NAME
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: Test ${name}
|
- name: Test ${name}
|
||||||
hosts: ipaclients, ipaserver
|
hosts: ipaclients, ipaserver
|
||||||
# Change "become" or "gather_facts" to "yes",
|
# It is normally not needed to set "become" to "true" for a module test.
|
||||||
# if you test playbook requires any.
|
# Only set it to true if it is needed to execute commands as root.
|
||||||
become: no
|
become: false
|
||||||
gather_facts: no
|
# Enable "gather_facts" only if "ansible_facts" variable needs to be used.
|
||||||
|
gather_facts: false
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Include FreeIPA facts.
|
- name: Include FreeIPA facts.
|
||||||
|
|||||||
Reference in New Issue
Block a user