diff --git a/utils/new_module b/utils/new_module index 2b681966acf258280a66b4d9de2f8fba11138d17..58e47d06e54599dcf9c9414f4ccfa272def63c58 100755 --- a/utils/new_module +++ b/utils/new_module @@ -63,7 +63,7 @@ for (( i=0; i<OPTIND-1; i++)); do shift done -if [ ${#@} -ne 3 ]; then +if [ ${#@} -ne 4 ]; then usage; exit 1 fi @@ -78,7 +78,7 @@ if [ -z "$name" ] || [ -z "$author" ] || [ -z "$email" ] || [ -z "$github_user" [ -z "$name" ] && echo "ERROR: name is not valid" [ -z "$author" ] && echo "ERROR: author 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 usage; exit 1; diff --git a/utils/templates/README-module+member.md.in b/utils/templates/README-module+member.md.in index 6fda8f943894ab8b8ebf6c3af7a1b537c7e0e8b3..7ee97d9c0d47998688754f765775bf4197bfaa79 100644 --- a/utils/templates/README-module+member.md.in +++ b/utils/templates/README-module+member.md.in @@ -45,7 +45,7 @@ Example playbook to make sure $name "NAME" is present: --- - name: Playbook to manage IPA $name. hosts: ipaserver - become: no + become: false tasks: - 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. hosts: ipaserver - become: no + become: false tasks: - 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. hosts: ipaserver - become: no + become: false tasks: - ipa$name: @@ -96,7 +96,7 @@ Example playbook to make sure $name "NAME" is absent: --- - name: Playbook to manage IPA $name. hosts: ipaserver - become: no + become: false tasks: - ipa$name: @@ -117,7 +117,7 @@ Variable | Description | Required `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 `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 `PARAMETER1` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE `PARAMETER2` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE diff --git a/utils/templates/README-module.md.in b/utils/templates/README-module.md.in index 08faf50534078545ae571b741c13a2c3ec424820..1b8635cdabfb31b3528da37a547c6253a30f1368 100644 --- a/utils/templates/README-module.md.in +++ b/utils/templates/README-module.md.in @@ -45,7 +45,7 @@ Example playbook to make sure $name "NAME" is present: --- - name: Playbook to manage IPA $name. hosts: ipaserver - become: no + become: false tasks: - ipa$name: @@ -61,7 +61,7 @@ Example playbook to make sure $name "NAME" is absent: --- - name: Playbook to manage IPA $name. hosts: ipaserver - become: no + become: false tasks: - ipa$name: @@ -82,7 +82,7 @@ Variable | Description | Required `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 `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 `PARAMETER1` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE `PARAMETER2` \| `API_PARAMETER_NAME` | DESCRIPTION | TYPE diff --git a/utils/templates/ipamodule.py.in b/utils/templates/ipamodule.py.in index 833d5a88a55bd286ff41dee76884c8b3c377e514..aa52257bd628b5feebfae2dcc7e75f5e24717840 100644 --- a/utils/templates/ipamodule.py.in +++ b/utils/templates/ipamodule.py.in @@ -121,7 +121,7 @@ def main(): argument_spec=dict( # general name=dict(type="list", elements="str", required=True, - aliases=["API_PARAMETER_NAME"], + aliases=["API_PARAMETER_NAME"]), # present PARAMETER1=dict(required=False, type='str', aliases=["API_PARAMETER_NAME"], default=None), diff --git a/utils/templates/test_module+member.yml.in b/utils/templates/test_module+member.yml.in index 01012078e1b0e45897230f8f07797b73023bdf51..5517b6ae7522f0f85c84969b30cdd018231178e8 100644 --- a/utils/templates/test_module+member.yml.in +++ b/utils/templates/test_module+member.yml.in @@ -1,10 +1,15 @@ --- - name: Test $name hosts: "{{ ipa_test_host | default('ipaserver') }}" - # Change "become" or "gather_facts" to "yes", - # if you test playbook requires any. - become: no - gather_facts: no + # It is normally not needed to set "become" to "true" for a module test. + # Only set it to true if it is needed to execute commands as root. + become: false + # 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: @@ -12,7 +17,6 @@ - name: Ensure $name NAME is absent ipa$name: - ipaadmin_password: SomeADMINpassword name: NAME state: absent @@ -22,8 +26,6 @@ - name: Ensure $name NAME is present ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME # Add needed parameters here register: result @@ -31,8 +33,6 @@ - name: Ensure $name NAME is present again ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME # Add needed parameters here register: result @@ -40,8 +40,6 @@ - name: Ensure $name NAME member PARAMETER2 VALUE is present ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME PARAMETER2: VALUE action: member @@ -50,8 +48,6 @@ - name: Ensure $name NAME member PARAMETER2 VALUE is present again ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME PARAMETER2: VALUE action: member @@ -60,8 +56,6 @@ - name: Ensure $name NAME member PARAMETER2 VALUE is absent ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME PARAMETER2: VALUE action: member @@ -71,8 +65,6 @@ - name: Ensure $name NAME member PARAMETER2 VALUE is absent again ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME PARAMETER2: VALUE action: member @@ -84,8 +76,6 @@ - name: Ensure $name NAME is absent ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME state: absent register: result @@ -93,8 +83,6 @@ - name: Ensure $name NAME is absent again ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME state: absent register: result @@ -104,7 +92,5 @@ - name: Ensure $name NAME is absent ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME state: absent diff --git a/utils/templates/test_module.yml.in b/utils/templates/test_module.yml.in index 2ad53cc240d7a605de0bef0ac687d50fd435b6f4..f135cfd0b587afffbcebbaef9dc8eb7962e5f896 100644 --- a/utils/templates/test_module.yml.in +++ b/utils/templates/test_module.yml.in @@ -1,10 +1,15 @@ --- - name: Test $name hosts: "{{ ipa_test_host | default('ipaserver') }}" - # Change "become" or "gather_facts" to "yes", - # if you test playbook requires any. - become: no - gather_facts: no + # It is normally not needed to set "become" to "true" for a module test. + # Only set it to true if it is needed to execute commands as root. + become: false + # 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: @@ -12,8 +17,6 @@ - name: Ensure $name NAME is absent ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME state: absent @@ -23,7 +26,6 @@ - name: Ensure $name NAME is present ipa$name: - ipaadmin_password: SomeADMINpassword name: NAME # Add needed parameters here register: result @@ -31,8 +33,6 @@ - name: Ensure $name NAME is present again ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME # Add needed parameters here register: result @@ -42,8 +42,6 @@ - name: Ensure $name NAME is absent ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME state: absent register: result @@ -51,8 +49,6 @@ - name: Ensure $name NAME is absent again ipa$name: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: NAME state: absent register: result @@ -62,6 +58,5 @@ - name: Ensure $name NAME is absent ipa$name: - ipaadmin_password: SomeADMINpassword name: NAME state: absent diff --git a/utils/templates/test_module_client_context.yml.in b/utils/templates/test_module_client_context.yml.in index ee8c6789708e772bbda11cc155a0c5bd199f642b..193cd6f38ae033d437aae6210a4cdba2be9a5ec1 100644 --- a/utils/templates/test_module_client_context.yml.in +++ b/utils/templates/test_module_client_context.yml.in @@ -1,10 +1,11 @@ --- - name: Test ${name} hosts: ipaclients, ipaserver - # Change "become" or "gather_facts" to "yes", - # if you test playbook requires any. - become: no - gather_facts: no + # It is normally not needed to set "become" to "true" for a module test. + # Only set it to true if it is needed to execute commands as root. + become: false + # Enable "gather_facts" only if "ansible_facts" variable needs to be used. + gather_facts: false tasks: - name: Include FreeIPA facts.