Coder Social home page Coder Social logo

ansible-collections / community.windows Goto Github PK

View Code? Open in Web Editor NEW
193.0 11.0 152.0 10.4 MB

Windows community collection for Ansible

Home Page: https://galaxy.ansible.com/community/windows

License: GNU General Public License v3.0

Python 36.45% PowerShell 62.64% Shell 0.69% Jinja 0.22%
ansible-collection hacktoberfest

community.windows's Introduction

Ansible Collection: community.windows

Build Status codecov

The community.windows collection includes the community plugins supported by Ansible community to help the management of Windows hosts.

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.14.

Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Collection Documentation

Browsing the latest collection documentation will show docs for the latest version released in the Ansible package not the latest version of the collection released on Galaxy.

Browsing the devel collection documentation shows docs for the latest version released on Galaxy.

We also separately publish latest commit collection documentation which shows docs for the latest commit in the main branch.

If you use the Ansible package and don't update collections independently, use latest, if you install or update this collection directly from Galaxy, use devel. If you are looking to contribute, use latest commit.

Installation and Usage

Installing the Collection from Ansible Galaxy

Before using the Windows collection, you need to install it with the ansible-galaxy CLI:

ansible-galaxy collection install community.windows

You can also include it in a requirements.yml file and install it via ansible-galaxy collection install -r requirements.yml using the format:

collections:
- name: community.windows

Contributing to this collection

Currently we welcome bugfixes or feature requests to plugins in this collection but no new modules or plugins will be accepted in this collection. If you find problems, please open an issue or create a PR against the Community Windows collection repository. See Contributing to Ansible-maintained collections for details.

See Developing modules for Windows for specifics on Windows modules.

You can also join us on:

IRC - #ansible-windows irc.libera.chat channel

See the Ansible Community Guide for details on contributing to Ansible.

Code of Conduct

This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.

Testing with ansible-test

The tests directory contains configuration for running sanity and integration tests using ansible-test.

You can run the collection's test suites with the commands:

ansible-test sanity --docker
ansible-test windows-integration --docker

Publishing New Version

The current process for publishing new versions of the Windows Core Collection is manual, and requires a user who has access to the community namespace on Ansible Galaxy and Automation Hub to publish the build artifact.

  • Update galaxy.yml with the new version for the collection.
  • Update the CHANGELOG:
    • Make sure you have antsibull-changelog installed pip install antsibull-changelog.
    • Make sure there are fragments for all known changes in changelogs/fragments.
    • Add a new fragment with the header release_summary to give a summary on the release.
    • Run antsibull-changelog release.
  • Commit the changes and wait for CI to be green
  • Create a release with the tag that matches the version number
    • The tag is the version number itself, and should not start with anything
    • This will trigger a build and publish the collection to Galaxy
    • The Zuul job progress will be listed here

After the version is published, verify it exists on the Windows Community Collection Galaxy page.

More Information

For more information about Ansible's Windows integration, join the #ansible-windows channel on libera.chat IRC, and browse the resources in the Windows Working Group Community wiki page.

License

GNU General Public License v3.0 or later

See COPYING to see the full text.

community.windows's People

Contributors

aaronk1 avatar andersson007 avatar benjfield avatar briantist avatar bsft-arebach avatar daniel-sanchez-fabregas avatar dev-ddoe avatar dirkvbok avatar dterhorst93 avatar egvimo avatar felixfontein avatar fsteve800 avatar gamethis avatar gotit96 avatar gundalow avatar hiyokotaisa avatar jamiemagee avatar jborean93 avatar jimbo8098 avatar kenyon avatar maximd avatar ntimo avatar pfurtschellerp avatar phoenikz avatar silid avatar tgoetheyn avatar theraspydev avatar tortenairbag avatar xcom1710 avatar zollo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community.windows's Issues

win_chocolatey - add version constraints

From @mvorisek on Jun 16, 2019 13:18

SUMMARY

I propose to add version range constraint support to accept versions like [7.3, 7.4).

