Commit graph

280 commits

Author SHA1 Message Date
Dreamcat4
ece9c2b43a fix: Add 'enable:' flag for enabling existing rules which are disabled by default.
This is a very much needed flag. To turn on/off existing firewall rules. And like the recent fix of the 'Profile' key, the netsh cmd prints 'Enabled' in the textual output. (at least on win10 it does). So again a similar small code added for the necessary exception handling when the difference check happens.

Please merge / push upstream like the other fixes. Many thanks. This is the last fix I have put together for this patch set. So I will raise my PR now.

But if you want to fix more bugs, it seems there may be others. In terms of the control code. Sometimes it will delete a rule under 'force' condition (when found difference) - but instead it is supposed to just modify the existing rule. Some weird behaviour regarding that. The other problem is that ansible does not return the error text printed by 'netsh' cmd verbatim... but it should as that makes debugging these errors a *lot* easier.
2015-10-06 14:03:27 +01:00
Dreamcat4
dcaa794949 fix: update documentation with new module name "win_firewall_rule" 2015-10-06 10:47:27 +01:00
Dreamcat4
469d22df97 fix: The names of firewall profiles are different on win10 & win2008r2
Hi again. This commit removes a small portion of your script's own internal error checking. In specific: for the value of the profile: key. This is essential to avoid errors on other verisons of the windows operating system which are not win2008r2 (your version).

For example: on win10 (and most likely win8x too), the names of the profiles don't include the values 'current' and 'all'. But instead the values are 'Public' 'Private' 'Domain' and 'Any. But in addition, there are also certain combinatorial values, such as profile=Public,Private etc. Which is too many to error check yourself.

Yet removing the error checking here should not cause any ill effects however: since the netsh advfirewall ... cmds themselves to add / remove / modify actually to their own error checking of the profile=value. So when the cmd is run, it will error out itself with an appropriate / informative error msg. No harm done.

Therefore please remove the highlighed portions from your own script. It is essential for interoperability with win10 and win8x. Many thanks.
2015-10-05 21:53:11 +01:00
Dreamcat4
6c5a4a14ef fix: win10 - Add exception handling for 'Profiles:' textual output key name mismatch.
In win10 (and pribably win8x also):

The output of 'show rule' key includes the line "Profiles:<TAB>Public,Private".
Yet your script expects the key name printed out to be "Profile:<TAB>value".

This commit added the necessary exception handling to avoid flagging 'different=true' under the false circumstance. The key name to SET a firewall rule is still "profile=" and not "profiles=".

