I was able to successfully import the module, naming it win_dsc_devel. I
verified it with an adhoc call, passing no parameters, confirming that
Ansible sees the module. The problem I'm having, using the win_dsc example
of the module to create an IIS website is that I get errors when attempting
to parse the information regarding binding to my machine.
---
- name: install xWebAdministration module
win_psmodule:
name: xWebAdministration
state: present
- name: Create a new website
win_dsc_devel:
resource_name: xWebsite
Name: newWebsite
State: started
PhysicalPath: C:\inetpub\wwwroot\newWebsite
BindingInfo:
- Protocol: https
Port: 443
CertificateStoreName: My
CertificateThumbprint: MyThumbprint
If I comment out anything under the BindingInfo then the site is created
fine. As soon as I try to pass binding info, it looks like I get the
following error using win_dsc_devel:
fatal: [HostIPAddress]: FAILED! => {"changed": false, "failed": true,
"module_version": "1.19.0.0", "msg": "Undefined class: CimInstance\r\n At
line:7, char:2\r\n Buffer:\r\n Protocol = \"https\";\n};^\n\ninsta\r\n",
"reboot_required": false}
It appears as if anything getting passed to BindingInfo throws errors,
whether using win_dsc_devel or the builtin win_dsc that was shipped with
ansible core.
I created a new ansible server to test, reinstalled ansible2.4.1.0 with pip
and attempted to execute the Create New Website play in the example,
keeping everything default, and using the builtin win_dsc_devel ensuring
all directories exist on my server, only running the BindingInfo for the
http 8080 port and it failed to execute.
---
- name: install xWebAdministration module
win_psmodule:
name: xWebAdministration
state: present
- name: install IIS features that are required
win_dsc:
resource_name: WindowsFeature
Name: '{{item}}'
Ensure: Present
with_items:
- Web-Server
- Web-Asp-Net45
- name: create new website
win_dsc:
resource_name: xWebsite
Name: NewIISSite
State: Started
PhysicalPath: C:\inetpub\wwwroot\
BindingInfo:
- Protocol: http
Port: 8080
fatal: [HostIPAddress]: FAILED! => {
"BindingInfo": [
{
"Port": 8080,
"Protocol": "http"
}
],
"Name": "NewIISSite",
"PhysicalPath": "C:\\inetpub\\wwwroot\\",
"State": "Started",
"attributes": [
{
"Key": "Name",
"Name": "Name",
"Value": "NewIISSite"
},
{
"Key": "BindingInfo",
"Name": "BindingInfo",
"Value": [
{
"Port": 8080,
"Protocol": "http"
}
]
},
{
"Key": "PhysicalPath",
"Name": "PhysicalPath",
"Value": "C:\\inetpub\\wwwroot\\"
},
{
"Key": "State",
"Name": "State",
"Value": "Started"
}
],
"changed": false,
"dsc_attributes": {
"BindingInfo": [
{
"Port": 8080,
"Protocol": "http"
}
],
"Name": "NewIISSite",
"PhysicalPath": "C:\\inetpub\\wwwroot\\",
"State": "Started"
},
"failed": true,
"module_version": "1.19.0.0",
"msg": "Failed to serialize properties into CimInstance.",
"reboot_required": null,
"resource_name": "xWebsite"
}
I tried multiple combinations of BindingInfo with my cert, without my cert,
etc.
Attempting to reimport the linked win_dsc as win_dsc_devel kicks back the
following error:
fatal: [HostIPAddress]: FAILED! => {"changed": false, "failed": true,
"module_version": "1.19.0.0", "msg": "Undefined class: CimInstance\r\n At
line:5, char:2\r\n Buffer:\r\ntp\";\n Port = 8080;\n};^\n\ninsta\r\n",
"reboot_required": false}
The example from the website fails to run either, still flagging an error
on BindingInfo parameters.
Overall, I see the potential for utilizing win_dsc, but I haven't had
success with BindingInfo in it's entirety, using either the stock win_dsc
or the imported win_dsc_devel. If you have any other ideas, let me know.
Thanks!
John
On Tuesday, November 14, 2017 at 8:12:21 PM UTC-5, Jordan Borean wrote:
>
> The win_iis_* modules are fairly old and have a few bugs associated with
> them. I started to rewrite them but haven't really been able to continue
> due to time commitments and the fact that DSC is probably better suited
> towards this task. My recommendation is to;
>
> * Ensure PowerShell 5.0 is installed
> * Install the xWebAdministration DSC resource using win_psmodule
> https://github.com/PowerShell/xWebAdministration or manually copy the
> files to the host (
> https://docs.ansible.com/ansible/devel/windows_dsc.html#custom-dsc-resources
> )
> * Create a win_dsc task to modify a website's bindings using the xWebsite
> resource (
> https://docs.ansible.com/ansible/devel/windows_dsc.html#setup-iis-website)
>
> The only requirements is that PS v5 is installed and that you are using
> the devel version of win_dsc, 2.4 does have that module but to be able to
> supply a dict value the devel one has to be used. If you aren't using devel
> and are on a released version, you can create a new file from
> https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_dsc.ps1
>
> and add that to the library path for Ansible so it is available to your
> roles. It is recommended to rename the file from win_dsc so you don't get
> confused when using a custom module vs an inbuilt one.
>
>
> Thanks
>
> Jordan
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/3274bf9e-fd4c-4aa1-bc41-e59f6d2c8af2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.