Chocolatey has no native support, hovewer the Chocolatey can lookup all versions like choco list php --by-id-only -a (or with `-e switch once chocolatey/choco#1843 is solved). So I propose to allow to specify version by version range constraint, find the latest stable version and then proceed with instal of the discovered/fixed version.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_chocolatey

Copied from original issue: ansible/ansible#57917

Add support to distinguish Name and DisplayName in win_firewall rules

From @charlesgreen on Nov 02, 2017 02:22

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

modules/windows/win_firewall_rule

ANSIBLE VERSION
ansible 2.4.1.0
  config file = /Users/cg/Repo/ansible-windows-examples/ansible.cfg
  configured module search path = ['/Users/cg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/cg/anaconda3/lib/python3.6/site-packages/ansible
  executable location = /Users/cg/anaconda3/bin/ansible
  python version = 3.6.3 |Anaconda, Inc.| (default, Oct  6 2017, 12:04:38) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
CONFIGURATION
DEFAULT_HOST_LIST(/Users/cg/Repo/ansible-windows-examples/ansible.cfg) = ['/Users/cg/Repo/ansible-windows-examples/inventory.yml']
HOST_KEY_CHECKING(/Users/cg/Repo/ansible-windows-examples/ansible.cfg) = False
OS / ENVIRONMENT

Control system: MacOS 10.12.6
Target system: Windows 2012 Server R2 server guest deployed on Virtualbox 5.1

SUMMARY

The win_firewall module accepts a Name parameter that is used to check for and create Windows Firewall rules with the same DisplayName rather than Name property of the Get-NetFirewallRule PowerShell command.
This creates the inability to distinguish and select a firewall rule with a different Name but same DisplayName.

For examples, the built-in firewall rules with the DisplayName "Remote Desktop - User Mode (TCP-In)" have two distinct Name properties:

  • RemoteDesktop-UserMode-In-TCP
  • RemoteDesktop-UserMode-In-UDP
STEPS TO REPRODUCE

The properties can be verified with this example by running the following on the PowerShell command line.
Also, when the Name property returned from PowerShell is used as the Name property of the module a new firewall rule is created with the same DisplayName.

Get-NetFirewallRule -DisplayName "Remote Desktop - User Mode*"
EXPECTED RESULTS

The ability to select a firewall rule based on either Name or DisplayName
The module Name property is mapped to the Get-NetFirewallRule -Name and a new DisplayName is added and mapped to the Get-NetFirewallRule -DisplayName property.

ACTUAL RESULTS
The module name field is mapped to the Get-NetFirewallRule -DisplayName 

Copied from original issue: ansible/ansible#32478

Unhandled exception while executing module: Could not compare "524288000" to "524288000 53684994048". Error: "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.UInt64"

From @mossroy on Dec 13, 2019 12:16

SUMMARY

When using win_partition module on Windows 2016 servers, I sometimes get the following error :

Unhandled exception while executing module: Could not compare "524288000" to "524288000 53684994048". Error: "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.UInt64"

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_partition

ANSIBLE VERSION
ansible 2.9.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/xxx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION

"ansible-config dump --only-changed" gives an empty output : we kept the default ansible.cfg

OS / ENVIRONMENT

Control node : CentOS 7.7 with Ansible 2.9.1
Target OS : Windows 2016 with PowerShell 5 and .NET 4.8.03761, running on VMWare
Playbook started from a Jenkins build

STEPS TO REPRODUCE

It's difficult for me to reproduce as it only happened once, on a pre-production server that I can not easily touch/debug.
I ran the same playbook on 15 (normally identical) servers, and it only happened once.

Running the same playbook a few days before (on the same server) did extend the partition, and did not make the problem happen.

The playbook is very simple, and ensures the partition is extended to its maximum size :

---
- name : Test-case win_partition
  hosts : all
  environment:
  tasks :
    - name: Test extend partition D
      win_partition:
        drive_letter: D
        partition_size: -1
EXPECTED RESULTS

win_partition should not crash

ACTUAL RESULTS

The playbook stopped for one server. Here is the command-line output :

$ ansible-playbook xxx.yml -i hosts -l xxx -f 5 -e ansible_password=XXX -e ansible_user=XXX

PLAY [XXX] ***************************************************

TASK [Gathering Facts] *********************************************************
ok: [xxxs02]
ok: [xxxk01]
ok: [xxxs01]
ok: [xxxk02]

TASK [Extend partition D] **********************************************
ok: [xxxs02]
ok: [xxxk01]
ok: [xxxk02]
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at <ScriptBlock>, <No file>: line 238
fatal: [xxxs01]: FAILED! => {"changed": false, "msg": "Unhandled exception while executing module: Could not compare \"524288000\" to \"524288000 53684994048\". Error: \"Cannot convert the \"System.Object[]\" value of type \"System.Object[]\" to type \"System.UInt64\".\""}

Based on the code from https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/modules/windows/win_partition.ps1 :
As we pass "-1" for partition_size, $size_is_maximum should be true, so $ansible_partition_size should be equal to $max_supported_size (line 236).
So I suppose it crashes when comparing $ansible_partition_size and $ansible_partition.Size on line 238.
But I don't see how line 231 could return 2 elements instead of one?
Or maybe the line 238 mentioned in the error is mis-aligned, and correspond to another one in the source code?

Copied from original issue: ansible/ansible#65804

Add management of AD field "altsecurityidentities" to win_domain_user module

From @shakalandy on Oct 26, 2018 09:18

SUMMARY

As an automation guy i want to make sure that the complete user-management stuff is done by ansible.
Currently we and a lot of other companies use Microsoft Active Directory as single source of truth regarding user accounts. That's why we are using it for ssh authentication via SSSD.
Due to security reasons we don't want to rely on the AD password, but stick to SSH Key Authentication.
This can be easily done in sssd, you just need to point to the proper field in active directory.
Is is quite common to use the field field "altsecurityidentities" for that purpose, because AD schema manipulation should be avoided.

ANSIBLE VERSION

2.7

ISSUE TYPE

Enhance the module win_domain_user in a way that you can manage the users ssh public key in the field "altsecurityidentities" via ansible.

COMPONENT NAME

module: win_domain_user

ADDITIONAL INFORMATION

see summary

- hosts: win-ad
#  gather_facts: false

  tasks:
    - name: add key to ad user
      win_domain_user:
        domain_username: remoteldapuser
        domain_password: password
        domain_server: domain.example.com
        name: jwhitehurst
        path: "OU=Linux,OU=Permissions,OU=Security,OU=_Global,DC=domain,DC=example,DC=com"
        altsecurityidentities: "ssh-rsa 1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3
Pbv7kOdJ/MTyBlWXFCR+HAo3FX jwhitehurst"

Copied from original issue: ansible/ansible#47653

Possible for win_disk_facts to throw Null Reference on Disks with no Number

From @Badgerati on Feb 18, 2020 15:08

SUMMARY

When using the win_disk_facts, it's possible for the powershell script to get the facts to throw a null reference exception here: https://github.com/ansible/ansible/blob/1bdbbd2784ffaf458eda8708e9c675f44149af30/lib/ansible/modules/windows/win_disk_facts.ps1#L194

When settings up SQL Clustering, and possibly in other scenarios, it's possible to have disks with no disk number.

I'm thinking that this line:
https://github.com/ansible/ansible/blob/1bdbbd2784ffaf458eda8708e9c675f44149af30/lib/ansible/modules/windows/win_disk_facts.ps1#L35
needs to be changed to:

$disks = Get-Disk | Where-Object { $null -ne $_.Number }

Or, probably more appropriate, unallocated disks should not attempt to have a partition retrieved.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_disk_facts

ANSIBLE VERSION
ansible 2.8.4
CONFIGURATION

nothing

OS / ENVIRONMENT

Windows Server 2016

STEPS TO REPRODUCE
  • Have a Windows VM with a disk with no number (create a VM with a disk, but not bound to a partition)

then:

- name: Get disk facts
  win_disk_facts:
EXPECTED RESULTS

Only the disks with numbers should be used for retrieving facts (or, unallocated ones should not attempt to retrieve a partition).

ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at <ScriptBlock>, <No file>: line 133

fatal: [10.1.8.76]: FAILED! => {"changed": false, "msg": "Unhandled exception while executing module: Cannot validate argument on parameter 'DiskNumber'. The argument is null. Provide a valid value for the argument, and then try running the command again."}

Copied from original issue: ansible/ansible#67536

Obscure error message on expiring scheduled task

From @johnboy2 on Feb 02, 2019 00:57

SUMMARY

Within the "win_scheduled_task" module, the delete_expired_task_after setting can only legitimately be used when at least one trigger has an end_boundary defined. Any tasks using delete_expired_task_after without at least one trigger with an end_boundary is ill-defined.

This is problematic because the requirement for that kind of trigger is undocumented and non-obvious. This request is to add such a check, including a human-readable error message if/when the check fails.

ISSUE TYPE
  • Feature request
COMPONENT NAME

win_scheduled_task

ANSIBLE VERSION
ansible 2.7.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
CONFIGURATION

n/a

OS / ENVIRONMENT

Windows Server 2012 R2

STEPS TO REPRODUCE
- hosts: windows
  gather_facts: no
  vars:
    ansible_user: administrator
    ansible_port: 5986
    ansible_connection: winrm
    ansible_winrm_server_cert_validation: ignore
  tasks:
    - win_scheduled_task:
        name: Test task
        actions:
          - path: C:\Windows\System32\hostname.exe
        triggers:
          - type: boot
        username: SYSTEM
        delete_expired_task_after: PT0S  # immediately
EXPECTED RESULTS

Example error message:

FAILED! => {"change": false, "msg": "Cannot use `delete_expired_task_after` without at least one trigger with an `end_boundary`"}
ACTUAL RESULTS
TASK [win_scheduled_task] ***************************************************************************************************
fatal: [10.0.14.36]: FAILED! => {"changed": true, "msg": "failed to modify scheduled task: Exception calling \"RegisterTaskDefinition\" with \"6\" argument(s): \"(43,4):EndBoundary:\""}
NOTES
  • I couldn't find any documentation describing this requirement, although it can be observed in practice by trying to manually create such a task via the Task Scheduler UI. If you do so, you get this message in a pop-up:

    If you want to have a task deleted automatically after it runs, you must add at least one trigger that has an expiration date.

Copied from original issue: ansible/ansible#51634

win_scheduled_task: RegisterTaskDefinition error using a trigger with start_boundary

From @aventrax on Mar 13, 2020 10:38

SUMMARY

When configuring a scheduled task using the win_scheduled_task module I got an error in case the trigger is set daily with a start_boundary using the format specified on the docs.
This tasks is part of one of my old roles and it was working with Ansible 2.8.5 but not with 2.9.6.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • win_scheduled_task tails
ANSIBLE VERSION
  • 2.9.6
OS / ENVIRONMENT

Ubuntu 18.04 LTS with ansible in a virtual env

STEPS TO REPRODUCE

ansible-playbook -vvvv mio.yml -l 172.16.8.176

--- 
- hosts: all 
  gather_facts: false

  tasks:

  - name: Configuring scheduled task to clean IIS tmp folder daily 
    win_scheduled_task:
      name: IISTmpCleaner
      description: Rimuove file temporanei piu' vecchi di 3 giorni
      actions:
      - path: C:\Windows\System32\forfiles.exe
        arguments: '/P C:\Windows\SysWOW64\inetsrv\tmp /S /D -3  /C "cmd /c if @isdir==FALSE del @file"'
      triggers:
      - type: daily
        start_boundary: '2017-10-09T01:39:00'
      username: SYSTEM
      run_level: highest
      state: present
      enabled: true

...
EXPECTED RESULTS

No errors at all, as of ansible 2.8.5

ACTUAL RESULTS
TASK [Configuring scheduled task to clean IIS tmp folder daily] ****************************************************************************************************************************************************************************task path: /home/matteo/Ansible/MEDarchiver/mio.yml:7
Using module file /opt/python-virtual-envs/default/lib/python3.6/site-packages/ansible/modules/windows/win_scheduled_task.ps1 
Pipelining is enabled.
<172.16.8.176> ESTABLISH WINRM CONNECTION FOR USER: auxonet\medadmin on PORT 5985 TO 172.16.8.176
EXEC (via pipeline wrapper) 
fatal: [172.16.8.176]: FAILED! => { 
    "changed": false,
    "msg": "failed to modify scheduled task: Exception calling \"RegisterTaskDefinition\" with \"6\" argument(s): \"(4,33):Date:2017-10-09T01.39.00\""
}

Copied from original issue: ansible/ansible#68210

win_iis_website parameters logfile.customFields

From @Roxyrob on Dec 30, 2018 18:20

SUMMARY

Cannot configure logfile.customFields

ISSUE TYPE
  • Bug Report

Cannot configure logfile.customFields
using different syntax like:
logfile.customFields:{logFieldName:X-Forwarded-For,sourceName:X_FORWARDED_FOR,sourceType:RequestHeader}

also using different format without dictionary delimiter "{}", using "=" instead of ":" enclosing in "" or ''.
Someone knows if this is a bug/limitation ? It is possible to set this logfile.customFields using win_iis_website module or it is necessary to use win_commando/win_shell modules ?

COMPONENT NAME

win_iis_website

ANSIBLE VERSION
ansible 2.7.1
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
CONFIGURATION

OS / ENVIRONMENT

CentOS 7

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Copied from original issue: ansible/ansible#50407

How do I run tests now?

SUMMARY

I have no idea how to run the unittests since the migration.

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

ansible-test units

ANSIBLE VERSION

ansible 2.10.dev0

win_iis_webbindig cannot update ssl cert on default binding

From @pawellrus on Feb 08, 2019 15:51

SUMMARY

win_iis_webbindig cannot update ssl cert on default binding
Catch-all binding becomes corrupted with SNI Flag enabled. IIS Binding console failed to open after execution. So I can roll it back only via IIS config file.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_iis_webbinding

ANSIBLE VERSION
ansible 2.7.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
OS / ENVIRONMENT
Ansible: Centos 7
Control: Windows Server 2016
STEPS TO REPRODUCE
- name: Configure binding without SNI
      win_iis_webbinding:
        name: Service
        protocol: https
        state: present
        port: 443
        certificate_hash: '**hash**'
EXPECTED RESULTS

Certificate on catch-all binding changed

ACTUAL RESULTS
failed: [server] (item={u'header': u'', u'hash': u'**hash**'}) => {
    "changed": true,
    "item": {
        "hash": "**hash**",
        "header": ""
    },
    "msg": "Failed to set new SSL certificate - Value does not fall within the expected range."
}

Copied from original issue: ansible/ansible#51967

win_xml module: 'Unhandled exception' error at line 230. Set-StrictMode related.

SUMMARY

win_xml module throws an error when trying to add a new attribute to an element. Re-opened here from original issue reported on main ansible project:
ansible/ansible#68511

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_xml module

ANSIBLE VERSION
ansible 2.9.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
CONFIGURATION

OS / ENVIRONMENT

AWX Docker container 'awx_task', version 9.2.0 from Docker Hub.

I suspect that this error is due to the 'Set-StrictMode -Version 2' setting being enabled at the top of the win_xml.ps1 script.

STEPS TO REPRODUCE

Try to update a simple XML file element with an attribute

Example XML before change:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings></connectionStrings>
</configuration>
- name: Update XML
  hosts: all
  gather_facts: false
  serial: 1

  tasks:
    - name: Add XML attribute
      win_xml:
        path: "C:\\temp\\test.xml"
        xpath: "/configuration/connectionStrings"
        attribute: "configSource"
        fragment: "Config\\ConnectionStrings.config"
        type: attribute
EXPECTED RESULTS

Desired outcome XML:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings configSource="Config\ConnectionStrings.config"></connectionStrings>
</configuration>
ACTUAL RESULTS

A powershell error is thrown

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at <ScriptBlock>, <No File>: line 230
fatal: [host01]: FAILED! => {"changed": false, "msg": "Unhandled exception while executing module: The property 'configSource' cannot be found on this object. Verify that the property exists."}

Begin thinking about PowerShellGet 3.0 support

SUMMARY

This issue is intended to track and discuss PowerShellGet 3.0:

It's pretty major update, with tons of good, but breaking, changes.

New action items coming out of this can probably be broken off into their own issues.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

Affected modules:

  • win_psrepository
  • win_psrepository_info
  • win_psmodule
  • win_psmodule_info
  • win_psscript
  • win_psscript_info
ADDITIONAL INFORMATION

Not everything is complete or decided yet, but reading over the changes, I think there's enough there to start thinking about how to support it.

I think the first thing would probably be to update the existing module's code and documentation to explicitly specify that the required version of PowerShellGet be <3.0.0. They are considering adding aliases (probably functions since the parameters don't match up) for the old cmdlet names but its not certain and it looks like it'll be opt in, so I don't think we can rely on a smooth transition there.

Looking forward, to actually support it I see 2 possible paths at the moment:

1) The existing modules test for which version is available and provide a seamless(ish) experience.

Pros:

  • Existing playbooks work (probably)

Cons:

  • Not all parameters to the underlying commands line up or are congruent anymore. This may make for an awkward option set.
  • Complexity and maintenance will be a hassle.
  • Testing is already complicated for some these, and will be much worse.

2) A new set of Ansible modules following their new naming conventions (like win_psresource).

Pros:

  • Vastly simpler maintenance and testing. The changes they are making also simplify the set of modules so these would be less complicated than the originals even.
  • A simpler and easier to understand option set.
  • A clear delineation between the old and new when it comes to both PowerShellGet version and which Ansible module you pick.
  • Allows for Ansible playbook/role authors to handle support and fallback for different PowerShellGet versions themselves by using the existing win_psmodule_info to determine installed PowerShellGet version and then branch on which other modules to use (see Other thoughts section though)
  • A clearer path for eventually (if ever) deprecating the older modules.

Cons:

  • Existing playbooks won't work in situations where only PowerShellGet 3.0+ is available.

3) ~ x) Other suggestions welcome

Other Thoughts

win_psmodule_info is a bit of a special case because it returns information on PowerShell modules whether they were installed via repository or not, and it includes repository info. This one might need some cross compatibility.

For the case of determining what version of PowerShellGet is installed, I wonder if it might make sense to add something to the setup module for Windows that returns a limited set of PS module versions; maybe somewhere it can be specified which modules are important enough to be returned in fact gathering. Repository info isn't that important so it'd be a simplified operation of Get-Module -ListAvailable -Name <names>.

In either of the 1) or 2) options above, a module util might make sense for some common tasks to be pushed to a module_util. In the case of 1) it would probably handle all the heavy abstraction between versions. In 2) it would be smaller and more manageable.

win_unzip does not report an error when compressed file is faulty

From @gillesB on Mar 20, 2019 14:36

SUMMARY

When win_unzip tries to extract a faulty zip-file, it returns ok.
Instead I would have expected failed and an error message.

Detailed description: https://serverfault.com/questions/959124/win-unzip-does-not-extract-file/959126#959126

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_unzip

ANSIBLE VERSION
ansible 2.7.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
CONFIGURATION

ansible-config dump --only-changed returns nothing.

OS / ENVIRONMENT

Ansible runs on a Ubuntu 18.04.
The target PC is a Windows 7.

STEPS TO REPRODUCE

Actually I have not yet tried to reproduce this issue, but it is probably reproducible with any faulty zip file.
Below are the tasks which I am using.
During the download of the zip-file I killed Ansible, which probably resulted in a faulty zip file.
Due to the force: no, the file was not replaced by a correct file.

  - name: Download Eclipse Luna RCP (32-bit)
    win_get_url:
      url: http://ftp.snt.utwente.nl/pub/software/eclipse//technology/epp/downloads/release/luna/SR2/eclipse-rcp-luna-SR2-win32.zip
      dest: '%TEMP%\eclipse-rcp-luna-SR2-win32.zip'
      force: no
    tags: eclipse
  - name: Ensure Eclipse Luna RCP is extracted
    win_unzip:
      src: '%TEMP%\eclipse-rcp-luna-SR2-win32.zip'
      dest: '%userprofile%\Programs\eclipse_luna'
    tags: eclipse
EXPECTED RESULTS

In case of the a faulty zip-file I would expect something like (I do not know the result syntax):

TASK [Ensure Eclipse Luna RCP is extracted] *********************************************
failed: [192.168.1.87] => {"changed": false,
                                        "dest": "C:\\Users\\testuser\\Programs\\eclipse_luna",
                                         "removed": false,
                                         "src": "C:\\Users\\testuser\\AppData\\Local\\Temp\\eclipse-rcp-luna-SR2-win32.zip",
                                         "msg": "Could not extract the zip file" }
ACTUAL RESULTS

The folder C:\Users\testuser\Programs\eclipse_luna was created but was emtpy.
Ansible reported an ok.

TASK [Ensure Eclipse Luna RCP is extracted] ************
ok: [192.168.1.87] => {"changed": false,
                       "dest": "C:\\Users\\testuser\\Programs\\eclipse_luna",
                       "removed": false,
                       "src": "C:\\Users\\testuser\\AppData\\Local\\Temp\\eclipse-rcp-luna-SR2-win32.zip"
                      }

Copied from original issue: ansible/ansible#54113

win_domain_user - ability to clear an attribute

From @thylocene on Feb 26, 2020 03:31

SUMMARY

The win_domain_user module currently has no way to clear an attribute e.g. city, PostalCode, etc.

The module throws an error if an empty string is used for an attribute:

e.g.
Microsoft.ActiveDirectory.Management.ADInvalidOperationException: replace ---> System.ServiceModel.FaultException: Bad AttributeTypeAndValue or Change found inside the request.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_domain_user

ADDITIONAL INFORMATION
---
  - name: Map the answers from the servicenow request to the AD attributes
    win_domain_user:
      name: "fredb"
      street: ""
      city: ""
      postal_code: ""
    register: user_created

Copied from original issue: ansible/ansible#67764

The win_disk_facts doesn't return dynamic disks

From @it-praktyk on Jan 17, 2019 16:52

SUMMARY

The module returns - as the ansible facts - only information about the first physical drive.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_disk_facts

ANSIBLE VERSION
ansible 2.8.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/<user_name>/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/<folder_path>/ansible/lib/ansible
  executable location = /home/<folder_path>/ansible/bin/ansible
  python version = 2.7.15 (default, Oct 15 2018, 15:26:09) [GCC 8.2.1 20180801 (Red Hat 8.2.1-2)]
CONFIGURATION
ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
OS / ENVIRONMENT

I tested that using the Vagrant image of Windows Server 2012 R2 jborean93/WindowsServer2012R2 v.0.5 with the additional disk added.

PS C:\Windows\system32> Get-PhysicalDisk

FriendlyName        CanPool             OperationalStatus   HealthStatus        Usage                              Size
------------        -------             -----------------   ------------        -----                              ----
PhysicalDisk0       False               OK                  Healthy             Auto-Select                    39.06 GB
PhysicalDisk1       False               OK                  Healthy             Auto-Select                       50 GB
STEPS TO REPRODUCE
ansible-test windows-integration win_disk_facts -vvv
EXPECTED RESULTS

ansible facts will contain information about all physical disks.

ACTUAL RESULTS

Only the first disk is included in the module output.

TASK [win_disk_facts : get disk facts on the target] **************************************************************************************************************************************************************
task path: /home/wojtek/Scripts/ansible/test/integration/targets/win_disk_facts/tasks/tests.yml:1
Using module file /home/wojtek/Scripts/ansible/lib/ansible/modules/windows/win_disk_facts.ps1
<127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 2202 TO 127.0.0.1
EXEC (via pipeline wrapper)
ok: [local] => {
    "ansible_facts": {
        "ansible_disks": [
            {
                "bootable": true, 
                "bus_type": "ATA", 
                "clustered": false, 
                "firmware_version": "1.0", 
                "friendly_name": "VBOX HARDDISK ATA Device", 
                "guid": null, 
                "location": "PCIROOT(0)#PCI(0101)#ATA(C00T00L00)", 
                "manufacturer": null, 
                "model": "VBOX HARDDISK", 
                "number": 0, 
                "operational_status": "Online", 
                "partition_count": 2, 
                "partition_style": "MBR", 
                "partitions": [
                    {
                        "access_paths": [
                            "\\\\?\\Volume{db04a125-1a6a-11e9-80bf-806e6f6e6963}\\"
                        ], 
                        "active": true, 
                        "drive_letter": null, 
                        "guid": null, 
                        "hidden": false, 
                        "mbr_type": 7, 
                        "number": 1, 
                        "offset": 1048576, 
                        "shadow_copy": false, 
                        "size": 367001600, 
                        "transition_state": 1, 
                        "type": "IFS", 
                        "volumes": [
                            {
                                "allocation_unit_size": 4096, 
                                "drive_type": "Fixed", 
                                "health_status": "Healthy", 
                                "label": "boot", 
                                "object_id": "\\\\?\\Volume{db04a125-1a6a-11e9-80bf-806e6f6e6963}\\", 
                                "path": "\\\\?\\Volume{db04a125-1a6a-11e9-80bf-806e6f6e6963}\\", 
                                "size": 366997504, 
                                "size_remaining": 92086272, 
                                "type": "NTFS"
                            }
                        ]
                    }, 
                    {
                        "access_paths": [
                            "C:\\", 
                            "\\\\?\\Volume{db04a126-1a6a-11e9-80bf-806e6f6e6963}\\"
                        ], 
                        "active": false, 
                        "drive_letter": "C", 
                        "guid": null, 
                        "hidden": false, 
                        "mbr_type": 7, 
                        "number": 2, 
                        "offset": 368050176, 
                        "shadow_copy": false, 
                        "size": 41573941248, 
                        "transition_state": 1, 
                        "type": "IFS", 
                        "volumes": [
                            {
                                "allocation_unit_size": 4096, 
                                "drive_type": "Fixed", 
                                "health_status": "Healthy", 
                                "label": "Windows 2012r2", 
                                "object_id": "\\\\?\\Volume{db04a126-1a6a-11e9-80bf-806e6f6e6963}\\", 
                                "path": "\\\\?\\Volume{db04a126-1a6a-11e9-80bf-806e6f6e6963}\\", 
                                "size": 41573937152, 
                                "size_remaining": 31882354688, 
                                "type": "NTFS"
                            }
                        ]
                    }
                ], 
                "path": "\\\\?\\ide#diskvbox_harddisk___________________________1.0_____#5&3a5410d6&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}", 
                "physical_disk": {
                    "allocated_size": 41943040000, 
                    "bus_type": "ATA", 
                    "can_pool": false, 
                    "cannot_pool_reason": "Insufficient Capacity", 
                    "device_id": "0", 
                    "firmware_version": "1.0", 
                    "friendly_name": "PhysicalDisk0", 
                    "health_status": "Healthy", 
                    "indication_enabled": null, 
                    "manufacturer": null, 
                    "media_type": "UnSpecified", 
                    "model": "VBOX HARDDISK", 
                    "object_id": "{1}\\\\WIN-CHMBD0MFEA4\\root/Microsoft/Windows/Storage/Providers_v2\\SPACES_PhysicalDisk.ObjectId=\"{db04a11f-1a6a-11e9-80bf-806e6f6e6963}:PD:{587e58d4-1a6c-11e9-80c2-806e6f6e6963}\"", 
                    "operational_status": "OK", 
                    "partial": true, 
                    "physical_location": null, 
                    "serial_number": "VB69f5b5da-74dc9a2f", 
                    "size": 41943040000, 
                    "spindle_speed": 4294967295, 
                    "supported_usages": {
                        "Count": 5, 
                        "value": [
                            "Auto-Select", 
                            "Manual-Select", 
                            "Hot Spare", 
                            "Retired", 
                            "Journal"
                        ]
                    }, 
                    "unique_id": "IDE\\DiskVBOX_HARDDISK___________________________1.0_____\\5&3a5410d6&0&0.0.0:WIN-CHMBD0MFEA4", 
                    "usage_type": "Auto-Select"
                }, 
                "read_only": false, 
                "sector_size": 512, 
                "serial_number": "VB69f5b5da-74dc9a2f", 
                "size": 41943040000, 
                "system_disk": true, 
                "unique_id": "IDE\\DISKVBOX_HARDDISK___________________________1.0_____\\5&3A5410D6&0&0.0.0:WIN-CHMBD0MFEA4"
            }
        ]
    }, 
    "changed": false
}

Copied from original issue: ansible/ansible#51032

win_scheduled_task: Not possible to create idle task

From @dagwieers on Oct 17, 2018 22:27

SUMMARY

The module does not seem to support idle tasks with a set idle time to execute, the default idle time used seems to be set to 10 minutes.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_scheduled_task

ANSIBLE VERSION

v2.8

OS / ENVIRONMENT

Windows 10 targets

STEPS TO REPRODUCE

In Windows you can create an "idle" action with a specific idle time, e.g. 30 minutes and backoff period.

We need to enforce log off of a local user after 30 mins of idle time on shared public computers.

Related info: https://superuser.com/questions/777488/task-scheduler-what-is-wait-for-idle-for

Copied from original issue: ansible/ansible#47251

win_disk_facts: Add a `subset` parameter to gather only specific facts

From @chopraaa on Feb 05, 2019 21:31

SUMMARY
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_disk_facts

ADDITIONAL INFORMATION

This can be used to reduce the data gathered and returned by the win_disk_facts module.

For a single disk/single partition server, this returns:

    "ansible_facts": {
        "ansible_disks": [
            {
                "bootable": true,
                "bus_type": "SAS",
                "clustered": false,
                "firmware_version": "2.0 ",
                "friendly_name": "AWS PVDISK SCSI Disk Device",
                "guid": null,
                "location": "PCIROOT(0)#PCI(0300)#PCI(0300)#SAS(P00T00L00)",
                "manufacturer": "AWS     ",
                "model": "PVDISK          ",
                "number": 0,
                "operational_status": "Online",
                "partition_count": 2,
                "partition_style": "MBR",
                "partitions": [
                    {
                        "access_paths": [
                            "\\\\?\\Volume{74201446-2987-11e9-825e-806e6f6e6963}\\"
                        ],
                        "active": true,
                        "drive_letter": null,
                        "guid": null,
                        "hidden": false,
                        "mbr_type": 7,
                        "number": 1,
                        "offset": 1048576,
                        "shadow_copy": false,
                        "size": 367001600,
                        "transition_state": 1,
                        "type": "IFS",
                        "volumes": [
                            {
                                "allocation_unit_size": 4096,
                                "drive_type": "Fixed",
                                "health_status": "Healthy",
                                "label": "",
                                "object_id": "\\\\?\\Volume{74201446-2987-11e9-825e-806e6f6e6963}\\",
                                "path": "\\\\?\\Volume{74201446-2987-11e9-825e-806e6f6e6963}\\",
                                "size": 366997504,
                                "size_remaining": 92209152,
                                "type": "NTFS"
                            }
                        ]
                    },
                    {
                        "access_paths": [
                            "C:\\",
                            "\\\\?\\Volume{74201447-2987-11e9-825e-806e6f6e6963}\\"
                        ],
                        "active": false,
                        "drive_letter": "C",
                        "guid": null,
                        "hidden": false,
                        "mbr_type": 7,
                        "number": 2,
                        "offset": 368050176,
                        "shadow_copy": false,
                        "size": 31843155968,
                        "transition_state": 1,
                        "type": "IFS",
                        "volumes": [
                            {
                                "allocation_unit_size": 4096,
                                "drive_type": "Fixed",
                                "health_status": "Healthy",
                                "label": "",
                                "object_id": "\\\\?\\Volume{74201447-2987-11e9-825e-806e6f6e6963}\\",
                                "path": "\\\\?\\Volume{74201447-2987-11e9-825e-806e6f6e6963}\\",
                                "size": 31843151872,
                                "size_remaining": 9631539200,
                                "type": "NTFS"
                            }
                        ]
                    }
                ],
                "path": "\\\\?\\scsi#disk&ven_aws&prod_pvdisk#000000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}",
                "physical_disk": {
                    "allocated_size": 32212254720,
                    "bus_type": "SAS",
                    "can_pool": false,
                    "cannot_pool_reason": "Insufficient Capacity",
                    "device_id": "0",
                    "firmware_version": "2.0 ",
                    "friendly_name": "PhysicalDisk0",
                    "health_status": "Healthy",
                    "indication_enabled": null,
                    "manufacturer": "AWS     ",
                    "media_type": "UnSpecified",
                    "model": "PVDISK          ",
                    "object_id": "{1}\\\\WIN-PE4KPP7H947\\root/Microsoft/Windows/Storage/Providers_v2\\SPACES_PhysicalDisk.ObjectId=\"{74201442-2987-11e9-825e-806e6f6e6963}:PD:{09573914-0d84-efea-b97b-68ecb801c634}\"",
                    "operational_status": "OK",
                    "partial": true,
                    "physical_location": null,
                    "serial_number": "vol02f99e3a82c0653a4",
                    "size": 32212254720,
                    "spindle_speed": 4294967295,
                    "supported_usages": {
                        "Count": 5,
                        "value": [
                            "Auto-Select",
                            "Manual-Select",
                            "Hot Spare",
                            "Retired",
                            "Journal"
                        ]
                    },
                    "unique_id": "vol02f99e3a82c0653a4",
                    "usage_type": "Auto-Select"
                },
                "read_only": false,
                "sector_size": 512,
                "serial_number": "vol02f99e3a82c0653a4",
                "size": 32212254720,
                "system_disk": true,
                "unique_id": "vol02f99e3a82c0653a4"
            }
        ]
    },
    "changed": false
}

And for servers with multiple disks and volumes (I deal with 20+ volumes on a single server) this can get pretty ugly and slow to process. In addition to this, you need to use set_fact once and iterate through that again to get specific values.

I suggest adding a filter parameter to output specific data. Usage for listing volumes and dynamic_disks:

win_disk_facts:
  filter:
    - volumes
    - dynamic_disks

Copied from original issue: ansible/ansible#51770

win_iis_webapplication: physical_path return param is merely a pass-through param

From @dustinwoodhouse on Feb 28, 2020 17:54

SUMMARY

The physical_path return param is merely a pass-through of the corresponding request parameter. It is a valid use case that the user may not know the physical path, for example in the case where this module is being used to REMOVE the specified web app. And in that use case, the user will want to receive the physical_path of the specified web app after removal, to easily clean up the files on disk.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_iis_webapplication

ANSIBLE VERSION
ansible 2.8.5
  config file = None
  configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vagrant/py3venv/ansible-2.8.5/.env/lib64/python3.7/site-packages/ansible
  executable location = /home/vagrant/py3venv/ansible-2.8.5/.env/bin/ansible
  python version = 3.7.4 (default, Jul  9 2019, 16:32:37) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
CONFIGURATION
OS / ENVIRONMENT

Target OS: Windows 10

STEPS TO REPRODUCE

Call the module with only name and site.

- name: Removing the web application {{ service_to_remove.service }}-{{ service_to_remove.version }}
  win_iis_webapplication:
    name: "{{ service_to_remove.service }}/{{ service_to_remove.version }}"
    site: "Default Web Site"
    state: absent
  register: web_app_removed

- debug:
    msg: "Path to clean up {{ web_app_removed.physical_path }}"    <== THIS REF RETURNS NULL
EXPECTED RESULTS

The return param should be populated with the physical_path of the target web app

ACTUAL RESULTS

The return param is being populated with the physical_path value provided by the user in the request, null if not provided.

Copied from original issue: ansible/ansible#67867

win_defrag: Defrag all volume do not work correctly

From @specator on Nov 14, 2018 11:48

SUMMARY

Defrag all volume do not work correctly because "defrag /c" do nothing.

ISSUE TYPE
  • Bug Report Pull request
COMPONENT NAME

win_defrag

ANSIBLE VERSION
ansible 2.7.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
OS / ENVIRONMENT

Windows 8, 8.1, 10, 2012, 2012R2, 2016, 2019

STEPS TO REPRODUCE

Run this play

- name: Defrag
  hosts: windows
  gather_facts: false
  tasks:
  - name: Defrag all volumes
    win_defrag:
      priority: normal
    register: defrag
  - debug:
      var: defrag
EXPECTED RESULTS

Invoke dafrag on all volumes

ACTUAL RESULTS

Do not invoke defrag due dafrag util issue.

Copied from original issue: ansible/ansible#48660

win_psmodule fails to install the prerequisites due to absence of AllowClobber

From @maxnasonov on Oct 22, 2019 11:45

SUMMARY

win_psmodule fails to install the prerequisites due to absence of AllowClobber

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_psmodule

ANSIBLE VERSION
ansible 2.8.6
  config file = None
  configured module search path = [u'/Users/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Feb 22 2019, 21:55:15) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]
CONFIGURATION
OS / ENVIRONMENT

Windows Server 2019 Datacenter

STEPS TO REPRODUCE
  - name: Add xExchange DSC module
    win_psmodule:
      name: xExchange
      repository: PSGallery
      required_version: 1.29.0.0
      state: present
EXPECTED RESULTS

Successful install of xExchange module

ACTUAL RESULTS
The following commands are already available on this system:'Find-Package,Install-Package,Uninstall-Package'. This module 'PackageManagement' may override the existing commands. If you still want to install this module 'PackageManagement', use -AllowClobber parameter.

Copied from original issue: ansible/ansible#63780

Add password to win_unzip module

From @moleszek on Feb 11, 2020 16:15

SUMMARY

According to Ansible documentation, win_unzip module does not support the password parameter.
This makes ansible unable to unpack the .zip file, which is password protected.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_unzip:
password: "password123"

ADDITIONAL INFORMATION

Adding this feature will solve problems with unpacking password-protected files.

- name: Unzip zip file
  win_unzip:
    src: C:\test\file.zip
    dest: C:\test\unpacked\
    recurse: no
    password: "password123"

Copied from original issue: ansible/ansible#67308

win_scheduled_task doesn't check for invalid task names

SUMMARY

Scheduled task names can't contain the following characters: \ / : * ? " < > |
The GUI notifies you when you try as well:
image

The module doesn't validate this though. If you try to run in check mode, it won't notice the name is invalid and won't show any error.

In regular mode, I've seen the following errors so far related to trying to create a task with an invalid character (in my case the character is : colon):

  • failed to register new task definition: Value does not fall within the expected range.
  • failed to register new task definition: The directory property cannot be found in the cache.

In the first error, path was unspecified. In the second error, path was not the default root path \, which is probably why it differs.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_scheduled_task

ANSIBLE VERSION

2.9.6

CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- hosts: hostname
  gather_facts: no
  tasks:
    - win_scheduled_task:
        name: 'Task:Name'
        actions:
          - path: powershell.exe
            arguments: '-c exit'
EXPECTED RESULTS

win_scheduled_task should validate the name, and return a helpful error indicating the name is invalid, in check mode too.

ACTUAL RESULTS
FAILED! => {"changed": false, "msg": "failed to register new task definition: Value does not fall within the expected range."}
FAILED! => {"changed": false, "msg": "failed to register new task definition: The directory property cannot be found in the cache."}

In check mode: there is no error, even though there should be.

win_unzip fails on files with a name ending in a tilde ~

SUMMARY

win_unzip fails on files with a name ending in a tilde. (~)

Probably due to this commit.
ansible/ansible#66972

This is low priority but possibly a problem for a select few. Who the hell names a file ending in a tilde???

Move from ansible/ansible#68964

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_unzip

ANSIBLE VERSION
ansible 2.9.6
  config file = /opt/ansible/ansible.cfg
  configured module search path = [u'/home/REDACTED/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
ANSIBLE_FORCE_COLOR(/REDACTED/REDACTED/ansible.cfg) = True
DEFAULT_HOST_LIST(/REDACTED/REDACTED/ansible.cfg) = [u'REDACTED']
HOST_KEY_CHECKING(REDACTED) = False
INVENTORY_ENABLED(REDACTED) = [u'ini']
OS / ENVIRONMENT

Windows Server 2016

STEPS TO REPRODUCE
  1. Create an archive file containing a file ending in a tilde
  2. unzip the archive on a windows host using win_unzip
- win_unzip:
    src: "blah.zip"
    dest: "tmp/"
EXPECTED RESULTS

It should still extract the file like version 2.8

ACTUAL RESULTS
fatal: [REDACTED]: FAILED! => {"changed": true, "dest": "c:\\REDACTED\\REDACTED/", "msg": "Error unzipping 'c:\\REDACTED\\REDACTED/REDACTED.zip' to 'c:\\REDACTED\\REDACTED/'! Filename contains relative paths which would extract outside the destination: c:\\REDACTED\\REDACTED/REDACTED/REDACTED/README.md~", "removed": false, "src": "c:\\REDACTED\\REDACTED/REDACTED.zip"}

win_audit_policy_system does not work in non-English environment

From @ssato on Mar 03, 2020 12:22

SUMMARY

win_audit_policy_system does not work as expected in non-English environment
because it calls auditpol.exe and its output varies depends on the locale.

# sample task:
- name: set audit policies
  win_audit_policy_system:
    subcategory: "{{ item.name }}"
    audit_type: "{{ item.audit_type }}"
  loop: "{{ soe_audit_policies }}"
# var def.
soe_audit_policies:
  - name: Credential Validation
    audit_type: success, failure
# error message
failed: [xxx-win2016-vmware-soe] (item={u'audit_type': u'success, failure', u'name': u'Credential Validation'}) => {"ansible_loop_var": "item", "changed": false, "item": {"audit_type": "success, failure", "name": "Credential Validation"}, "msg": "Get-AnsibleParam: Argument subcategory needs to be one of IPsec ,IPsec ,IPsec ,IPsec ,/ ,SAM,DPAPI ,RPC ,Token Right Adjusted Events,MPSSVC ,Kerberos ,Kerberos  but was Credential Validation."}

The reason of this error looks because the line does not work at all as expected
in non English locale environment, that is, audtpol.exe outputs localized
non English results instead of English ones the powershell script expects.

$categories = ConvertFrom-Csv $(auditpol /list /category /r) \| Select-Object -expand Category*

win_audit_policy_system.ps1#L27]

# An example of outputs from autitpol.exe in English (US) locale environment 
> ConvertFrom-Csv $(auditpol /list /category /r)
Category/Subcategory GUID
-------------------- ----
DS                   {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
                        {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
                        {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
                        ... (snip) ....
/                       {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
                        ... (snip) ...
# An example of outputs from autitpol.exe in Japanese (JP) locale environment 
> ConvertFrom-Csv $(auditpol /list /category /r)
ใ‚ซใƒ†ใ‚ดใƒช/ใ‚ตใƒ–ใ‚ซใƒ†ใ‚ดใƒช GUID
--------------------- ----
DS ใ‚ขใ‚ฏใ‚ปใ‚น                  {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
ใ‚ขใ‚ซใ‚ฆใƒณใƒˆ ใƒญใ‚ฐใ‚ชใƒณ     {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
ใ‚ขใ‚ซใ‚ฆใƒณใƒˆ็ฎก็†             {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆ ใ‚ขใ‚ฏใ‚ปใ‚น {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
ใ‚ทใ‚นใƒ†ใƒ                         {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
ใƒใƒชใ‚ทใƒผใฎๅค‰ๆ›ด             {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
x`ใƒญใ‚ฐใ‚ชใƒณ/ใƒญใ‚ฐใ‚ชใƒ•        {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
็‰นๆจฉใฎไฝฟ็”จ                    {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
่ฉณ็ดฐ่ฟฝ่ทก                        {699xxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_audit_policy_system

ANSIBLE VERSION
$ ansible --version
ansible 2.9.2
  config file = None
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vagrant/.local/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

$
CONFIGURATION

(nothing was output.)

OS / ENVIRONMENT
STEPS TO REPRODUCE

See the previous example.

EXPECTED RESULTS

It works as expected.

ACTUAL RESULTS

See the previous example.

Copied from original issue: ansible/ansible#67962

win_disk_image fails when image is already mounted

From @neilalexander on Apr 02, 2019 13:25

SUMMARY

The win_disk_image target seems to fail occasionally when the disk image is already mounted, breaking idempotency.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_disk_image

ANSIBLE VERSION
ansible 2.7.9
  config file = None
  configured module search path = [u'/Users/neilalexander/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible
  executable location = /Library/Frameworks/Python.framework/Versions/2.7/bin/ansible
  python version = 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
CONFIGURATION
none
OS / ENVIRONMENT

Ansible is running on macOS Mojave 10.14.3. Target server is Windows Server 2016.

STEPS TO REPRODUCE

Happens only intermittently. Can't seem to reproduce 100% of the time.

win_disk_image:
  image_path: 'C:\path\to\isoimage.iso'
  state: present
  • First attempt works as expected, mounting the image.
  • Second attempt fails with error as below as the image is already mounted.
EXPECTED RESULTS
  • If the disk image is not mounted, it should be mounted.
  • If the disk image is already mounted, it should return OK/unchanged status.
ACTUAL RESULTS
  • If the disk image is not mounted, it is mounted correctly.
  • If the disk image is already mounted, an error status is generated:
MODULE FAILURE
See stdout/stderr for the exact error

MODULE_STDERR:
The property 'DriveLetter' cannot be found on this object. Verify that the property exists.
At line:52 char:7+
       $drive_letters = ($di | Get-Volume).DriveLetter
     + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
     + FullyQualifiedErrorId : PropertyNotFoundStrict 

Copied from original issue: ansible/ansible#54723

win_chocolatey: package exitcode fails task

From @andmos on Apr 29, 2019 07:42

SUMMARY

Hypothesis: When chocolatey package throws its own exit code (different from 0 or 1) the win_chocolatey task fails, even if installation is complete. Might be solved by supporting --ignore-package-exit-codes.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_chocolatey

ANSIBLE VERSION
ansible 2.7.10
  config file = /Users/andreasmosti/Dev/AnsiblePlaybooks/ansible.cfg
  configured module search path = ['/Users/andreasmosti/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.7.10/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Mar 27 2019, 09:23:32) [Clang 9.0.0 (clang-900.0.39.2)]
CONFIGURATION
DEFAULT_FORKS(/Users/andreasmosti/Dev/AnsiblePlaybooks/ansible.cfg) = 10
DEFAULT_STDOUT_CALLBACK(/Users/andreasmosti/Dev/AnsiblePlaybooks/ansible.cfg) = yaml
DISPLAY_SKIPPED_HOSTS(/Users/andreasmosti/Dev/AnsiblePlaybooks/ansible.cfg) = True
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
OS / ENVIRONMENT

Running from MACOS against Windows Server 2016

STEPS TO REPRODUCE

Given Windows Server with outdated version of pip, installation of mkdocs goes smooth, but after running the message:

    You are using pip version 9.0.1, however version 19.1 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.

    The install of mkdocs was NOT successful.
    Error while running 'C:\ProgramData\chocolatey\lib\mkdocs\tools\ChocolateyInstall.ps1'.
     See log for details.

Makes the package fail. Hypothesis is that pip throws exit code different from 0 or 1.

- name: Install Mkdocs
  win_chocolatey: name=mkdocs
  tags: mkdocs
EXPECTED RESULTS

Expected result is ofc for successful install, but the flag --ignore-package-exit-codes might be needed from the module. Thoughts?

ACTUAL RESULTS
TASK [Mkdocs : Install Mkdocs] ************************************************************************************************************
task path: /Users/andreasmosti/Dev/AnsiblePlaybooks/roles/Mkdocs/tasks/main.yaml:2
Using module file /usr/local/Cellar/ansible/2.7.10/libexec/lib/python3.7/site-packages/ansible/modules/windows/win_chocolatey.ps1
<vt-tc-build09.dips.local> ESTABLISH WINRM CONNECTION FOR USER: ansibleadmin on PORT 5986 TO vt-tc-build09.dips.local
checking if winrm_host vt-tc-build09.dips.local is an IPv6 address
EXEC (via pipeline wrapper)
fatal: [vt-tc-build09.dips.local]: FAILED! => changed=false
  command: C:\ProgramData\chocolatey\bin\choco.exe install mkdocs --fail-on-unfound --yes --no-progress --verbose --timeout 2700 --version 1.0.4
  msg: Error installing package(s) 'mkdocs'
  rc: 1
  stderr: ''
  stderr_lines: []
  stdout: |-
    Chocolatey v0.10.11
    Installing the following packages:
    mkdocs
    By installing you accept licenses for the packages.
    [NuGet] Attempting to resolve dependency 'chocolatey-core.extension ( 1.3.3)'.
    [NuGet] Attempting to resolve dependency 'Python ( 2.6)'.
    [NuGet] Attempting to resolve dependency 'python3 (= 3.6.4.20180116)'.
    [NuGet] Attempting to resolve dependency 'chocolatey ( 0.10.5)'.
    [NuGet] Installing 'mkdocs 1.0.4'.
    [NuGet] Successfully installed 'mkdocs 1.0.4'.

    mkdocs v1.0.4 [Approved]
    mkdocs package files install completed. Performing other installation steps.
    VERBOSE: Exporting function 'Format-FileSize'.
    VERBOSE: Exporting function 'Get-BinRoot'.
    VERBOSE: Exporting function 'Get-ChecksumValid'.
    VERBOSE: Exporting function 'Get-ChocolateyUnzip'.
    VERBOSE: Exporting function 'Get-ChocolateyWebFile'.
    VERBOSE: Exporting function 'Get-EnvironmentVariable'.
    VERBOSE: Exporting function 'Get-EnvironmentVariableNames'.
    VERBOSE: Exporting function 'Get-FtpFile'.
    VERBOSE: Exporting function 'Get-OSArchitectureWidth'.
    VERBOSE: Exporting function 'Get-PackageParameters'.
    VERBOSE: Exporting function 'Get-PackageParametersBuiltIn'.
    VERBOSE: Exporting function 'Get-ProcessorBits'.
    VERBOSE: Exporting function 'Get-ToolsLocation'.
    VERBOSE: Exporting function 'Get-UACEnabled'.
    VERBOSE: Exporting function 'Get-UninstallRegistryKey'.
    VERBOSE: Exporting function 'Get-VirusCheckValid'.
    VERBOSE: Exporting function 'Get-WebFile'.
    VERBOSE: Exporting function 'Get-WebFileName'.
    VERBOSE: Exporting function 'Get-WebHeaders'.
    VERBOSE: Exporting function 'Install-BinFile'.
    VERBOSE: Exporting function 'Install-ChocolateyDesktopLink'.
    VERBOSE: Exporting function 'Install-ChocolateyEnvironmentVariable'.
    VERBOSE: Exporting function 'Install-ChocolateyExplorerMenuItem'.
    VERBOSE: Exporting function 'Install-ChocolateyFileAssociation'.
    VERBOSE: Exporting function 'Install-ChocolateyInstallPackage'.
    VERBOSE: Exporting function 'Install-ChocolateyPackage'.
    VERBOSE: Exporting function 'Install-ChocolateyPath'.
    VERBOSE: Exporting function 'Install-ChocolateyPinnedTaskBarItem'.
    VERBOSE: Exporting function 'Install-ChocolateyPowershellCommand'.
    VERBOSE: Exporting function 'Install-ChocolateyShortcut'.
    VERBOSE: Exporting function 'Install-ChocolateyVsixPackage'.
    VERBOSE: Exporting function 'Install-ChocolateyZipPackage'.
    VERBOSE: Exporting function 'Install-Vsix'.
    VERBOSE: Exporting function 'Set-EnvironmentVariable'.
    VERBOSE: Exporting function 'Set-PowerShellExitCode'.
    VERBOSE: Exporting function 'Start-ChocolateyProcessAsAdmin'.
    VERBOSE: Exporting function 'Test-ProcessAdminRights'.
    VERBOSE: Exporting function 'Uninstall-BinFile'.
    VERBOSE: Exporting function 'Uninstall-ChocolateyEnvironmentVariable'.
    VERBOSE: Exporting function 'Uninstall-ChocolateyPackage'.
    VERBOSE: Exporting function 'Uninstall-ChocolateyZipPackage'.
    VERBOSE: Exporting function 'Update-SessionEnvironment'.
    VERBOSE: Exporting function 'Write-ChocolateyFailure'.
    VERBOSE: Exporting function 'Write-ChocolateySuccess'.
    VERBOSE: Exporting function 'Write-FileUpdateLog'.
    VERBOSE: Exporting function 'Write-FunctionCallLogMessage'.
    VERBOSE: Exporting alias 'Get-ProcessorBits'.
    VERBOSE: Exporting alias 'Get-OSBitness'.
    VERBOSE: Exporting alias 'Get-InstallRegistryKey'.
    VERBOSE: Exporting alias 'Generate-BinFile'.
    VERBOSE: Exporting alias 'Add-BinFile'.
    VERBOSE: Exporting alias 'Start-ChocolateyProcess'.
    VERBOSE: Exporting alias 'Invoke-ChocolateyProcess'.
    VERBOSE: Exporting alias 'Remove-BinFile'.
    VERBOSE: Exporting alias 'refreshenv'.
    VERBOSE: Loading module from path 'C:\ProgramData\chocolatey\extensions\chocolatey-core\chocolatey-core.psm1'.
    VERBOSE: Exporting function 'Get-UninstallRegistryKey'.
    VERBOSE: Exporting function 'Get-AppInstallLocation'.
    VERBOSE: Exporting function 'Get-AvailableDriveLetter'.
    VERBOSE: Exporting function 'Get-EffectiveProxy'.
    VERBOSE: Exporting function 'Get-PackageCacheLocation'.
    VERBOSE: Exporting function 'Get-PackageParameters'.
    VERBOSE: Exporting function 'Get-WebContent'.
    VERBOSE: Exporting function 'Register-Application'.
    VERBOSE: Importing function 'Get-AppInstallLocation'.
    VERBOSE: Importing function 'Get-AvailableDriveLetter'.
    VERBOSE: Importing function 'Get-EffectiveProxy'.
    VERBOSE: Importing function 'Get-PackageCacheLocation'.
    VERBOSE: Importing function 'Get-PackageParameters'.
    VERBOSE: Importing function 'Get-UninstallRegistryKey'.
    VERBOSE: Importing function 'Get-WebContent'.
    VERBOSE: Importing function 'Register-Application'.
    VERBOSE: Loading module from path 'C:\ProgramData\chocolatey\extensions\chocolatey-visualstudio\chocolatey-visualstudio.extension.psm1'.
    VERBOSE: Exporting function 'Add-VisualStudioComponent'.
    VERBOSE: Exporting function 'Add-VisualStudioWorkload'.
    VERBOSE: Exporting function 'Get-VisualStudioInstaller'.
    VERBOSE: Exporting function 'Get-VisualStudioInstallerHealth'.
    VERBOSE: Exporting function 'Get-VisualStudioInstance'.
    VERBOSE: Exporting function 'Get-VisualStudioVsixInstaller'.
    VERBOSE: Exporting function 'Install-VisualStudio'.
    VERBOSE: Exporting function 'Install-VisualStudioInstaller'.
    VERBOSE: Exporting function 'Install-VisualStudioVsixExtension'.
    VERBOSE: Exporting function 'Remove-VisualStudioComponent'.
    VERBOSE: Exporting function 'Remove-VisualStudioProduct'.
    VERBOSE: Exporting function 'Remove-VisualStudioWorkload'.
    VERBOSE: Exporting function 'Uninstall-VisualStudio'.
    VERBOSE: Exporting function 'Uninstall-VisualStudioVsixExtension'.
    VERBOSE: Importing function 'Add-VisualStudioComponent'.
    VERBOSE: Importing function 'Add-VisualStudioWorkload'.
    VERBOSE: Importing function 'Get-VisualStudioInstaller'.
    VERBOSE: Importing function 'Get-VisualStudioInstallerHealth'.
    VERBOSE: Importing function 'Get-VisualStudioInstance'.
    VERBOSE: Importing function 'Get-VisualStudioVsixInstaller'.
    VERBOSE: Importing function 'Install-VisualStudio'.
    VERBOSE: Importing function 'Install-VisualStudioInstaller'.
    VERBOSE: Importing function 'Install-VisualStudioVsixExtension'.
    VERBOSE: Importing function 'Remove-VisualStudioComponent'.
    VERBOSE: Importing function 'Remove-VisualStudioProduct'.
    VERBOSE: Importing function 'Remove-VisualStudioWorkload'.
    VERBOSE: Importing function 'Uninstall-VisualStudio'.
    VERBOSE: Importing function 'Uninstall-VisualStudioVsixExtension'.
    VERBOSE: Loading module from path 'C:\ProgramData\chocolatey\extensions\chocolatey-windowsupdate\chocolatey-windowsupdate.psm1'.
    VERBOSE: Exporting function 'Install-WindowsUpdate'.
    VERBOSE: Exporting function 'Test-WindowsUpdate'.
    VERBOSE: Importing function 'Install-WindowsUpdate'.
    VERBOSE: Importing function 'Test-WindowsUpdate'.
    VERBOSE: Exporting function 'Format-FileSize'.
    VERBOSE: Exporting function 'Get-BinRoot'.
    VERBOSE: Exporting function 'Get-ChecksumValid'.
    VERBOSE: Exporting function 'Get-ChocolateyUnzip'.
    VERBOSE: Exporting function 'Get-ChocolateyWebFile'.
    VERBOSE: Exporting function 'Get-EnvironmentVariable'.
    VERBOSE: Exporting function 'Get-EnvironmentVariableNames'.
    VERBOSE: Exporting function 'Get-FtpFile'.
    VERBOSE: Exporting function 'Get-OSArchitectureWidth'.
    VERBOSE: Exporting function 'Get-PackageParameters'.
    VERBOSE: Exporting function 'Get-PackageParametersBuiltIn'.
    VERBOSE: Exporting function 'Get-ProcessorBits'.
    VERBOSE: Exporting function 'Get-ToolsLocation'.
    VERBOSE: Exporting function 'Get-UACEnabled'.
    VERBOSE: Exporting function 'Get-UninstallRegistryKey'.
    VERBOSE: Exporting function 'Get-VirusCheckValid'.
    VERBOSE: Exporting function 'Get-WebFile'.
    VERBOSE: Exporting function 'Get-WebFileName'.
    VERBOSE: Exporting function 'Get-WebHeaders'.
    VERBOSE: Exporting function 'Install-BinFile'.
    VERBOSE: Exporting function 'Install-ChocolateyDesktopLink'.
    VERBOSE: Exporting function 'Install-ChocolateyEnvironmentVariable'.
    VERBOSE: Exporting function 'Install-ChocolateyExplorerMenuItem'.
    VERBOSE: Exporting function 'Install-ChocolateyFileAssociation'.
    VERBOSE: Exporting function 'Install-ChocolateyInstallPackage'.
    VERBOSE: Exporting function 'Install-ChocolateyPackage'.
    VERBOSE: Exporting function 'Install-ChocolateyPath'.
    VERBOSE: Exporting function 'Install-ChocolateyPinnedTaskBarItem'.
    VERBOSE: Exporting function 'Install-ChocolateyPowershellCommand'.
    VERBOSE: Exporting function 'Install-ChocolateyShortcut'.
    VERBOSE: Exporting function 'Install-ChocolateyVsixPackage'.
    VERBOSE: Exporting function 'Install-ChocolateyZipPackage'.
    VERBOSE: Exporting function 'Install-Vsix'.
    VERBOSE: Exporting function 'Set-EnvironmentVariable'.
    VERBOSE: Exporting function 'Set-PowerShellExitCode'.
    VERBOSE: Exporting function 'Start-ChocolateyProcessAsAdmin'.
    VERBOSE: Exporting function 'Test-ProcessAdminRights'.
    VERBOSE: Exporting function 'Uninstall-BinFile'.
    VERBOSE: Exporting function 'Uninstall-ChocolateyEnvironmentVariable'.
    VERBOSE: Exporting function 'Uninstall-ChocolateyPackage'.
    VERBOSE: Exporting function 'Uninstall-ChocolateyZipPackage'.
    VERBOSE: Exporting function 'Update-SessionEnvironment'.
    VERBOSE: Exporting function 'Write-ChocolateyFailure'.
    VERBOSE: Exporting function 'Write-ChocolateySuccess'.
    VERBOSE: Exporting function 'Write-FileUpdateLog'.
    VERBOSE: Exporting function 'Write-FunctionCallLogMessage'.
    VERBOSE: Exporting function 'Get-AppInstallLocation'.
    VERBOSE: Exporting function 'Get-AvailableDriveLetter'.
    VERBOSE: Exporting function 'Get-EffectiveProxy'.
    VERBOSE: Exporting function 'Get-PackageCacheLocation'.
    VERBOSE: Exporting function 'Get-WebContent'.
    VERBOSE: Exporting function 'Register-Application'.
    VERBOSE: Exporting function 'Add-VisualStudioComponent'.
    VERBOSE: Exporting function 'Add-VisualStudioWorkload'.
    VERBOSE: Exporting function 'Get-VisualStudioInstaller'.
    VERBOSE: Exporting function 'Get-VisualStudioInstallerHealth'.
    VERBOSE: Exporting function 'Get-VisualStudioInstance'.
    VERBOSE: Exporting function 'Get-VisualStudioVsixInstaller'.
    VERBOSE: Exporting function 'Install-VisualStudio'.
    VERBOSE: Exporting function 'Install-VisualStudioInstaller'.
    VERBOSE: Exporting function 'Install-VisualStudioVsixExtension'.
    VERBOSE: Exporting function 'Remove-VisualStudioComponent'.
    VERBOSE: Exporting function 'Remove-VisualStudioProduct'.
    VERBOSE: Exporting function 'Remove-VisualStudioWorkload'.
    VERBOSE: Exporting function 'Uninstall-VisualStudio'.
    VERBOSE: Exporting function 'Uninstall-VisualStudioVsixExtension'.
    VERBOSE: Exporting function 'Install-WindowsUpdate'.
    VERBOSE: Exporting function 'Test-WindowsUpdate'.
    VERBOSE: Exporting alias 'Get-ProcessorBits'.
    VERBOSE: Exporting alias 'Get-OSBitness'.
    VERBOSE: Exporting alias 'Get-InstallRegistryKey'.
    VERBOSE: Exporting alias 'Generate-BinFile'.
    VERBOSE: Exporting alias 'Add-BinFile'.
    VERBOSE: Exporting alias 'Start-ChocolateyProcess'.
    VERBOSE: Exporting alias 'Invoke-ChocolateyProcess'.
    VERBOSE: Exporting alias 'Remove-BinFile'.
    VERBOSE: Exporting alias 'refreshenv'.
    VERBOSE: Importing function 'Add-VisualStudioComponent'.
    VERBOSE: Importing function 'Add-VisualStudioWorkload'.
    VERBOSE: Importing function 'Format-FileSize'.
    VERBOSE: Importing function 'Get-AppInstallLocation'.
    VERBOSE: Importing function 'Get-AvailableDriveLetter'.
    VERBOSE: Importing function 'Get-BinRoot'.
    VERBOSE: Importing function 'Get-ChecksumValid'.
    VERBOSE: Importing function 'Get-ChocolateyUnzip'.
    VERBOSE: Importing function 'Get-ChocolateyWebFile'.
    VERBOSE: Importing function 'Get-EffectiveProxy'.
    VERBOSE: Importing function 'Get-EnvironmentVariable'.
    VERBOSE: Importing function 'Get-EnvironmentVariableNames'.
    VERBOSE: Importing function 'Get-FtpFile'.
    VERBOSE: Importing function 'Get-OSArchitectureWidth'.
    VERBOSE: Importing function 'Get-PackageCacheLocation'.
    VERBOSE: Importing function 'Get-PackageParameters'.
    VERBOSE: Importing function 'Get-PackageParametersBuiltIn'.
    VERBOSE: Importing function 'Get-ProcessorBits'.
    VERBOSE: Importing function 'Get-ToolsLocation'.
    VERBOSE: Importing function 'Get-UACEnabled'.
    VERBOSE: Importing function 'Get-UninstallRegistryKey'.
    VERBOSE: Importing function 'Get-VirusCheckValid'.
    VERBOSE: Importing function 'Get-VisualStudioInstaller'.
    VERBOSE: Importing function 'Get-VisualStudioInstallerHealth'.
    VERBOSE: Importing function 'Get-VisualStudioInstance'.
    VERBOSE: Importing function 'Get-VisualStudioVsixInstaller'.
    VERBOSE: Importing function 'Get-WebContent'.
    VERBOSE: Importing function 'Get-WebFile'.
    VERBOSE: Importing function 'Get-WebFileName'.
    VERBOSE: Importing function 'Get-WebHeaders'.
    VERBOSE: Importing function 'Install-BinFile'.
    VERBOSE: Importing function 'Install-ChocolateyDesktopLink'.
    VERBOSE: Importing function 'Install-ChocolateyEnvironmentVariable'.
    VERBOSE: Importing function 'Install-ChocolateyExplorerMenuItem'.
    VERBOSE: Importing function 'Install-ChocolateyFileAssociation'.
    VERBOSE: Importing function 'Install-ChocolateyInstallPackage'.
    VERBOSE: Importing function 'Install-ChocolateyPackage'.
    VERBOSE: Importing function 'Install-ChocolateyPath'.
    VERBOSE: Importing function 'Install-ChocolateyPinnedTaskBarItem'.
    VERBOSE: Importing function 'Install-ChocolateyPowershellCommand'.
    VERBOSE: Importing function 'Install-ChocolateyShortcut'.
    VERBOSE: Importing function 'Install-ChocolateyVsixPackage'.
    VERBOSE: Importing function 'Install-ChocolateyZipPackage'.
    VERBOSE: Importing function 'Install-VisualStudio'.
    VERBOSE: Importing function 'Install-VisualStudioInstaller'.
    VERBOSE: Importing function 'Install-VisualStudioVsixExtension'.
    VERBOSE: Importing function 'Install-Vsix'.
    VERBOSE: Importing function 'Install-WindowsUpdate'.
    VERBOSE: Importing function 'Register-Application'.
    VERBOSE: Importing function 'Remove-VisualStudioComponent'.
    VERBOSE: Importing function 'Remove-VisualStudioProduct'.
    VERBOSE: Importing function 'Remove-VisualStudioWorkload'.
    VERBOSE: Importing function 'Set-EnvironmentVariable'.
    VERBOSE: Importing function 'Set-PowerShellExitCode'.
    VERBOSE: Importing function 'Start-ChocolateyProcessAsAdmin'.
    VERBOSE: Importing function 'Test-ProcessAdminRights'.
    VERBOSE: Importing function 'Test-WindowsUpdate'.
    VERBOSE: Importing function 'Uninstall-BinFile'.
    VERBOSE: Importing function 'Uninstall-ChocolateyEnvironmentVariable'.
    VERBOSE: Importing function 'Uninstall-ChocolateyPackage'.
    VERBOSE: Importing function 'Uninstall-ChocolateyZipPackage'.
    VERBOSE: Importing function 'Uninstall-VisualStudio'.
    VERBOSE: Importing function 'Uninstall-VisualStudioVsixExtension'.
    VERBOSE: Importing function 'Update-SessionEnvironment'.
    VERBOSE: Importing function 'Write-ChocolateyFailure'.
    VERBOSE: Importing function 'Write-ChocolateySuccess'.
    VERBOSE: Importing function 'Write-FileUpdateLog'.
    VERBOSE: Importing function 'Write-FunctionCallLogMessage'.
    VERBOSE: Importing alias 'Add-BinFile'.
    VERBOSE: Importing alias 'Generate-BinFile'.
    VERBOSE: Importing alias 'Get-InstallRegistryKey'.
    VERBOSE: Importing alias 'Get-OSBitness'.
    VERBOSE: Importing alias 'Get-ProcessorBits'.
    VERBOSE: Importing alias 'Invoke-ChocolateyProcess'.
    VERBOSE: Importing alias 'refreshenv'.
    VERBOSE: Importing alias 'Remove-BinFile'.
    VERBOSE: Importing alias 'Start-ChocolateyProcess'.
    VERBOSE: Refreshing environment variables from the registry.
    Requirement already satisfied: mkdocs==1.0.4 in c:\python36\lib\site-packages
    Requirement already satisfied: click>=3.3 in c:\python36\lib\site-packages (from mkdocs==1.0.4)
    Requirement already satisfied: Markdown>=2.3.1 in c:\python36\lib\site-packages (from mkdocs==1.0.4)
    Requirement already satisfied: livereload>=2.5.1 in c:\python36\lib\site-packages (from mkdocs==1.0.4)
    Requirement already satisfied: tornado>=5.0 in c:\python36\lib\site-packages (from mkdocs==1.0.4)
    Requirement already satisfied: Jinja2>=2.7.1 in c:\python36\lib\site-packages (from mkdocs==1.0.4)
    Requirement already satisfied: PyYAML>=3.10 in c:\python36\lib\site-packages (from mkdocs==1.0.4)
    Requirement already satisfied: six in c:\python36\lib\site-packages (from livereload>=2.5.1->mkdocs==1.0.4)
    Requirement already satisfied: MarkupSafe>=0.23 in c:\python36\lib\site-packages (from Jinja2>=2.7.1->mkdocs==1.0.4)
    You are using pip version 9.0.1, however version 19.1 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.

    The install of mkdocs was NOT successful.
    Error while running 'C:\ProgramData\chocolatey\lib\mkdocs\tools\ChocolateyInstall.ps1'.
     See log for details.

    Chocolatey installed 0/1 packages. 1 packages failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

    Failures
     - mkdocs - Error while running 'C:\ProgramData\chocolatey\lib\mkdocs\tools\ChocolateyInstall.ps1'.
     See log for details.

    Enjoy using Chocolatey? Explore more amazing features to take your
    experience to the next level at
     https://chocolatey.org/compare

Copied from original issue: ansible/ansible#55873

win_domain_user: The server is not operational

SUMMARY

If a domain controller is shutdown for maintenance or similar reasons, a new user could not be created sometimes. The parameter "domain_server" is not used for the command "Get-ADPrincipalGroupMembership". It should be "ADPrincipalGroupMembership -Server YOURDC -ResourceContextServer YOURDC" when a "domain_server" is passed.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_domain_user

ANSIBLE VERSION
2.9.6
CONFIGURATION
DEFAULT_HOST_LIST(/mnt/c/git/ansible/ansible.cfg) = [u'/mnt/c/Git/ansible/environments/XXX-XXX/inventory']
DEFAULT_ROLES_PATH(/mnt/c/git/ansible/ansible.cfg) = [u'/mnt/c/git/ansible/roles']
OS / ENVIRONMENT

Targeted Domain Controller has Windows Server 2012 R2

STEPS TO REPRODUCE
Shutdown a domain controller and create a user:

- name: Ensure user bob is present in OU ou=test,dc=domain,dc=local
  win_domain_user:
    name: bob
    password: YOURPASSWORD
    state: present
    path: OU=Users,OU=Test,DC=YOURDOMAIN,DC=ch
    domain_server: YOURDC
  delegate_to: YOURSERVER
EXPECTED RESULTS

A user could be created even if any domain controller is shutdown, when a specific domain controller is targeted.

ACTUAL RESULTS
TASK [windows-admins : Ensure user bob is present in OU ou=test,dc=domain,dc=local] ***********************************************************************************************
task path: /mnt/c/git/ansible/roles/windows-admins/tasks/main.yml:27
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_domain_user.ps1
Pipelining is enabled.
<YOURDC.local> ESTABLISH WINRM CONNECTION FOR USER: [email protected] on PORT 5986 TO YOURDC.local
EXEC (via pipeline wrapper)
The full traceback is:
The server is not operational
At line:355 char:25
+ ...  ($group in (Get-ADPrincipalGroupMembership $username @extra_args)) {
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (bob:ADPrincipal) [Get-ADPrincipalGroupMembership], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:8250,Microsoft.ActiveDirectory.Management.Commands.GetADPrincipalGroupMembership

ScriptStackTrace:
at <ScriptBlock>, <No file>: line 355

Microsoft.ActiveDirectory.Management.ADException: The server is not operational ---> System.ServiceModel.FaultException`1[schemas.microsoft.com._2008._1.ActiveDirectory.CustomActions.GetADPrincipalGroupMembershipFault]: Active Directory returned an error processing the operation.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at schemas.microsoft.com._2008._1.ActiveDirectory.CustomActions.AccountManagement.GetADPrincipalGroupMembership(GetADPrincipalGroupMembershipRequest request)
   at Microsoft.ActiveDirectory.Management.AdwsConnection.GetADPrincipalGroupMembership(GetADPrincipalGroupMembershipRequest request)
   --- End of inner exception stack trace ---
   at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowExceptionForErrorCode(String message, String errorCode, String extendedErrorMessage, Exception innerException)
   at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowException(CustomActionFault caFault, FaultException faultException)
   at Microsoft.ActiveDirectory.Management.AdwsConnection.GetADPrincipalGroupMembership(GetADPrincipalGroupMembershipRequest request)
   at Microsoft.ActiveDirectory.Management.ADWebServiceStoreAccess.Microsoft.ActiveDirectory.Management.IADAccountManagement.GetADPrincipalGroupMembership(ADSessionHandle handle, GetADPrincipalGroupMembershipRequest request)
   at Microsoft.ActiveDirectory.Management.ADAccountManagement.GetPrincipalGroupMembership(String partitionDN, String principalDN, String resourceContextServer, String resourceContextPartition)
   at Microsoft.ActiveDirectory.Management.Commands.GetADPrincipalGroupMembership.GetGroupMembershipProcessCSRoutine()
   at Microsoft.ActiveDirectory.Management.CmdletSubroutinePipeline.Invoke()
   at Microsoft.ActiveDirectory.Management.Commands.ADCmdletBase`1.ProcessRecord()
fatal: [YOURDC.local -> YOURDC.local]: FAILED! => {
    "changed": false, 
    "msg": "Unhandled exception while executing module: The server is not operational"
}

win_pester module will cause powershell.exe to spin out of control with cpu and memory usage

From @paylocity-sflanders on Aug 08, 2018 20:44

SUMMARY

It appears that the way powershell is started by ansible is not friendly to failed tests in pester. As long as you are running the tests in a powershell session separate from the ansible one it seems to work fine. Passing tests dont have the issue in most cases. To keep things simple i just manually install pester on the windows host. I tested this with versions going back to 3.4.6.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_pester

ANSIBLE VERSION
ansible 2.6.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
CONFIGURATION

N/A

OS / ENVIRONMENT

Workstation: Centos 7 (vm and container)
Server: Windows 10, Windows 2016

STEPS TO REPRODUCE

Below are some general setup steps

  • Install a version of Pester on windows host. I tested all the way back to 3.4.6 and always had one version installed at a time.
  • I used docker for windows so i could do everything locally. You can use this as starting point or just use a centos vm

FROM centos:7

ARG SOFTWARE_URL

RUN yum install -y epel-release-7-11;
yum install -y git-1.8.3.1-14.el7_5;
yum install -y python2-pip-8.1.2-6.el7;
yum install -y ansible-2.6.2-1.el7;
yum install -y python-devel-2.7.5-69.el7_5;
yum install -y krb5-workstation-1.15.1-19.el7;
yum install -y krb5-devel-1.15.1-19.el7;
yum install -y krb5-libs-1.15.1-19.el7;
yum install -y gcc-4.8.5-28.el7_5.1;
yum install -y python2-ansible-tower-cli-3.3.0-2.el7.noarch;
curl https://packages.microsoft.com/config/rhel/7/prod.repo | tee /etc/yum.repos.d/microsoft.repo;
yum install -y powershell-6.0.2-1.rhel.7;
yum clean all;
pwsh -c "curl ${SOFTWARE_URL}/powershell/profile/v1/profile.ps1 | tee $PSHOME/profile.ps1";
pwsh -c "Get-PackageSource";
ln /usr/bin/pwsh /usr/bin/powershell;
pip install pip==10.0.1;
pip install --ignore-installed requests==2.18.4;
pip install pywinrm==0.3.0;
pip install idna==2.6;
pip install kerberos==1.3.0;
pip install pywinrm[kerberos]==0.3.0;
pip install requests_kerberos==0.12.0;
curl ${SOFTWARE_URL}/kerberos/container/v1/krb5.conf | tee /etc/krb5.conf;
pip install cryptography==2.2.1;
pip install --ignore-installed ansible[azure]==2.6.1;
pip install pyvmomi==6.7.0;
pip install f5-sdk==3.0.15;
pip install setuptools==40.0.0;
pip install bigsuds==1.0.6;
pip install netaddr==0.7.19;

  • once you have your docker image you can use a command like: docker run --rm -it -v C:\pathtothesefiles:/home/code -w /home/code ansible-workstation
  • you can also use a normal centos VM as well. The problem will be the same
  • you will want to update the test_runner.ps1 to point to whatever host is your windows machine
  • copy these scripts to a folder on the host machine and make note of the path

Run the following

  • linux - test_runner.ps1 - this will do all the ansible based tests. It will ask for the path on the server where these scripts live or you can change the default value. As the failure tasks run be ready to kill those processes because they will continually consume memory and cpu
  • windows - self_contained_fail.ps1 - this will work as expected, can also use Enter-PSSession and will get same behavior
  • windows - self_contained_pass.ps1 - this will work as expected, can also use Enter-PSSession and will get same behavior
EXPECTED RESULTS

pester exists properly

ACTUAL RESULTS

pester spins for long period of time and consumes large amounts of cpu and memory while doing basically nothing.

ansible-pester-test.zip

Copied from original issue: ansible/ansible#43844

win_psmodule behind proxy (NuGet)

From @jn-bedag on Apr 01, 2019 10:53

SUMMARY

win_psmodule does not work if the windows machine is behind a proxy server.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_psmodule, Install-PackageProvider

ANSIBLE VERSION
ansible 2.6.4
python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
OS / ENVIRONMENT

Windows Server (2016)

STEPS TO REPRODUCE
  1. NuGet provider is not installed. Check with Get-PackageProvider.
  2. The windows machine is behind a network proxy.
  3. Normally, the proxy is not set on windows machines (policy).
  4. Use the following tasks in Ansible:
- name: set proxy
  win_shell: netsh winhttp set proxy "yourproxy:8080"

- name: Install module
  win_psmodule:
    name: somemodule

- name: unset proxy
  win_shell: netsh winhttp reset proxy
EXPECTED RESULTS

NuGet provider and the module gets installed.

ACTUAL RESULTS

The NuGet provider cannot be installed, because Install-PackageProvider does not use the netsh system proxy (which most modules work with).

TASK [test : Install module] ************************************************************************************************************************************
fatal: [servername]: FAILED! => {
    "changed": false,
    "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.",
    "nuget_changed": false,
    "output": "",
    "repository_changed": false
}
ANALYSIS

Install-PackageProvider is somehow not working with a system proxy set with netsh.
This is more a PowerShell problem, but we have to deal with it in Ansible.

Install-PackageProvider does have a paramter -Proxy. If I manually execute the command and set the -Proxy, the installation is working.
Install-PackageProvider is working if I set the proxy in Internet Explorer for the user who executes the module.
Install-PackageProvider is working when we set a proxy with System.Net.WebClient.

However, a proxy-parameter is not implemented in win_psmodule.

Will you fix this, or how are we supposed to deal with this problem?

Thanks a lot!

Regards
jn

Copied from original issue: ansible/ansible#54669

win_iis_website parameters does not work for all parameters

From @Gibby on Jul 26, 2018 13:28

SUMMARY

Using win_iis_website to setup a website and trying to also set the default document.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_iis_website

ANSIBLE VERSION
ansible 2.6.1
  config file = ansible.cfg
  configured module search path = [u'~/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]

CONFIGURATION

DEFAULT_CALLBACK_WHITELIST(ansible.cfg) = ['profile_tasks']

OS / ENVIRONMENT

OS running from: Ubuntu 18.04
OS managing: Windows 2012 R2

STEPS TO REPRODUCE
- name: Setup Default Website
  win_iis_website:
    name: Default Web Site
    state: started
    port: 80
    application_pool: DefaultAppPool
    physical_path: d:\inetpub\wwwroot
    parameters: defaultDocument/files:app/login.aspx
  tags: iis 
EXPECTED RESULTS

Site created and default document app/login.aspx added to list of default documents for site.

ACTUAL RESULTS
TASK [hpms-webserver : Setup Default Website] **************************************************************************************************************************************************************
task path: ansible/roles/webserver/tasks/iis-sites.yml:59
Thursday 26 July 2018  09:12:01 -0400 (0:00:01.195)       0:00:05.152 ********* 
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_iis_website.ps1
<10.255.255.21> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO 10.255.255.21
checking if winrm_host 10.255.255.21 is an IPv6 address
<10.255.255.21> WINRM CONNECT: transport=ssl endpoint=https://10.255.255.21:5986/wsman
<10.255.255.21> WINRM OPEN SHELL: 087D68C8-D039-4BAA-9C52-15B7C6AF1A4B
EXEC (via pipeline wrapper)
<10.255.255.21> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-']
<10.255.255.21> WINRM RESULT u'<Response code 1, out "started\r\n{"changed":", err "Get-ItemProperty : P">'
<10.255.255.21> WINRM CLOSE SHELL: 087D68C8-D039-4BAA-9C52-15B7C6AF1A4B
fatal: [10.255.255.21]: FAILED! => {
    "changed": false, 
    "msg": "You cannot call a method on a null-valued expression."
}

Copied from original issue: ansible/ansible#43309

CreateProcessW() failed (This version of %1 is not compatible with the version of Windows you're running) : Win32ErrorCode 216)\"", "rc": 2

From @hsvins12 on Mar 13, 2020 08:06

SUMMARY

While executing the below commnd in play book :

win_command: C:/temp/HCL-OneTest-UI-Windows-x64-v10.0.2.0.exe -i silent -f C:\Temp\installer.properties

Getting the below error :

<{"changed": false, "cmd": "C:/temp/HCL-OneTest-UI-Windows-x64-v10.0.2.0.exe -i silent -f C:\Temp\installer.properties", "msg": "Exception calling "CreateProcess" with "5" argument(s): "CreateProcessW() failed (This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher, Win32ErrorCode 216)"", "rc": 2}

COMPONENT NAME
ANSIBLE VERSION

ansible 2.9.5
config file = /etc/ansible/ansible.cfg

OS / ENVIRONMENT

MAC OS - High Siearra 10.13

Copied from original issue: ansible/ansible#68206

win_psmodule doesn't support private repositories that require authentication

From @passbt on Jan 16, 2020 16:55

SUMMARY

I use a private NuGet repository that requires credentials for reading the feed and accessing artifacts. When I try to install a module from the private repository I get the error below.

{
    "nuget_changed": false,
    "_ansible_no_log": false,
    "changed": false,
    "repository_changed": false,
    "msg": "Problems installing test module: No match was found for the specified search criteria and module name 'test'. Try Get-PSRepository to see all available registered module repositories.",
    "output": ""
}
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_psmodule

ADDITIONAL INFORMATION

The Ansible module win_psmodule appears to wrap around various CmdLets in Native PowerShell modules PackageManagement and PowerShellGet like Get-Module and Install-Module. These Cmdlets expose a credential parameters that isn't being exposed by win_psmodule.

If I follow the instructions in the error message, I do see the the registered repository I'm using and I'm able to successfully list the 'test' module and install it using the native PowerShell command below.

$creds = Get-Credentials
Install-Module -name test -repository MyPrivateRepo -credentials $creds

The non-working yaml being used for this module is below.

- name: Install Test module
  win_psmodule:
    repository: MyPrivateRepo 
    name: test

Suggested enhancement would allow for this:

- name: Install Test module
  win_psmodule:
    repository: MyPrivateRepo 
    name: test
    repo_user: "{{ ansible_user }}"
   repo_passwd: "{{ ansible_password }}"

The win_psmodule would, then build the pscredential type object from the repo_user and repo_passwd parameters when specified and pass them along to the native PowerShell CmdLets.

Copied from original issue: ansible/ansible#66538

win_pagefile is not returning list of configured pagefiles

From @daveolker on Jan 04, 2019 20:09

SUMMARY

The below win_pagefile play is supposed to display the current pagefile configuration, but it is returning an empty list:

- name: List any configured pagefiles
  win_pagefile:

ok: [dfo-worker04] => {
"automatic_managed_pagefiles": true,
"changed": false,
"pagefiles": []
}

My Windows 2016 server has the following pagefile configuration:

C:\Windows\system32>wmic pagefile list /format:list
AllocatedBaseSize=9728
CurrentUsage=0
Description=D:\pagefile.sys
InstallDate=20190103102344.598855-480
Name=D:\pagefile.sys
PeakUsage=0
Status=
TempPageFile=FALSE

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_pagefile

ANSIBLE VERSION
# ansible --version
ansible 2.7.5
  config file = /root/Docker-SimpliVity/ansible.cfg
  configured module search path = [u'/root/oneview-ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
CONFIGURATION
# ansible-config dump --only-changed
DEFAULT_CALLBACK_WHITELIST(/root/Docker-SimpliVity/ansible.cfg) = [u'profile_tasks']
DEFAULT_LOG_PATH(/root/Docker-SimpliVity/ansible.cfg) = /root/Docker-SimpliVity/ansible.log
HOST_KEY_CHECKING(/root/Docker-SimpliVity/ansible.cfg) = False
RETRY_FILES_ENABLED(/root/Docker-SimpliVity/ansible.cfg) = False
OS / ENVIRONMENT

Ansible node is running Red Hat 7.6. Target is running Windows Server 2016/

STEPS TO REPRODUCE

Simple call to win_pagefile should query the target node and return the list of configured pagefiles.

    - name: List any configured pagefiles
      win_pagefile:
EXPECTED RESULTS

I expect the pagefiles: [] list to be populated with the configured pagefile details.

ACTUAL RESULTS
TASK [List any configured pagefiles] *****************************************************************************************************************
task path: /root/Docker-SimpliVity/playbooks/config_win_storage.yml:71
Friday 04 January 2019  12:07:59 -0800 (0:00:03.022)       0:00:03.090 ********
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_pagefile.ps1
<dfo-worker04> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO dfo-worker04
checking if winrm_host dfo-worker04 is an IPv6 address
EXEC (via pipeline wrapper)
ok: [dfo-worker04] => {
    "automatic_managed_pagefiles": true,
    "changed": false,
    "pagefiles": []
}
Read vars_file '../group_vars/vars'
Read vars_file '../group_vars/vault'

Copied from original issue: ansible/ansible#50566

win_firewall_rule fails when localport is specified without protocol.

From @davidhulick on Jun 05, 2018 18:38

SUMMARY

win_firewall_rule fails when localport is specified without a protocol. The error returned or documentation should indicate that "protocol: any" is not compatible with "localport"

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_firewall_rule

ANSIBLE VERSION
ansible 2.5.3
  config file = /home/xxx/ansible_playbooks/ansible-playbook-xxx/ansible.cfg
  configured module search path = [u'/home/xxx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

CONFIGURATION

HOST_KEY_CHECKING(/home/xxx/ansible_playbooks/ansible-playbook-xxx/ansible.cfg) = False

OS / ENVIRONMENT

Ansible Host: CentOS 7.4.1708
Ansible Target: Windows Server 2012R2

STEPS TO REPRODUCE

Given the following task:

  win_firewall_rule:
    name: "ESP 3001"
    action: allow
    direction: in
    description: "ESP Rule"
    localport: 3001
    state: present
    enable: yes

Running:

ansible-playbook -i smart-servers-test site.yml --user dhulick@xxx --ask-pass

fails with:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was:     + FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI
fatal: [bmapdmsaweb1.xxx.com]: FAILED! => {"changed": false, "msg": "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"}
EXPECTED RESULTS

Expects firewall rule to be set with CHANGED if not existing, or OK or SKIPPING if rule is present.

ACTUAL RESULTS
PLAY [webservers] ************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************
ok: [bmapdmsaweb2.xxx.com]
ok: [bmapdmsaweb1.xxx.com]

TASK [common : Open 3001/tcp on SMART servers.] ******************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was:     + FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI
fatal: [bmapdmsaweb1.xxx.com]: FAILED! => {"changed": false, "msg": "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was:     + FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI
fatal: [bmapdmsaweb2.xxx.com]: FAILED! => {"changed": false, "msg": "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"}
        to retry, use: --limit @/home/dhulick@xxx/ansible_playbooks/ansible-playbook-smartespfirewall/site.retry

PLAY RECAP *******************************************************************************************************************************************************
bmapdmsaweb1.xxx.com : ok=1    changed=0    unreachable=0    failed=1
bmapdmsaweb2.xxx.com : ok=1    changed=0    unreachable=0    failed=1

Copied from original issue: ansible/ansible#41152

Add script and publish location support to win_psrepository

From @briantist on Feb 17, 2020 21:31

SUMMARY

The win_psrepository module only supports the source (module source) location, which means that the repositories it registers can't be used for downloading scripts, or publishing either modules or scripts.

Ideally it would add the remaining 3 location types so that complete repositories can be used.

The other 3 (PowerShell names) are:

  • PublishLocation
  • ScriptSourceLocation
  • ScriptPublishLocation
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

lib/ansible/modules/windows/win_psrepository.ps1

ADDITIONAL INFORMATION

Example usage:

win_psrepository:
  name: MyRepo
  script_source_location: https://myrepo.local/scripts
  publish_location: https://myrepo.local/module_publish
  script_publish_location: https://myrepo.local/script_publish

Copied from original issue: ansible/ansible#67501

Unable to disable Windows Scheduled Task

From @Gianlu on Aug 02, 2018 16:53

SUMMARY

Trying to disable a Windows Scheduled task throws an exception. The sintax to disable a task is described in documentation.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_scheduled_task

ANSIBLE VERSION
ansible 2.6.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
CONFIGURATION

DEFAULT_LOAD_CALLBACK_PLUGINS(/etc/ansible/ansible.cfg) = False
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /home/adminsalvo/ansible.log
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible/modules']

OS / ENVIRONMENT

Ansible is running on Debian 9.5.
Target host is Windows 2012 R2

STEPS TO REPRODUCE
   - name: read Scheduled tasks
     win_scheduled_task_stat:
     register: sched_tasks

   - name: stop it all
     win_scheduled_task:
       name: "{ item }}"
       enabled: no
       path: \
     when: item | lower is search("myprefix")
     with_items:
       - "{{ sched_tasks.folder_task_names }}"
EXPECTED RESULTS

changed: [myserver] => (item=myprefix_task01)

ACTUAL RESULTS
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_scheduled_task.ps1
<myserver> ESTABLISH WINRM CONNECTION FOR USER: None on PORT 5985 TO drwebin01
checking if winrm_host myserver is an IPv6 address
EXEC (via pipeline wrapper)
failed: [myserver] (item=myprefix_task01) => {
    "changed": false,
    "item": "myprefix_task01",
    "msg": "failed to modify scheduled task: Exception calling \"RegisterTaskDefinition\" with \"6\" argument(s): \"The user name or password is incorrect. (Exception from HRESULT: 0x8007052E)\""
}

The password is correct because when i run

Get-ScheduledTask -TaskName myprefix_task01 | Enable-ScheduledTask

The task is enabled (or disabled). Also the command

Get-ScheduledTask -TaskName myprefix_task01 | Start-ScheduledTask

is successfull.

Thank you.

Copied from original issue: ansible/ansible#43612

win_dns_record: option to automatically create PTR record

From @senilio on Oct 18, 2019 10:47

SUMMARY

When creating an A or AAAA record using the win_dns_record module, it would be nice to have the option to automatically create the "associated PTR record". This tick box is available in the DNS Manager GUI when manually creating an A record.

Having this option would basically cut my DNS definition dict in half, since I would't have to define all PTR's.

DNS Manager GUI screenshot

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_dns_record

ADDITIONAL INFORMATION

Add a new boolean ptr to win_dns_record.
Default value false, to stick to the current default behavior.
When true, the behavior should be the same as when ticking the box in the GUI.

  - name: Create records
    win_dns_record:
      name: "{{ item.name }}"
      type: "{{ item.type }}"
      value: "{{ item.value }}"
      zone: "{{ item.zone }}"
      ptr: "{{ item.ptr }}"
    with_items: "{{ dns_records }}"

Copied from original issue: ansible/ansible#63672

win_psexec module is exposing password to output

From @cuichenli on Nov 18, 2019 05:04

SUMMARY

The win_psexec module is exposing the password and username to output, is that intended? Is there a way to hide it? Thanks!

My playbook:

- name: Psexec
  win_psexec:
    command: >
      powershell.exe 
    session: 1
    wait: yes
    interactive: yes
    username: "username"
    password: "password"
changed: [MYSERVER] => {
	....
    "psexec_command": "psexec64.exe -u username -p password -i 1 -accepteula powershell.exe",
  	....
ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_psexec

ANSIBLE VERSION
ansible 2.8.5
python version = 3.7.3 (default, Apr  3 2019, 05:39:12) [GCC 8.3.0]
OS / ENVIRONMENT

Host OS : Linux
Target OS: Windows

Copied from original issue: ansible/ansible#64978

win_firewall_rule: when multiple rules exist in the case of predefined rules ansible creates new rule

From @octagonprogramming on Jul 30, 2019 21:37

SUMMARY

I am trying to disable firewall rules on windows and when there are multiple rules of the same type (as is the case with rules for Cortana, Your profile, and Work or school account) it seems that the module does not fail out like it should on multiple rules but instead creates a new one.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_firewall_rule.ps1

ANSIBLE VERSION
ansible 2.8.2
  config file = /home/peanut/git/vivio-ansible/ansible.cfg
  configured module search path = [u'/home/peanut/git/vivio-ansible/lib']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15+ (default, Nov 27 2018, 23:36:35) [GCC 7.3.0]
CONFIGURATION
ANSIBLE_COW_SELECTION(env: ANSIBLE_COW_SELECTION) = random
ANSIBLE_COW_WHITELIST(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'bud-frogs', u'bunny', u'cheese', u'daemon', u'default', u'dragon', u'elephant-in-snake', u'elephant', u'eyes', u'\\\nhellokitty', u'kitty', u'luke-koala', u'meow', u'milk', u'moofasa', u'moose', u'ren', u'sheep', u'small', u'stegosaurus', u'\\\nstimpy', u'supermilker', u'three-eyes', u'turkey', u'turtle', u'tux', u'udder', u'vader-koala', u'vader', u'www']
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = False
CACHE_PLUGIN(/home/peanut/git/vivio-ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/peanut/git/vivio-ansible/ansible.cfg) = ~/cache/
COLOR_VERBOSE(/home/peanut/git/vivio-ansible/ansible.cfg) = bright blue
DEFAULT_ACTION_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/action_plugins']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/callback_plugins']
DEFAULT_CALLBACK_WHITELIST(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'timer', u'checklist_builder']
DEFAULT_CONNECTION_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/connection_plugins']
DEFAULT_FILTER_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/filter_plugins']
DEFAULT_FORKS(/home/peanut/git/vivio-ansible/ansible.cfg) = 5
DEFAULT_GATHERING(/home/peanut/git/vivio-ansible/ansible.cfg) = implicit
DEFAULT_HASH_BEHAVIOUR(/home/peanut/git/vivio-ansible/ansible.cfg) = merge
DEFAULT_HOST_LIST(env: ANSIBLE_INVENTORY) = [u'/home/peanut/git/vivio-ansible/vivio/hosts.yml']
DEFAULT_INVENTORY_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/vivio']
DEFAULT_LOCAL_TMP(/home/peanut/git/vivio-ansible/ansible.cfg) = /home/peanut/.ansible/tmp/ansible-local-800VD2Qsf
DEFAULT_LOG_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = /home/peanut/git/vivio-ansible/log/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/lookup_plugins']
DEFAULT_MANAGED_STR(/home/peanut/git/vivio-ansible/ansible.cfg) = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
DEFAULT_MODULE_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/lib']
DEFAULT_POLL_INTERVAL(/home/peanut/git/vivio-ansible/ansible.cfg) = 15
DEFAULT_SCP_IF_SSH(/home/peanut/git/vivio-ansible/ansible.cfg) = True
DEFAULT_TIMEOUT(/home/peanut/git/vivio-ansible/ansible.cfg) = 10
DEFAULT_TRANSPORT(/home/peanut/git/vivio-ansible/ansible.cfg) = smart
DEFAULT_VARS_PLUGIN_PATH(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'/home/peanut/git/vivio-ansible/vars_plugins']
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/peanut/.ansible/vault
INVENTORY_ENABLED(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'script', u'host_list', u'yaml', u'constructed', u'portal_inventory']
INVENTORY_IGNORE_EXTS(/home/peanut/git/vivio-ansible/ansible.cfg) = [u'.pyc', u'.pyo', u'.swp', u'.bak', u'~', u'.rpm', u'.md', u'.txt', u'~', u'.orig', u'.ini', u'.cfg', u'.retry']
INVENTORY_UNPARSED_IS_FAILED(/home/peanut/git/vivio-ansible/ansible.cfg) = True
PARAMIKO_HOST_KEY_AUTO_ADD(/home/peanut/git/vivio-ansible/ansible.cfg) = True
OS / ENVIRONMENT

Target: Windows 10 Enterprise LTSC (2019)

STEPS TO REPRODUCE

If multiple predefined rules exist under the same name, use that name(in this case: Cortana, Your account, or Work or school account) to try and disable the rule

    - name: Disable Microsofts Built in Rules
      win_firewall_rule:
        name: Cortana *or* Your account *or* Work or school account
        action: allow
        direction: in
        state: present
        enabled: no
EXPECTED RESULTS

I expect that since there are multiples of these rules, the module will error (line 150 of win_firewall_rule.ps1)

ACTUAL RESULTS

The play executes without an error and creates a new rule under the name 'Cortana' (or any of the other rules I specified)
Verified result in GUI

Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_firewall_rule.ps1
Pipelining is enabled.
<This line verifies that WINRM establishes a connection: specifics taken out>
EXEC (via pipeline wrapper)
changed: [<Our Host>] => {
    "changed": true,
    "msg": "Firewall rule 'Cortana' created."
}

Copied from original issue: ansible/ansible#59824

win_audit_rule reports unhandled exception when changing audit rule on a protected OS file

From @Castingnet on Feb 21, 2020 09:41

SUMMARY

win_audit_rule will try to get item type before doing the rule setting, (Get-Item $path).GetType() will work for most cases but not for a protected OS file, for example, C:\bootmgr.
To make it work for this scenario, a force is expected.
(Get-Item -force $path).GetType()

ISSUE TYPE
  • Bug Report
COMPONENT NAME

module win_audit_rule

ANSIBLE VERSION
2.9.5
CONFIGURATION
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C -o ControlMaster=auto -o ControlPersist=60s -o PasswordAuthentication=yes
DEFAULT_MODULE_PATH(env: ANSIBLE_LIBRARY) = [u'/root/ansible_lib/modules']
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Target: windows system

STEPS TO REPRODUCE
win_audit_rule:
  path: C:\bootmgr
  user: Everyone
  rights: FullControl
  audit_flags: Failure
  inheritance_flags: None
EXPECTED RESULTS

win_audit_rule could change audit rule of a protected OS file without any exception

ACTUAL RESULTS
Pipelining is enabled.
EXEC (via pipeline wrapper)
The full traceback is:
Could not find item C:\bootmgr.
At line:69 char:14^M
+ $ItemType = (Get-Item $path).GetType()
+              ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\bootmgr:String) [Get-Item], IOException
    + FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.GetItemCommand
  
 ScriptStackTrace:
 at <ScriptBlock>, <No file>: line 69
 failed: [9.112.238.18] (item=C:\bootmgr) => {
     "ansible_loop_var": "item",
     "changed": false,
    "item": "C:\\bootmgr",
     "msg": "Unhandled exception while executing module: Could not find item C:\\bootmgr."
 }

Copied from original issue: ansible/ansible#67642

win_xml is not able to get the value of attribute in the xml file

From @Raymondzfy on Mar 18, 2020 02:42

HI. Everyone
I have a server.xml file, and I tried to win_xml for get some values from attribues like "port "




  • name: Find Server HTTP Listen Port
    win_xml:
    attribute: port
    path: "D:\tomcat8\conf\server.xml"
    xpath: '//Server/Service[@name="Catalina"]/Connector[@protocol="HTTP/1.1"]'
    type: attribute
    register: server_xml_config

    but I can't get the actual value , Are there anything wrongs? Or Did anyone know how to get the value of the attribute in the xml file?

Copied from original issue: ansible/ansible#68296

Chocolatey install fails when fips is enabled

From @daemenseth on Jun 05, 2019 12:16

SUMMARY

When you install chocolatey with win_chocolatey on a server you get a rc 1 because of fips mode detected.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_chocolatey

ANSIBLE VERSION

2.7.4


##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below

OS / ENVIRONMENT

Server 2019

STEPS TO REPRODUCE
  - name: Ensure Chocolatey itself is installed and use internal repo as source
    win_chocolatey:
      name: chocolatey
    ignore_errors: yes
    # Above ignore_erros is because the fips compliant error
EXPECTED RESULTS

Install without rc 1

ACTUAL RESULTS
fatal: [host]: FAILED! => {
    "changed": false, 
    "command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe list --local-only --exact --limit-output chocolatey", 
    "msg": "Error checking installation status for the package 'chocolatey'", 
    "rc": 1, 
    "stderr": "", 
    "stderr_lines": [], 
    "stdout": "\r\nFIPS Mode detected - run 'choco feature enable -n useFipsCompliantChecksums'\r\n to use Chocolatey.\r\nWhen FIPS Mode is enabled, Chocolatey requires useFipsCompliantChecksums feature also be enabled.\r\n", 
    "stdout_lines": [
        "", 
        "FIPS Mode detected - run 'choco feature enable -n useFipsCompliantChecksums'", 
        " to use Chocolatey.", 
        "When FIPS Mode is enabled, Chocolatey requires useFipsCompliantChecksums feature also be enabled."
    ]
}

Copied from original issue: ansible/ansible#57405

v2.9.3 errors trying to add an xml fragment on windows

From @frogstarr78 on Jan 18, 2020 23:58

SUMMARY

The win_xml task fails when trying to insert an element into an existing element on v2.9.3 but not v2.9.2

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible/modules/windows/win_xml.ps1

ANSIBLE VERSION
ansible 2.9.3
  config file = /home/scott/git/vivio-ansible/ansible.cfg
  configured module search path = [u'/home/scott/git/vivio-ansible/lib']
  ansible python module location = /usr/lib64/python2.7/site-packages/ansible
  executable location = /usr/lib/python-exec/python2.7/ansible
  python version = 2.7.17 (default, Dec 16 2019, 11:59:26) [GCC 8.3.0]

CONFIGURATION
ANSIBLE_COW_SELECTION(env: ANSIBLE_COW_SELECTION) = random
ANSIBLE_COW_WHITELIST(~/git/vivio-ansible/ansible.cfg) = [u'bud-frogs', u'bunny', u'cheese', u'daemon', u'default', u'dragon', u'elephant-in-snake', u'elephant', u'eyes', u'\\\nhellokitty', u'kitty', u'luke-koala', u'meow', u'milk'>
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = True
CACHE_PLUGIN(~/git/vivio-ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(~/git/vivio-ansible/ansible.cfg) = ~/cache/
COLOR_VERBOSE(~/git/vivio-ansible/ansible.cfg) = bright blue
DEFAULT_ACTION_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/action_plugins']
DEFAULT_CALLBACK_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/callback_plugins']
DEFAULT_CALLBACK_WHITELIST(~/git/vivio-ansible/ansible.cfg) = [u'timer', u'checklist_builder']
DEFAULT_CONNECTION_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/connection_plugins']
DEFAULT_FILTER_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/filter_plugins']
DEFAULT_FORKS(~/git/vivio-ansible/ansible.cfg) = 5
DEFAULT_GATHERING(~/git/vivio-ansible/ansible.cfg) = implicit
DEFAULT_HASH_BEHAVIOUR(~/git/vivio-ansible/ansible.cfg) = merge
DEFAULT_HOST_LIST(env: ANSIBLE_INVENTORY) = [u'~/git/vivio-ansible/vivio/hosts.yml']
DEFAULT_INVENTORY_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/vivio']
DEFAULT_LOCAL_TMP(~/git/vivio-ansible/ansible.cfg) = /tmp/t/ansible-local-144747J3fZUy
DEFAULT_LOG_PATH(~/git/vivio-ansible/ansible.cfg) = ~/git/vivio-ansible/log/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/lookup_plugins']
DEFAULT_MANAGED_STR(~/git/vivio-ansible/ansible.cfg) = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
DEFAULT_MODULE_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/lib']
DEFAULT_POLL_INTERVAL(~/git/vivio-ansible/ansible.cfg) = 15
DEFAULT_SCP_IF_SSH(~/git/vivio-ansible/ansible.cfg) = True
DEFAULT_TIMEOUT(~/git/vivio-ansible/ansible.cfg) = 10
DEFAULT_TRANSPORT(~/git/vivio-ansible/ansible.cfg) = smart
DEFAULT_VARS_PLUGIN_PATH(~/git/vivio-ansible/ansible.cfg) = [u'~/git/vivio-ansible/vars_plugins']
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = ~/.ansible/.vk
INVENTORY_ENABLED(~/git/vivio-ansible/ansible.cfg) = [u'script', u'host_list', u'yaml', u'constructed', u'portal_inventory']
INVENTORY_IGNORE_EXTS(~/git/vivio-ansible/ansible.cfg) = [u'.pyc', u'.pyo', u'.swp', u'.bak', u'~', u'.rpm', u'.md', u'.txt', u'~', u'.orig', u'.ini', u'.cfg', u'.retry']
INVENTORY_UNPARSED_IS_FAILED(~/git/vivio-ansible/ansible.cfg) = True
PARAMIKO_HOST_KEY_AUTO_ADD(~/git/vivio-ansible/ansible.cfg) = True

OS / ENVIRONMENT

uname -a
Linux scott-vivio2.viviotech.net 4.19.86-gentoo #10 SMP Fri Dec 13 12:44:03 PST 2019 x86_64 Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz GenuineIntel GNU/Linux

lsb_release -a
LSB Version: n/a
Distributor ID: Gentoo
Description: Gentoo Base System release 2.6
Release: 2.6
Codename: n/a

STEPS TO REPRODUCE
  - name: Update lucee to connect to the local mail system
     win_xml:
       path: 'C:\Lucee\tomcat\lucee-server\context\lucee-server.xml'
       xpath: '//mail'
       fragment: '<server idle="10000" life="60000" password="" port="25" reuse-connection="true" smtp="127.0.0.1" ssl="false" tls="false" username=""/>'
       state: present
       type: element

with this error

EXPECTED RESULTS

This content in the file

<mail spool-enable="yes" spool-interval="5" timeout="30">
<server idle="10000" life="60000" password="" port="25" reuse-connection="true" smtp="127.0.0.1" ssl="false" tls="false" username=""/>
</mail>
ACTUAL RESULTS
The full traceback is:
Method invocation failed because [System.Xml.XmlChildNodes] does not contain a method named 'get_OuterXml'.
At line:185 char:13
+            $nstatus = "node: " + $node.get_Value() + "element: " +  ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],
ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MethodNotFound

ScriptStackTrace: at <ScriptBlock>, <No file>: line 185

fatal: [hallowed-sepia-degu.viviotech.us]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: Method invocation failed because [System.Xml.XmlChildNodes] does not contain a method named 'get_OuterXml'."
}

Copied from original issue: ansible/ansible#66602

Ansible module to manage packages using scoop

SUMMARY

Similar to how there is a win_chocolatey module (and related win_chocolatey_* modules) to manage Chocolatey packages, I would like a win_scoop module to manage Scoop packages.

Scoop is an alternative package manager for Windows. Check out the GitHub repo for more info

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_scoop

ADDITIONAL INFORMATION

I've already created a small proof-of-concept at JamieMagee/ansible-win-scoop. Currently it can only install scoop, and install scoop packages, but I think it validates the concept. If there is interest I will continue development, with the intention of adding win_scoop as a core ansible module (Ideally feature complete with the chocolatey modules)

- name: Install jq
  win_scoop:
    name: jq

See ansible/ansible#56084

Restore httptester / prepare_http_tests

SUMMARY

The prepare_http_tests integration target is not here in community.windows. Let's bring it back so that we can use it.

Main question I can think of is whether there's any utility in keeping the non-Windows parts of the role?

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

prepare_http_tester

ADDITIONAL INFORMATION

win_firewall_rule Allow enabling built-in rules by using displaygroup

From @kinwolfqc on Mar 05, 2020 19:28

SUMMARY

In powershell, we can enable multiple rules that belong to the same displaygroup, and many built-in rules use disaplygroups
Enable-NetFirewallRule -DisplayGroup "Windows Remote Management"

The win_firewall_rule doesn't seems to allow that.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_firewall_rule

Copied from original issue: ansible/ansible#68052

win_format > allocation_unit_size is always 4096

SUMMARY

win_format > allocation_unit_size is always 4096

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_format

ANSIBLE VERSION
ansible 2.9.6
CONFIGURATION
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /var/log/ansible.log
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/vault_password_file
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Ansible server: Ubuntu Server 18.04
Guest OS: Windows Server 2016/2019

STEPS TO REPRODUCE
      win_format:
        drive_letter: "{{ variable }}"
        file_system: NTFS
        new_label: "{{ variable }}"
        allocation_unit_size: 65536
EXPECTED RESULTS

Disk will be formatted to 64k

ACTUAL RESULTS
PS C:\Users\user> Get-WmiObject -Class Win32_Volume | Select-Object BlockSize | Format-Table

BlockSize
---------
     4096
     4096
     4096
     4096
     4096
     4096
     4096
     4096

win_psrepository - perpetually "changed" if source location redirects

From @briantist on Feb 17, 2020 22:00

SUMMARY

If you register a repository where the URL redirects to a new URL, then PowerShell will follow the redirects and register the final URL in the repository.

This can also happen because PowerShellGet attempts to figure out if NuGet repositories support api v2 or v3 and it may add additional api version paths to the URL.

The ansible module doesn't know this so on the next run, it will compare the existing repository's (now modified) source URL to the one supplied in options, see that it's different, and "reset" it, but the end result will be the same, so the status will always be changed unless the playbook is updated.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

lib/ansible/modules/windows/win_psrepository.ps1

ANSIBLE VERSION
ansible 2.9.4
  config file = None
  configured module search path = ['/home/briantist/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.5.2 (default, Oct  8 2019, 13:06:37) [GCC 5.4.0 20160609]
CONFIGURATION

(no config changes)

OS / ENVIRONMENT
any Windows
STEPS TO REPRODUCE

Register any repository that includes a redirect. It doesn't have to be a real repository to reproduce the problem, just any URL that redirects.

win_prespository:
  name: MyRepo
  source: https://ansible.com

(https://ansible.com will redirect to https://www.ansible.com)

Run once, run again.

Also can check repository manually:

Get-PSRepository MyRepo
EXPECTED RESULTS

Status OK on second run.

ACTUAL RESULTS

Status is CHANGED.

Copied from original issue: ansible/ansible#67504

win_eventlog_filter: Query event-log for specific events

From @dagwieers on Mar 09, 2018 08:45

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_eventlog_filter

ANSIBLE VERSION

v2.6

SUMMARY

It would be very useful to query the event-log for specific events based on IDs, severity, time-frame, etc... (e.g. event-id 8006 means that an improper shutdown was detected).

This way an operations team could get an overview of specific issues on their complete Windows infrastructure and start targeting these issues one by one to improve general stability.

Copied from original issue: ansible/ansible#37235

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.