Skip to content

Commit

Permalink
Add 'idempotent' attribute (#833)
Browse files Browse the repository at this point in the history
* Add 'idempotent' attribute.

* Mention check mode in attribute description.

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
  • Loading branch information
felixfontein and russoz authored Dec 30, 2024
1 parent 0d4b16a commit 3f0e292
Show file tree
Hide file tree
Showing 34 changed files with 108 additions and 0 deletions.
14 changes: 14 additions & 0 deletions plugins/doc_fragments/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ class ModuleDocFragment(object):
description: Can run in C(check_mode) and return changed status prediction without modifying target.
diff_mode:
description: Will return details on what has changed (or possibly needs changing in C(check_mode)), when in diff mode.
idempotent:
description:
- When run twice in a row outside check mode, with the same arguments, the second invocation indicates no change.
- This assumes that the system controlled/queried by the module has not changed in a relevant way.
"""

# Should be used together with the standard fragment
IDEMPOTENT_NOT_MODIFY_STATE = r"""
options: {}
attributes:
idempotent:
support: full
details:
- This action does not modify state.
"""

# Should be used together with the standard fragment
Expand Down
5 changes: 5 additions & 0 deletions plugins/doc_fragments/module_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class ModuleDocFragment(object):
attributes:
diff_mode:
support: full
idempotent:
support: partial
details:
- If relative timestamps are used and O(ignore_timestamps=false), the module is not idempotent.
- The option O(force=true) generally disables idempotency.
requirements:
- cryptography >= 1.6 (if using V(selfsigned) or V(ownca) provider)
options:
Expand Down
2 changes: 2 additions & 0 deletions plugins/doc_fragments/module_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ModuleDocFragment(object):
attributes:
diff_mode:
support: full
idempotent:
support: full
requirements:
- cryptography >= 1.3
options:
Expand Down
4 changes: 4 additions & 0 deletions plugins/doc_fragments/module_privatekey.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class ModuleDocFragment(object):
attributes:
diff_mode:
support: full
idempotent:
support: partial
details:
- The option O(regenerate=always) generally disables idempotency.
requirements:
- cryptography >= 1.2.3 (older versions might work as well)
options:
Expand Down
2 changes: 2 additions & 0 deletions plugins/doc_fragments/module_privatekey_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ModuleDocFragment(object):
attributes:
diff_mode:
support: none
idempotent:
support: full
options:
src_path:
description:
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/acme_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
support: full
diff_mode:
support: full
idempotent:
support: partial
details:
- If O(state=changed_key) is used, the module is not idempotent.
options:
state:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/acme_account_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- community.crypto.attributes
- community.crypto.attributes.actiongroup_acme
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options:
retrieve_orders:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/acme_ari_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- community.crypto.acme.no_account
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options:
certificate_path:
description:
Expand Down
6 changes: 6 additions & 0 deletions plugins/modules/acme_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
support: none
safe_file_operations:
support: full
idempotent:
support: partial
details:
- If O(force=true), the module is not idempotent.
If O(force=false), it depends on the certificate's validity period and the value of O(remaining_days).
- The second phase invocation of the module is always idempotent, assuming no error occurs.
options:
account_email:
description:
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/acme_certificate_deactivate_authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
support: full
diff_mode:
support: none
idempotent:
support: full
options:
order_uri:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/acme_certificate_renewal_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- community.crypto.acme.no_account
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options:
certificate_path:
description:
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/acme_certificate_revoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
support: none
diff_mode:
support: none
idempotent:
support: full
options:
certificate:
description:
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/acme_challenge_cert_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
support: N/A
details:
- This action does not modify state.
idempotent:
support: none
details:
- The certificates returned are never the same, since the Not Before and Not After timestamps
depend on the invocation's timestamp.
options:
challenge:
description:
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/acme_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
support: none
diff_mode:
support: none
idempotent:
support: none
options:
url:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/certificate_complete_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- "cryptography >= 1.5"
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.idempotent_not_modify_state
attributes:
check_mode:
support: full
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/crypto_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options: {}
"""

Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/ecs_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
support: none
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true).
- Under which conditions the module is idempotent still needs to be determined.
If you are using this module and have more information, please contribute to
the documentation!
options:
backup:
description:
Expand Down
6 changes: 6 additions & 0 deletions plugins/modules/ecs_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
support: none
diff_mode:
support: none
idempotent:
support: partial
details:
- Under which conditions the module is idempotent still needs to be determined.
If you are using this module and have more information, please contribute to
the documentation!
options:
client_id:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/get_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
newer.
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.idempotent_not_modify_state
attributes:
check_mode:
support: none
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/luks_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
support: full
diff_mode:
support: none
idempotent:
support: full
options:
device:
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/openssh_cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
support: full
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true) or O(regenerate=always).
- If relative timestamps are used and O(ignore_timestamps=false) (default), the module is not idempotent.
options:
state:
description:
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/openssh_keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
support: full
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true) or O(regenerate=always).
options:
state:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/openssl_csr_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.name_encoding
- community.crypto.attributes.idempotent_not_modify_state
options:
path:
description:
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/openssl_dhparam.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
support: none
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true).
options:
state:
description:
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/openssl_pkcs12.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
support: none
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true).
options:
action:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/openssl_privatekey_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options:
path:
description:
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/openssl_publickey.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
support: full
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true).
options:
state:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/openssl_publickey_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options:
path:
description:
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/openssl_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
- This action does not modify state.
diff_mode:
support: none
idempotent:
support: partial
details:
- Signature algorithms are generally not deterministic. Thus the generated signature
can change from one invocation to the next.
options:
privatekey_path:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/openssl_signature_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
options:
path:
description:
Expand Down
2 changes: 2 additions & 0 deletions plugins/modules/x509_certificate_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
support: none
safe_file_operations:
support: full
idempotent:
support: full
options:
src_path:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/x509_certificate_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
- community.crypto.name_encoding
options:
path:
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/x509_crl.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
support: full
safe_file_operations:
support: full
idempotent:
support: partial
details:
- The module is not idempotent if O(force=true).
- If relative timestamps and O(ignore_timestamps=false) (default), the module is not idempotent.
options:
state:
description:
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/x509_crl_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
extends_documentation_fragment:
- community.crypto.attributes
- community.crypto.attributes.info_module
- community.crypto.attributes.idempotent_not_modify_state
- community.crypto.name_encoding
options:
path:
Expand Down

0 comments on commit 3f0e292

Please sign in to comment.