Ah, got it. Thanks again, my Ansible-fu is rusty and I really wanted to figure out this. Parse-Args does indeed have a flag to set whether the module supports check mode. It's coming along now. Thanks again!
On Tuesday, May 24, 2016 at 9:05:10 PM UTC+2, Matt Martz wrote: > > Can you give more details on how you are doing this? I just tried with a > custom binary module, and it seemed to work fine. > > I also see that the powershell.ps1 module_utils code also already supports > check mode via Parse-Args. > > If you run with `-v` while providing --check, what is the specific error > that you are seeing? > > Might it be related to Parse-Args already supporting this, and you not > passing $true, to Parse-Args? > > On Tue, May 24, 2016 at 1:43 PM, Trond Hindenes <[email protected] > <javascript:>> wrote: > >> H, still can't figure this out. So if I just run a custom module with >> --check Ansible will skip that task. So there has to be something which >> tells Ansible whether or not to execute that task _before_ it is sent to >> the target node, no? Maybe I'm just slow... >> >> On Tuesday, May 24, 2016 at 8:03:39 PM UTC+2, Matt Martz wrote: >>> >>> Yeah, that code path happens in AnsibleModule, which is not evaluated >>> until the module actually executes. >>> >>> There are some cases where an action plugin may bail early, but >>> generally the above applies. >>> >>> On Tue, May 24, 2016 at 1:00 PM, Trond Hindenes <[email protected]> >>> wrote: >>> >>>> Thanks Matt, that works! >>>> I was under the impression that Ansible checked wether the module >>>> supports check-mode before it executes it, but that's probably where I was >>>> wrong. >>>> >>>> On Tuesday, May 24, 2016 at 7:52:01 PM UTC+2, Matt Martz wrote: >>>>> >>>>> In ansible 2.0+ a new argument is passed to all modules called >>>>> `_ansible_check_mode`. That is a boolean, and the module can interpret >>>>> and >>>>> do what it wants. >>>>> >>>>> Based on that value, and whether you indicate in someway that check >>>>> mode is supported, then you could exit (not fail) with the same message >>>>> as >>>>> the python modules which is: >>>>> >>>>> self.exit_json(skipped=True, msg="remote module does not support check >>>>> mode") >>>>> >>>>> I'm sure it might be useful to come up with a standard. Maybe a >>>>> proposal? Matt Davis probably has some plans around a better PowerShell >>>>> version of AnsibleModule. >>>>> >>>>> >>>>> >>>>> On Tue, May 24, 2016 at 12:26 PM, Trond Hindenes <[email protected]> >>>>> wrote: >>>>> >>>>>> I'd like to support "check mode" in some of my PowerShell-based >>>>>> modules for Ansible on Windows. >>>>>> Is this currently supported? We're not using the AnsibleModule object >>>>>> at all, so how can I implement this? Any thought and pointers >>>>>> appreciated. >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Ansible Development" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Matt Martz >>>>> @sivel >>>>> sivel.net >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Ansible Development" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Matt Martz >>> @sivel >>> sivel.net >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Matt Martz > @sivel > sivel.net > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
