Skip to content

Ability to supply ModuleName #23

@wernerb

Description

@wernerb

Repost of ansible/ansible#24872 (comment)

I am seeing an error with a basic Dsc Resource "File":

- name: blabla
  win_dsc5:
    resource_name: File
    ensure: Present
    destinationpath: |-
      C:\example.txt
    Contents: |
      My content

Output:

Friday 02 June 2017  14:12:45 +0200 (0:00:03.155)       0:00:03.224 ***********
Using module file /Users/werner/projects/nn/aws-platform/ansible/main/playbooks/library/win_dsc5.ps1
<127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 127.0.0.1
EXEC (via pipeline wrapper)
fatal: [default]: FAILED! => {
    "Attributes": [
        {
            "Key": "ensure",
            "Name": "ensure",
            "Value": "Present"
        },
        {
            "Key": "Contents",
            "Name": "Contents",
            "Value": "My content\n"
        },
        {
            "Key": "destinationpath",
            "Name": "destinationpath",
            "Value": "C:\\example.txt"
        }
    ],
    "Contents": "My content\n",
    "DSCAttributes": {
        "Contents": "My content\n",
        "destinationpath": "C:\\example.txt",
        "ensure": "Present"
    },
    "changed": false,
    "destinationpath": "C:\\example.txt",
    "ensure": "Present",
    "failed": true,
    "resource_name": "File"
}

MSG:

Cannot validate argument on parameter 'ModuleName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

The problem seems to be that Get-Resource can return an empty module (for example for File resource).

Additionally if multiple modules are found there is no way to override or select the proper module to be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions