diff --git a/plugins/doc_fragments/aci.py b/plugins/doc_fragments/aci.py index 1cf5d3dd8..aaedff669 100644 --- a/plugins/doc_fragments/aci.py +++ b/plugins/doc_fragments/aci.py @@ -95,13 +95,15 @@ class ModuleDocFragment(object): - Path to a file that will be used to dump the ACI JSON configuration objects generated by the module. - If the value is not specified in the task, the value of environment variable C(ACI_OUTPUT_PATH) will be used instead. type: str - no_verification: + suppress_verification: description: - If C(true), a verifying GET will not be sent after a POST update to APIC. - If the value is not specified in the task, the value of environment variable C(ACI_NO_VERIFICATION) will be used instead. - - WARNING - This causes the current return value to be empty and any updates will be unverifiable. - The default value is C(false). + - WARNING - This causes the current return value to be set to the proposed value. + - The current object including default values will be unverifiable in a single task. type: bool + aliases: [ no_verification, no_verify, suppress_verify ] seealso: - ref: aci_guide description: Detailed information on how to manage your ACI infrastructure using Ansible. diff --git a/plugins/module_utils/aci.py b/plugins/module_utils/aci.py index 44de937c6..88b49cd6e 100644 --- a/plugins/module_utils/aci.py +++ b/plugins/module_utils/aci.py @@ -136,7 +136,7 @@ def aci_argument_spec(): use_ssl=dict(type="bool", fallback=(env_fallback, ["ACI_USE_SSL"])), validate_certs=dict(type="bool", fallback=(env_fallback, ["ACI_VALIDATE_CERTS"])), output_path=dict(type="str", fallback=(env_fallback, ["ACI_OUTPUT_PATH"])), - no_verification=dict(type="bool", fallback=(env_fallback, ["ACI_NO_VERIFICATION"])), + suppress_verification=dict(type="bool", aliases=["no_verification", "no_verify", "suppress_verify"], fallback=(env_fallback, ["ACI_NO_VERIFICATION"])), ) @@ -418,7 +418,7 @@ def __init__(self, module): self.totalCount = None # get no verify flag - self.no_verification = self.params.get("no_verification") + self.suppress_verification = self.params.get("suppress_verification") # Ensure protocol is set self.define_protocol() @@ -1597,12 +1597,13 @@ def exit_json(self, filter_existing=None, **kwargs): if "state" in self.params: self.original = self.existing if self.params.get("state") in ("absent", "present"): - if self.no_verification: + if self.suppress_verification: if self.result["changed"]: self.result["current_verified"] = False - self.existing = [] + self.existing = [self.proposed] else: self.result["current_verified"] = True + # exisiting already equals the previous else: self.get_existing() diff --git a/tests/integration/targets/aci_aep/tasks/main.yml b/tests/integration/targets/aci_aep/tasks/main.yml index 44aba97be..81ff17663 100644 --- a/tests/integration/targets/aci_aep/tasks/main.yml +++ b/tests/integration/targets/aci_aep/tasks/main.yml @@ -236,10 +236,10 @@ that: - aep_present_no_verify_cm is changed - aep_present_no_verify_cm.current_verified == false - - aep_present_no_verify_cm.current == [] + - aep_present_no_verify_cm.current.0 == aep_present_no_verify_cm.proposed - aep_present_no_verify is changed - aep_present_no_verify.current_verified == false - - aep_present_no_verify.current == [] + - aep_present_no_verify.current.0 == aep_present_no_verify.proposed - aep_present_no_verify.previous == [] - aep_present_no_verify_again is not changed - aep_present_no_verify_again.current_verified == true @@ -249,18 +249,19 @@ - aep_present_no_verify_again.previous.0.infraAttEntityP.attributes.descr == "Ansible Test" - update_aep_present_no_verify is changed - update_aep_present_no_verify.current_verified == false - - update_aep_present_no_verify.current == [] + - update_aep_present_no_verify.current.0 == update_aep_present_no_verify.proposed - update_aep_present_no_verify.previous.0.infraAttEntityP.attributes.name == "anstest-no-verify" - update_aep_present_no_verify.previous.0.infraAttEntityP.attributes.descr == "Ansible Test" - delete_aep_present_no_verify is changed - delete_aep_present_no_verify.current_verified == false - - delete_aep_present_no_verify.current == [] + - delete_aep_present_no_verify.current.0 == delete_aep_present_no_verify.proposed - delete_aep_present_no_verify.previous.0.infraAttEntityP.attributes.name == "anstest-no-verify" - delete_aep_present_no_verify.previous.0.infraAttEntityP.attributes.descr == "Ansible Test No Verify" - delete_aep_present_no_verify_again is not changed - delete_aep_present_no_verify_again.current_verified == true - delete_aep_present_no_verify_again.current == [] - delete_aep_present_no_verify_again.previous == [] + - delete_aep_present_no_verify_again.proposed == {} # QUERY ALL AEPS - name: Query all AEPs (check_mode) diff --git a/tests/integration/targets/aci_ap/tasks/main.yml b/tests/integration/targets/aci_ap/tasks/main.yml index 35e1029ae..94db7989e 100644 --- a/tests/integration/targets/aci_ap/tasks/main.yml +++ b/tests/integration/targets/aci_ap/tasks/main.yml @@ -149,10 +149,10 @@ that: - ap_present_no_verify_cm is changed - ap_present_no_verify_cm.current_verified == false - - ap_present_no_verify_cm.current == [] + - ap_present_no_verify_cm.current.0 == ap_present_no_verify_cm.proposed - ap_present_no_verify is changed - ap_present_no_verify.current_verified == false - - ap_present_no_verify.current == [] + - ap_present_no_verify.current.0 == ap_present_no_verify.proposed - ap_present_no_verify.previous == [] - ap_present_no_verify_again is not changed - ap_present_no_verify_again.current_verified == true @@ -162,18 +162,19 @@ - ap_present_no_verify_again.previous.0.fvAp.attributes.descr == "Ansible Test" - update_ap_present_no_verify is changed - update_ap_present_no_verify.current_verified == false - - update_ap_present_no_verify.current == [] + - update_ap_present_no_verify.current.0 == update_ap_present_no_verify.proposed - update_ap_present_no_verify.previous.0.fvAp.attributes.name == "anstest-no-verify" - update_ap_present_no_verify.previous.0.fvAp.attributes.descr == "Ansible Test" - delete_ap_present_no_verify is changed - delete_ap_present_no_verify.current_verified == false - - delete_ap_present_no_verify.current == [] + - delete_ap_present_no_verify.current.0 == delete_ap_present_no_verify.proposed - delete_ap_present_no_verify.previous.0.fvAp.attributes.name == "anstest-no-verify" - delete_ap_present_no_verify.previous.0.fvAp.attributes.descr == "Ansible Test No Verify" - delete_ap_present_no_verify_again is not changed - delete_ap_present_no_verify_again.current_verified == true - delete_ap_present_no_verify_again.current == [] - delete_ap_present_no_verify_again.previous == [] + - delete_ap_present_no_verify_again.proposed == {} - name: get ap - query specific ap cisco.aci.aci_ap: &aci_ap_query diff --git a/tests/integration/targets/aci_bd/tasks/main.yml b/tests/integration/targets/aci_bd/tasks/main.yml index 00753dc32..4bb951c69 100644 --- a/tests/integration/targets/aci_bd/tasks/main.yml +++ b/tests/integration/targets/aci_bd/tasks/main.yml @@ -545,10 +545,10 @@ that: - bd_present_no_verify_cm is changed - bd_present_no_verify_cm.current_verified == false - - bd_present_no_verify_cm.current == [] + - bd_present_no_verify_cm.current.0 == bd_present_no_verify_cm.proposed - bd_present_no_verify is changed - bd_present_no_verify.current_verified == false - - bd_present_no_verify.current == [] + - bd_present_no_verify.current.0 == bd_present_no_verify.proposed - bd_present_no_verify.previous == [] - bd_present_no_verify_again is not changed - bd_present_no_verify_again.current_verified == true @@ -558,18 +558,19 @@ - bd_present_no_verify_again.previous.0.fvBD.attributes.descr == "Ansible Test" - update_bd_present_no_verify is changed - update_bd_present_no_verify.current_verified == false - - update_bd_present_no_verify.current == [] + - update_bd_present_no_verify.current.0 == update_bd_present_no_verify.proposed - update_bd_present_no_verify.previous.0.fvBD.attributes.name == "anstest-no-verify" - update_bd_present_no_verify.previous.0.fvBD.attributes.descr == "Ansible Test" - delete_bd_present_no_verify is changed - delete_bd_present_no_verify.current_verified == false - - delete_bd_present_no_verify.current == [] + - delete_bd_present_no_verify.current.0 == delete_bd_present_no_verify.proposed - delete_bd_present_no_verify.previous.0.fvBD.attributes.name == "anstest-no-verify" - delete_bd_present_no_verify.previous.0.fvBD.attributes.descr == "Ansible Test No Verify" - delete_bd_present_no_verify_again is not changed - delete_bd_present_no_verify_again.current_verified == true - delete_bd_present_no_verify_again.current == [] - delete_bd_present_no_verify_again.previous == [] + - delete_bd_present_no_verify_again.proposed == {} - name: get all bd cisco.aci.aci_bd: &aci_query diff --git a/tests/integration/targets/aci_epg/tasks/main.yml b/tests/integration/targets/aci_epg/tasks/main.yml index a6eb93175..82587ec93 100644 --- a/tests/integration/targets/aci_epg/tasks/main.yml +++ b/tests/integration/targets/aci_epg/tasks/main.yml @@ -172,10 +172,10 @@ that: - epg_present_no_verify_cm is changed - epg_present_no_verify_cm.current_verified == false - - epg_present_no_verify_cm.current == [] + - epg_present_no_verify_cm.current.0 == epg_present_no_verify_cm.proposed - epg_present_no_verify is changed - epg_present_no_verify.current_verified == false - - epg_present_no_verify.current == [] + - epg_present_no_verify.current.0 == epg_present_no_verify.proposed - epg_present_no_verify.previous == [] - epg_present_no_verify_again is not changed - epg_present_no_verify_again.current_verified == true @@ -185,18 +185,19 @@ - epg_present_no_verify_again.previous.0.fvAEPg.attributes.descr == "Ansible Test" - update_epg_present_no_verify is changed - update_epg_present_no_verify.current_verified == false - - update_epg_present_no_verify.current == [] + - update_epg_present_no_verify.current.0 == update_epg_present_no_verify.proposed - update_epg_present_no_verify.previous.0.fvAEPg.attributes.name == "anstest-no-verify" - update_epg_present_no_verify.previous.0.fvAEPg.attributes.descr == "Ansible Test" - delete_epg_present_no_verify is changed - delete_epg_present_no_verify.current_verified == false - - delete_epg_present_no_verify.current == [] + - delete_epg_present_no_verify.current.0 == delete_epg_present_no_verify.proposed - delete_epg_present_no_verify.previous.0.fvAEPg.attributes.name == "anstest-no-verify" - delete_epg_present_no_verify.previous.0.fvAEPg.attributes.descr == "Ansible Test No Verify" - delete_epg_present_no_verify_again is not changed - delete_epg_present_no_verify_again.current_verified == true - delete_epg_present_no_verify_again.current == [] - delete_epg_present_no_verify_again.previous == [] + - delete_epg_present_no_verify_again.proposed == {} - name: Query specific epg cisco.aci.aci_epg: diff --git a/tests/integration/targets/aci_tenant/tasks/main.yml b/tests/integration/targets/aci_tenant/tasks/main.yml index d890bc79a..4208676ca 100644 --- a/tests/integration/targets/aci_tenant/tasks/main.yml +++ b/tests/integration/targets/aci_tenant/tasks/main.yml @@ -268,10 +268,10 @@ that: - tenant_present_no_verify_cm is changed - tenant_present_no_verify_cm.current_verified == false - - tenant_present_no_verify_cm.current == [] + - tenant_present_no_verify_cm.current.0 == tenant_present_no_verify_cm.proposed - tenant_present_no_verify is changed - tenant_present_no_verify.current_verified == false - - tenant_present_no_verify.current == [] + - tenant_present_no_verify.current.0 == tenant_present_no_verify.proposed - tenant_present_no_verify.previous == [] - tenant_present_no_verify_again is not changed - tenant_present_no_verify_again.current_verified == true @@ -281,18 +281,19 @@ - tenant_present_no_verify_again.previous.0.fvTenant.attributes.descr == "Ansible Test" - update_tenant_present_no_verify is changed - update_tenant_present_no_verify.current_verified == false - - update_tenant_present_no_verify.current == [] + - update_tenant_present_no_verify.current.0 == update_tenant_present_no_verify.proposed - update_tenant_present_no_verify.previous.0.fvTenant.attributes.name == "anstest-no-verify" - update_tenant_present_no_verify.previous.0.fvTenant.attributes.descr == "Ansible Test" - delete_tenant_present_no_verify is changed - delete_tenant_present_no_verify.current_verified == false - - delete_tenant_present_no_verify.current == [] + - delete_tenant_present_no_verify.current.0 == delete_tenant_present_no_verify.proposed - delete_tenant_present_no_verify.previous.0.fvTenant.attributes.name == "anstest-no-verify" - delete_tenant_present_no_verify.previous.0.fvTenant.attributes.descr == "Ansible Test No Verify" - delete_tenant_present_no_verify_again is not changed - delete_tenant_present_no_verify_again.current_verified == true - delete_tenant_present_no_verify_again.current == [] - delete_tenant_present_no_verify_again.previous == [] + - delete_tenant_present_no_verify_again.proposed == {} # QUERY ALL TENANTS - name: Query all tenants (check_mode)