There is coming up another commit to fix the value handling for win10/win8. Which is another (different) error with the profile: key.
2015-10-05 21:36:24 +01:00
Dreamcat4
2654789af7 fix: fw rule names must always be quoted, to permit spaces ' ' and brackets '()'
Without this fix, the 'netsh' command gets name=Firewall Rule Name instead of name="Firewall Rule Name". Thus causing all sorts of havoc. Basic shell quoting rules seems to apply to Windows Powershell too. This is very much needed as many of windows 10's default firewall rules contain spaces and brackets () characters.
2015-10-05 21:10:59 +01:00
Brian Coca
ebbd7748b1 doc formatting fixes 2015-10-05 11:57:38 -04:00
Brian Coca
02b68be09d Merge pull request #854 from nitzmahone/win_updates_rewrite
win_updates rewrite for 2.0
2015-10-04 14:45:57 -04:00
Trond Hindenes
7c48fe617d added module author 2015-10-01 19:12:21 +02:00
Trond Hindenes
161b3cf1e1 fixes #984 2015-10-01 19:08:42 +02:00
Toshio Kuratomi
255666a09d Fix doc build 2015-09-30 19:57:20 -07:00
Greg DeKoenigsberg
22a3ec05e4 Merge pull request #1022 from trondhindenes/trondhindenes_win_chocolatey_improvements
win_chocolatey bugfixes
2015-09-30 16:26:45 -04:00
Greg DeKoenigsberg
5931e60d99 Merge pull request #695 from georgefrank/win_nssm
Adding win_nssm module
2015-09-30 16:15:36 -04:00
Greg DeKoenigsberg
ff0a38ea65 Merge pull request #665 from perzizzle/scheduledTask
Ability to add/remove scheduled task
2015-09-30 16:11:45 -04:00
Phil
228abcd396 fixes examples in docs to use updated param name 2015-09-25 15:54:39 -05:00
Trond Hindenes
d7cc0f60c9 win_chocolatey bugfixes 2015-09-23 20:49:26 +02:00
Brian Coca
7f245e8c73 Merge pull request #318 from TimothyVandenbrande/win_fw
windows firewall control
2015-09-23 13:40:13 -04:00
TimothyVandenbrande
2d6303b368 upon request, added the license 2015-09-23 09:35:17 +02:00
Michael Perzel
123a2b25ed Remove duplicate action declaration. 2015-09-08 14:45:21 -05:00
Michael Perzel
a7675e6621 Note parameters that are not idempotent 2015-09-08 14:40:21 -05:00
Michael Perzel
685c935a37 Documentation updates 2015-09-08 14:36:11 -05:00
Michael Perzel
64416ff094 Fix logging of error message 2015-09-08 14:35:34 -05:00
Michael Perzel
de1696cb74 Add support for specifying user for scheduled task to run as 2015-09-08 14:16:30 -05:00
Michael Perzel
027dff6d3d Add support for command arguments 2015-09-08 13:37:39 -05:00
Michael Perzel
d0b4bc0dda Show order of operations with parenthesis 2015-09-08 11:20:35 -05:00
Michael Perzel
a9eb69b0fa Use helper methods to validate vars. Cleanup logic. 2015-09-08 11:18:26 -05:00
Toshio Kuratomi
6a3cf63351 correct documentation formatting 2015-09-05 08:55:34 -07:00
Brian Coca
b0b0ac1a58 Merge pull request #713 from trondhindenes/win_package
Added module win_package (was #618)
2015-09-04 12:42:55 -04:00
nitzmahone
29a80d3555 win_updates rewrite for 2.0
uses scheduled job to run under a local token (required for WU client)
supports check mode
no external PS module deps
2015-08-21 09:49:36 -07:00
gfrank
b75f7cc22b Move comments to the documentation 2015-08-20 13:57:03 -04:00
gfrank
9d68a1746f Remove unnecessary aliases arrays 2015-08-20 13:29:10 -04:00
gfrank
ee395ced4d Clean up unneeded comment and comma 2015-08-20 11:20:40 -04:00
Chris Church
6a7b2f5869 Workaround for bug in PowerShell Get-Website cmdlet. 2015-08-02 11:31:15 -04:00
Brian Coca
e30d8b84fe more doc fixes 2015-07-28 14:27:21 -04:00
Greg DeKoenigsberg
e1b15e6930 Merge pull request #438 from petemounce/win_webpicmd
win_webpicmd module for IIS module installation
2015-07-23 13:58:38 -04:00
Greg DeKoenigsberg
34bd09aae1 Merge pull request #440 from petemounce/win_dotnet_ngen
Create win_dotnet_ngen module
2015-07-23 13:54:34 -04:00
Peter Mounce
8128d42dcd re-submit @adematte's PR #278 against HEAD 2015-07-22 23:29:49 +01:00
Michael Perzel
681cdd1c12 Remove accidental newlines 2015-07-21 17:38:27 -05:00
Michael Perzel
cdb36ea0fc Cleanup enable/disable logic 2015-07-21 17:35:33 -05:00
Phil
b598161f46 minor doc fixes that had lingering description of deprecated functions 2015-07-17 22:15:57 -05:00
Brian Coca
cc305adfb6 minor doc fixes 2015-07-17 00:51:08 -04:00
Brian Coca
2754157d87 minor doc fixes 2015-07-17 00:48:33 -04:00
Phil
26bdf16e69 changes param src to path, and updates docs accordingly 2015-07-15 11:42:27 -05:00
Phil
05e01bd3b5 updates user search verification for local/domain
- Thanks to @trondhindenes for implementing this strategy
- also updated documentation
2015-07-14 18:35:28 -05:00
Trond Hindenes
a2166b60cb Added module win_package 2015-07-14 12:03:04 +02:00
Greg DeKoenigsberg
c6e069dead Merge pull request #174 from schwartzmx/module/win_unzip
win_unzip Module
2015-07-10 12:02:25 -04:00
gfrank
05d5d939e7 Adding nssm requirement note 2015-07-09 09:37:51 -04:00
gfrank
8a72cf6a1c Adding win_nssm module 2015-07-08 11:44:46 -04:00
Michael Perzel
3542e7d42d Update method to determine if task exists, add days of week parameter to weekly triggers 2015-07-07 11:55:46 -05:00
Adam Keech
389e59b970 Adding functionality to not only edit Values, but also Keys. 2015-07-06 16:22:55 -04:00
Adam Keech
e84666fd74 Renaming variables in win_regedit module to make more sense with actions that are happening. 2015-07-06 15:25:28 -04:00
Adam Keech
5a2a22bf68 Adding win_regedit module 2015-07-06 15:25:28 -04:00
Phil
dc84f05fed changes check for src 2015-07-06 13:14:18 -05:00
Phil
311d73620b use convertto-bool for rm and recurse params 2015-07-06 11:55:41 -05:00
Timothy Vandenbrande
b0a637086f add version_added: "2.0" 2015-07-02 10:00:33 +02:00
Timothy Vandenbrande
d87da2ba2d renamed profile var 2015-07-02 09:19:08 +02:00
Michael Perzel
00d3a62907 Documentation updates 2015-06-30 12:24:00 -05:00
Michael Perzel
d6339c47e4 Ability to add/remove scheduled task 2015-06-30 12:06:16 -05:00
Timothy Vandenbrande
97d8273558 windows default to current instead of all 2015-06-30 08:49:47 +02:00
Timothy Vandenbrande
2a0df8ec04 renamed the module 2015-06-30 08:42:42 +02:00
Timothy Vandenbrande
ada6d0a18c added the profile option + updated the docs for it 2015-06-30 08:39:19 +02:00
Timothy Vandenbrande
828482643a Merge remote-tracking branch 'upstream/devel' into win_fw 2015-06-30 08:26:52 +02:00
Brian Coca
552c4ef53a Merge pull request #441 from petemounce/win_scheduled_task
win_scheduled_task module for windows
2015-06-26 15:58:58 -04:00
Phil
b5d724c2fb removed hardcoded paths, check for .exe error exit code, use get-attr for required param check. 2015-06-25 16:01:17 -05:00
Toshio Kuratomi
dec7d95d51 Fix up docs 2015-06-25 07:12:10 -07:00
Toshio Kuratomi
9183170a4a These modules were added to version 2.0, not 1.9 2015-06-25 07:05:29 -07:00
Greg DeKoenigsberg
526e2d30ea Merge pull request #419 from whenrik/devel
Adds Modules to manage IIS
2015-06-23 13:32:38 -04:00
Phil
6b41b80b09 init commit win_timezone 2015-06-23 07:42:11 -05:00
Phil
03ce40a62e removes restart functionality, and added creates param for idempotency 2015-06-23 07:40:14 -05:00
Phil
92744ef558 fixes typo 2015-06-22 08:55:41 -05:00
Phil
d72bb17de1 check if the rule exists or not before allow/deny rules are added/removed, and fixes where result changed would be true on all executions. 2015-06-18 17:33:02 -05:00
Phil
623a29cc0e update to not auto-install PSCX
- will use built-in powershell method instead for .zip files
- added example for installing pscx as a pretask
2015-06-18 16:18:15 -05:00
Greg DeKoenigsberg
004dedba8a Changes to author formatting, remove emails 2015-06-16 14:32:39 -04:00
Greg DeKoenigsberg
dc519fb848 Add author data 2015-06-16 12:30:47 -04:00
Pepe Barbe
b5d22eb1ec Refactor win_chocolatey module
* Refactor code to be more robust. Run main logic inside a try {} catch {}
  block. If there is any error, bail out and log all the command output
  automatically.
* Rely on error code generated by chocolatey instead of scraping text
  output to determine success/failure.
* Add support for unattended installs: (`-y` flag is a requirement by
  chocolatey)
* Before (un)installing, check existence of files.
* Use functions to abstract logic
* The great rewrite of 0.9.9, the `choco` interface has changed, check
  if chocolatey is installed and an older version. If so upgrade to
  latest.
* Allow upgrading packages that are already installed
* Use verbose logging for chocolate actions
* Adding functionality to specify a source for a chocolatey repository.
  (@smadam813)
* Removing pre-determined sources and adding specified source url in
  it's place. (@smadam813)

Contains contributions from:
*  Adam Keech  <akeech@chathamfinancial.com> (@smadam813)
2015-06-16 11:33:15 -04:00
Ernst Kuschke
3761052597 Allow any custom chocolatey source
This is to allow for a local source (for instance in the form of artifactory)
2015-06-16 11:33:11 -04:00
Brian Coca
e5d59d2014 Merge pull request #494 from jhawkesworth/set_windows_environment_variables
Set windows environment variables
2015-05-26 10:00:31 -04:00
Peter Mounce
8454997cd9 version -> 2, remove unnecessary doc attributes 2015-05-19 11:50:15 +01:00
Peter Mounce
dc347b0683 fix license boilerplate 2015-05-19 11:50:13 +01:00
Peter Mounce
ec172be310 win_webpicmd module for IIS module installation
Chocolatey 0.9.9+ deprecated support for the `webpi` custom source, so I needed to write this.

[Windows Web Platform Installer](http://www.microsoft.com/web/downloads/platform.aspx) is a way of installing products and applications for Microsoft IIS on Windows. It has a [command line](http://www.iis.net/learn/install/web-platform-installer/web-platform-installer-v4-command-line-webpicmdexe-rtw-release); this ansible module allows IIS modules to be installed via this means.

To find out names of modules, use `webpicmd /list /listoption:available`.

Notes:
* `webpicmd` must be installed and on `PATH` first (see `win_chocolatey` module; package is `webpicmd`)
* `webpicmd` does not allow modules to be uninstalled
* IIS must be installed first (see `win_feature` module; package is `Web-Server`)
* Installations will
  * accept EULA (which otherwise requires user input)
  * suppress reboots (so you have to manage those; see `win_reboot` module)
2015-05-19 11:50:12 +01:00
Peter Mounce
c322627320 use the notes property 2015-05-19 11:47:49 +01:00
Peter Mounce
52a87e1637 version -> 2, quote doc strings with colons 2015-05-19 11:47:48 +01:00
Peter Mounce
ddb85479cd Add documentation note 2015-05-19 11:47:47 +01:00
Peter Mounce
0b0416aca1 Create win_dotnet_ngen module
When .NET is installed or updated, ngen is triggered to optimise the installation. This triggers high CPU while it's happening, and usually happens at an inconvenient time.

This allows you to trigger it when you like. Full details and background in doc.

I don't know a way to figure out whether this is required without actually running it.
2015-05-19 11:47:45 +01:00
Peter Mounce
a4a3a13439 Code-review
Swap state enabled/disabled -> enabled yes/no
2015-05-19 11:30:05 +01:00
Peter Mounce
d9211b709b no default, remove it 2015-05-19 11:14:04 +01:00
Peter Mounce
ede4820562 version_added -> 2, remove empty aliases 2015-05-19 11:14:03 +01:00
Peter Mounce
4fef779f09 caught out by syntax 2015-05-19 11:14:02 +01:00
Peter Mounce
6f1d9fbbcc correct variable name 2015-05-19 11:14:00 +01:00
Peter Mounce
d1c896d31e win_scheduled_task module for windows
Fledgling module to allow scheduled tasks to be managed.
At present, I only need enabled/disabled support. There's lots of scope for more features.
2015-05-19 11:13:59 +01:00
Toshio Kuratomi
88eff11c04 Many more doc fixes 2015-05-15 12:12:26 -07:00
Jon Hawkesworth
ccd9a4eb6a Update attribution 2015-05-15 00:40:30 +01:00
Jon Hawkesworth
44fa32f2dc Add win_environment module 2015-05-15 00:29:53 +01:00
Greg DeKoenigsberg
efd307903c Adding author's github id 2015-05-14 01:30:45 -04:00
Greg DeKoenigsberg
8ec8cd182a Adding author's github id 2015-05-14 01:30:01 -04:00
Greg DeKoenigsberg
9a1e35e1db Adding author's github id 2015-05-14 01:29:21 -04:00
Henrik Wallström
91483bdd6b Modules to manage IIS
Wraps the Web Server Administration module for PowerShell into Ansible modules.
2015-04-24 10:48:02 +02:00
schwartzmx
c6d5680967 fixes unzip bug for zip files, thanks to @ryanwalls
- also fixes possible import errors, and switches to use Start-Process on install to correctly wait
2015-04-14 23:52:08 -05:00
Timothy Vandenbrande
6b43dd630c windows firewall control 2015-03-16 11:34:07 +01:00
schwartzmx
4ece7362fb inital commit win_acl 2015-01-14 22:25:22 -06:00
schwartzmx
99927a5c54 updates docs, adds unzip func for bz2 gz tar msu¬
- Added functionality for unzipping/decompressing bzip gzip tar exe (self extracting) and msu (ms update) files to coincide with added functionality to win_zip¬
  - Added functionality requires PSCX (it will be installed if it can't be imported)¬¬
    - First try with chocolatey, if fail, direct install from msi
- Added recurse param to recursively unzip files from a compressed folder¬
  - useful for example: unzipping a Log.zip file that contains a load of .gz files¬
    - setting rm param to true will remove all compressed files after decompressing¬
2015-01-11 13:03:26 -06:00
Phil Schwartz
a95fabeeb2 fixes rm & restart param checks 2014-12-31 19:17:53 -06:00
Phil Schwartz
61d3f23c03 edit check for extension to use library func 2014-12-31 10:34:32 -06:00
Phil Schwartz
fd12a5cc84 specifies creation of directory if !exists
- added try catch for creation of directory, in case of an invalid path specified
- added specification to documentation
2014-12-30 09:54:22 -06:00
Phil Schwartz
a21e23846d init commit 2014-12-30 08:42:00 -06:00
Brian Coca
24734db807 corrected version added 2014-12-17 12:49:51 -05:00
net
33585d14a3 package file 2014-12-17 13:25:51 +02:00
Brian Coca
b5a0d10925 changed to use ansible standard 'name' instead of 'package' 2014-12-06 19:04:19 -05:00
Toshio Kuratomi
19e688b017 Fixes to documentation 2014-12-03 08:16:11 -08:00
Brian Coca
12e419bb4b Merge pull request #37 from petemounce/chocolatey
win_chocolatey: Windows package management with Chocolatey
2014-12-01 11:49:17 -05:00
Peter Mounce
9fb500480b Windows package management with Chocolatey 2014-10-01 14:58:45 +01:00
Peter Mounce
7f2732782d Add module to install windows updates
Supports specifying which category to install all updates from.
NEEDS: `choco install PSWindowsUpdate` beforehand - does not attempt to install it (or detect it's missing, yet)
PSWindowsUpdate: http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc#content
2014-09-30 00:27:29 +01:00
Michael DeHaan
73123b69fa Move modules into subdirectory. 2014-09-26 09:23:50 -04:00
Jon Hawkesworth
f8a5ddb9fd This change selects the certificate from the winrm configuration and attempts to find the expiry date from that.
Trond Hindenes pointed out that simply picking the first certificate from local computer certs is not guaranteed to select the correct certificate.
2014-09-01 21:22:18 +01:00
Jon Hawkesworth
a098882fb9 Added null check in case http connection used and no cert found. 2014-08-31 16:20:50 +01:00
Trond Hindenes
9aa6c44473 All changes referenced in PRs #8767 , #8768 , #8769 :
This changes the get-attr function slightly, and lets the module specify whether a param is needed and auto-fails if it is not present. A module can now verify params like so::
 $params = Parse-Args $args;
 $result = New-Object psobject;
 Set-Attr $result "changed" $false;
 $path = Get-Attr -obj $params -name path -failifempty $true -resultobj $result

or

$params = Parse-Args $args;
 $result = New-Object psobject;
 Set-Attr $result "changed" $false;
 $path = Get-Attr -obj $params -name path -failifempty $true -emptyattributefailmessage "Oh man. You forgot the main part!" -resultobj $result

slight tweak in how the powershell module converts to json in order to support nested objects (allows for more complex facts, among others)

This script gathers some extended facts on windows hosts in a json array attribute called "ansible_interfaces". This info is needed for some network-related modules I'm working on. Required the update to powershell.ps1 to return deeply nested json objects.
2014-08-29 10:39:42 +02:00
Chris Church
1b6ef9aa2e Replace Get-FileHash with MD5 code that works on PowerShell 3. 2014-08-28 01:42:22 -04:00
Michael DeHaan
71786bbdc8 Merge pull request #8227 from trondhindenes/win_setup_improvements
win_setup improvements: Correcly outputs ansible_totalmem
2014-08-08 12:42:41 -04:00
Trond Hindenes
fc26601981 win_setup improvements: Correcly outputs ansible_totalmem on computers with multiple ram chips 2014-07-22 01:38:46 +02:00
Trond Hindenes
ba507553b0 Better result handling 2014-07-10 12:00:00 +02:00
Trond Hindenes
8e16962596 improvements to win_feature 2014-07-08 18:04:12 +02:00
Chris Church
042d5b761d Return service name, display name, start mode and state from win_service module. 2014-07-02 08:12:40 -04:00
Michael DeHaan
f777471337 Merge pull request #7889 from chrishoffman/win_group
Adding win_group module
2014-06-22 11:26:27 -05:00
Chris Hoffman
da7c617ad3 Adding win_group module 2014-06-22 09:01:04 -04:00
Chris Hoffman
3a3a285d96 Fixing bug with stopped state 2014-06-21 22:01:02 -04:00
Chris Hoffman
24ad45c8e6 Better propagation of cmdlet errors 2014-06-21 21:59:53 -04:00
Chris Hoffman
0f2c5a3472 Using generic windows service for example 2014-06-21 21:58:26 -04:00
Michael DeHaan
4e153c7584 Merge pull request #7881 from cchurch/devel
Fix typo in powershell setup module.
2014-06-21 11:31:35 -05:00
Chris Hoffman
3000614930 Adding win_service module 2014-06-21 12:04:11 -04:00
Chris Church
1780cd6fda Fix typo in powershell setup module. 2014-06-21 10:27:43 -04:00
Simon Olofsson
73c4cb4c07 win_feature: Fix Description. 2014-06-20 17:14:36 +02:00
Paul Durivage
eba5e34641 Check .GetType rather than object directly 2014-06-19 16:41:24 -05:00
Paul Durivage
1fee46270c Move check down for access to 2014-06-19 16:41:05 -05:00
Paul Durivage
44fcebc5aa Rename variable 2014-06-19 16:40:35 -05:00
Paul Durivage
42834963cc Update documentation 2014-06-19 16:40:18 -05:00
Paul Durivage
ce0909035b Fix so it only deletes users that exist 2014-06-19 16:25:02 -05:00
Paul Durivage
6f87380248 Remove commented out lines 2014-06-19 16:25:02 -05:00
Paul Durivage
ac1d1b509b Fix incorrect name 2014-06-19 16:25:02 -05:00
Paul Durivage
5636f2b033 Move functions to top for correct scope 2014-06-19 16:25:02 -05:00
Paul Durivage
f8f1b7e922 Refactor of win_user module 2014-06-19 16:25:01 -05:00
Matt Martz
0ac996fbaa Add documentation for win_user module 2014-06-19 15:38:19 -05:00
Matt Martz
53497d90da Make sure the doc stubs for windows modules have proper license headers 2014-06-19 14:27:04 -05:00
Matt Martz
1f9121911c Make sure the module name is specified correctly in the win_feature docs 2014-06-19 14:27:03 -05:00
Paul Durivage
52ffcfb1ea Add documentation for win_feature module 2014-06-19 14:26:47 -05:00
Paul Durivage
8b0cc1a87b Add comments 2014-06-19 14:26:37 -05:00
Paul Durivage
ebbf356b30 Add restart functionality 2014-06-19 14:26:36 -05:00
Paul Durivage
a8dff668dd Renaming and refactoring of names, variables 2014-06-19 14:26:36 -05:00
Chris Church
d1423254d0 Update slurp/win_ping/win_stat to use Get-Attr. 2014-06-19 14:26:36 -05:00
Paul Durivage
e0f618b27a Remove unnecessary obj 2014-06-19 14:26:10 -05:00
Chris Church
2a20dfe963 Add data option to docs for win_ping. 2014-06-19 14:25:50 -05:00
Chris Church
a13b2dd3b3 Add tests for win_stat module. 2014-06-19 14:25:50 -05:00