[ansible-project] Re: win_package uninstall example?

2016-06-09 Thread 'J Hawkesworth' via Ansible Project
Yes adding state: absent will uninstall the package. Something like this: - name: remove java 8 if present win_package: name: "Java SE Development Kit 8 Update 73 (64-bit)" path: "c:\\packages\\jdk-8u73-windows-x64.exe" product_id:

[ansible-project] Re: Some Ansible Windows winrm variables doesn't seems to be use

2016-06-09 Thread 'J Hawkesworth' via Ansible Project
Which version of ansible are you using? The variable names changed between 1.9.x and 2.x - looks like you are using the variable names that will work with ansible 2.x I have 2.0.0.2 and 2.1.0.0 both working fine against windows hosts, but I always put the winrm connection settings in my

[ansible-project] Re: Windows installer failing with error 1603

2016-06-09 Thread 'J Hawkesworth' via Ansible Project
1603 is unfortunately not a lot of help. It seems to mean 'something went wrong' but doesn't detail why. Most msi type installers can write a log of what is going on I suggest you try running it with whatever command line options are available to get it to generate a log and look through that

[ansible-project] Re: set_fact for Windows domain login

2016-06-07 Thread 'J Hawkesworth' via Ansible Project
When you are inside double quotes, you usually need double backslashes. I've not used the ansible_env syntax but hopefully the following should do the trick. - set_fact: my_login: "{{ ansible_env['USERDOMAIN'] }}\\{{ ansible_env['USERNAME'] }}" Hope this helps, Jon On Tuesday, June

[ansible-project] Re: set_fact for Windows domain login

2016-06-07 Thread 'J Hawkesworth' via Ansible Project
Not tried, but worth trying single quotes and a single backslash On Tuesday, June 7, 2016 at 2:31:02 PM UTC+1, Mike Fennemore wrote: > > Hi Jon, good call on the \\ , it does now set the fact. However if I run a > debug I see it is now set as domain\\user. > > On Tuesday, June 7, 2016 at 3:23:44

[ansible-project] Re: Unusual WinRM connection issue

2016-06-06 Thread 'J Hawkesworth' via Ansible Project
Interesting. This change was recently added so you can force the ConfigureRemotingForAnsible.ps1 to generate a new self-signed cert by running like this: .\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert true https://github.com/ansible/ansible/pull/15275 As its says in the PR 'This is

Re: [ansible-project] Re: Unusual WinRM connection issue

2016-06-07 Thread 'J Hawkesworth' via Ansible Project
Sorry, I don't have a specific suggestion where to look. Sometimes I toss all the event logs and then poke things rather than filter for a specific event category. One of my colleagues tells me there's an rc6 for pywinrm 0.2 - might be worth trying that if you aren't on it already. On

[ansible-project] Re: win_package uninstall example?

2016-06-10 Thread 'J Hawkesworth' via Ansible Project
My guess would be the (un)installer is hanging as its asking the user for info, which won't ever get supplied because there's no gui and eventually you hit a timeout or one of the winrm quota limits You could try using raw to run msiexec with switches to write to a log file and see what info

[ansible-project] Re: Assign the result from a powershell script to ansible playbook variable

2016-05-24 Thread 'J Hawkesworth' via Ansible Project
Hey, you might want to use - set_fact: machineId={{result.stdout_lines.0}} as stdout_lines is an array rather than a string. Its hard to tell from this example because you only have one line in the example. But handy to know about as sometimes what you need is the contents of the 3rd line

[ansible-project] Re: Pulling an RPM via a URL and installing it... What am I doing wrong?

2016-05-25 Thread 'J Hawkesworth' via Ansible Project
I think you can avoid this altogether. I believe there's an epel-release package in the main yum repo which you can use to add EPEL to your yum sources (may not have the right terminology here). - name: ADD EPEL release using a yum package to do so yum: name: epel-release state:

[ansible-project] Re: Get Process ID of ansible-playbook within the playbook

2016-06-15 Thread 'J Hawkesworth' via Ansible Project
I have done this in a callback plugin by import os pid = os.getpid() The callback plugin code is here if that is helpful: https://github.com/jhawkesworth/ansible/commit/38b639ac1c2fae90177a87eff5611d62ff8ad00f This would be more difficult for a task though, because a/ ansible forks so each

[ansible-project] Re: win_package uninstall example?

2016-06-13 Thread 'J Hawkesworth' via Ansible Project
Hi, Although I've not tried uninstalling silverlight, I've certainly found some other things to be as difficult to uninstall as you seem to be above. A lot of installers seem to have the assumption that there will be someone sitting there at a GUI answering questions. I wound up using a brute

[ansible-project] Re: Unusual WinRM connection issue

2016-06-06 Thread 'J Hawkesworth' via Ansible Project
Anything in the event logs? Since it seems to be a connection reset, I'd hope there might be a message on the windows machine to say why. On Monday, June 6, 2016 at 1:48:11 PM UTC+1, Mike Fennemore wrote: > > Thanks Jon, good to see it's being well maintained. Had already gone down > the route

[ansible-project] Re: Dump Variables - BROKEN

2016-05-27 Thread 'J Hawkesworth' via Ansible Project
I usually just run something like this: ansible -m debug -a "var=hostvars['interesting_host']" localhost -i test_inventory Hope this helps, Jon On Friday, May 27, 2016 at 4:21:52 PM UTC+1, Andy L wrote: > > Prior to 2.0, I used a task that dumped Ansible variables to an output > file using a

[ansible-project] Re: Raw Command to run a UNC Powershell script

2016-05-26 Thread 'J Hawkesworth' via Ansible Project
Hi, I think the "/" prefixes are intended to be like windows style command line switches. You will be hitting a lot of parsers in the process of passing script parameters via ansible to powershell so this can be fiddly. Once you have got good yaml, there's jinja2 templating, then powershell

[ansible-project] Re: Run a script with a space in its path?

2016-06-22 Thread 'J Hawkesworth' via Ansible Project
Looking at the integration tests for the script module, which you can find here, https://github.com/ansible/ansible/blob/devel/test/integration/roles/test_win_script/tasks/main.yml there aren't any tests which demonstrate spaces in the file name, so I think its a case of it being something

[ansible-project] Re: Run a script with a space in its path?

2016-06-22 Thread 'J Hawkesworth' via Ansible Project
So just so we are clear... script attempts to pick .ps1 off your ansible controller and transfer it to the windows node before running it. If you want to run a .ps1 that is already there right now your only choice is to use raw. If your script task is in a role then 'role magic' (as I have

[ansible-project] Re: Weird: Passing variables to roles

2016-06-16 Thread 'J Hawkesworth' via Ansible Project
That is very unexpected. I pass vars to the same role a lot, although in my case I am usually doing it within the same play (as opposed to within a different play inside the same playbook), and I almost always pass the vars in as -e (extra vars), which from memory have highest precedence.

[ansible-project] Re: Have a script start running at a certain tag and run for every task that follows

2016-06-23 Thread 'J Hawkesworth' via Ansible Project
Sounds like you might need --start-at-task see http://docs.ansible.com/ansible/playbooks_startnstep.html It's been a while since I looked at the Tower ui but I think its an option on the each job from what I remember. Hope this helps, Jon On Thursday, June 23, 2016 at 12:49:29 AM UTC+1,

[ansible-project] Re: Domain Authentication

2016-06-23 Thread 'J Hawkesworth' via Ansible Project
Hi Mark, I've not tried the NTLM support yet but I think you might need to set ansible_winrm_server_cert_validation: ignore ... in your inventory/ group_vars. Otherwise python will attempt to validate the certificate presented by your windows vm, which is (very likely) self signed one. Give

[ansible-project] Re: Help test WinRM updates for NTLM, kerb delegation

2016-06-23 Thread 'J Hawkesworth' via Ansible Project
Not to steal Matt's fire but I can confirm 0.2.0 is released. I have been running some tests against 2.1.1 rc1 this week and I can run all the windows integration tests in just over 15 mins on my test box (against Server 2012 R2). I installed pywinrm 0.2.0 and the same test runs in just over 10

[ansible-project] Re: Running local play with winrm config

2016-06-16 Thread 'J Hawkesworth' via Ansible Project
I think you should set up your inventory in a manner similar to what is described in the windows introduction. http://docs.ansible.com/ansible/intro_windows.html#inventory put the windows-specific connection vars into a group and then when you want to do things to a windows host, use the

[ansible-project] Re: winrm and https

2016-06-23 Thread 'J Hawkesworth' via Ansible Project
As well as getting a valid, trusted cert generated for your host (and each of your windows hosts), I believe you should use the hostname rather than ip address. On Thursday, June 23, 2016 at 3:32:51 PM UTC+1, FrantiĊĦek Griga wrote: > > Hello, > > I have a problem with using Ansible to manage

[ansible-project] Re: launch executable on remote node

2016-06-24 Thread 'J Hawkesworth' via Ansible Project
Hmm. It sounds like the gui app could do with being split up into a windows service with a separate client app for the gui interface. I have encountered older windows apps which run as services but also present a GUI. For security reasons Microsoft have discouraged this for years now but I

[ansible-project] Re: launch executable on remote node

2016-06-24 Thread 'J Hawkesworth' via Ansible Project
I wouldn't know for sure but it would be unusual. Usually web services have some kind of client which can be launched independently from a web service. When you are doing things via winrm, its my understanding that there is no interactive user session, meaning there's no gui associated with

[ansible-project] Re: Ansible and 'Ubuntu on Windows'

2016-06-24 Thread 'J Hawkesworth' via Ansible Project
Its been a while and so there have probably been further updates to the Insider builds currently needed to run this, but I just tried this and managed to get ansible 2.1.0 installed via pip and able to win_ping a couple of windows boxes on my network. To get to 2.1.0 I did the following sudo

[ansible-project] Re: Running local play with winrm config

2016-06-17 Thread 'J Hawkesworth' via Ansible Project
Sounds like my ansible setup is rather different from yours, but I have wound up with a handful of config files for each environment - ones that configure connections to hosts I always keep separate from 'business' type vars. I don't know if using the add_host module

[ansible-project] Re: DNS lookup issue on Ansible

2016-06-17 Thread 'J Hawkesworth' via Ansible Project
I doubt ansible has its own dns cache. I forget which distro it was now but a while back i used to have to occasionally restart nscd service when I had dns problems like this. Hope this helps, Jon On Friday, June 17, 2016 at 2:20:55 PM UTC+1, Julien Deloubes wrote: > > Problem disappeared

[ansible-project] Re: Write raw file with newlines intact

2016-06-24 Thread 'J Hawkesworth' via Ansible Project
Does it have to be stored as a var? Could you use the synchronize module (rsync wrapper) delegated to one host to rsync it straight to the other? If the source file doesn't actually vary that much you can use template / win_template module and add the jinja2 directive to instruct the template

[ansible-project] Re: SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

2016-06-28 Thread 'J Hawkesworth' via Ansible Project
Hi, Since python 2.7.9 ( I think) python's default behavior has been to validate certificates for any https connections. The certificate used by the windows hosts is likely self-generated, therefore won't be fully trusted. So in order to avoid the certificate check, you have to set the

[ansible-project] Re: wait_for a windows file

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
Hmm wait_for is a python module. waiting for the port will work fine as that will presumably be happening on the ansible controller, rather than remotely on the machine you are trying to access. If only waiting for a file will do then you could try using the fetch module to pull the file back

[ansible-project] Re: Running NSSM from copied executables on windows and avoid installing NSSM

2016-02-12 Thread 'J Hawkesworth' via Ansible Project
You will need to connect as a user with admin level privileges. You can probably use win_copy to push the nssm.exe on to your machine first. If I recall it is a single standalone executable with no external dependencies (except possibly .net) Jon On Friday, 12 February 2016 09:04:26 UTC, ishan

[ansible-project] Re: Powershell Script playbook no running on servers

2016-02-12 Thread 'J Hawkesworth' via Ansible Project
Try with -vv ( 6 vs) which should show you the stdout / stderr from the script run. I would be tempted to insert some lines like the following to see what progress, if any, your script is making: Write-Host "Got here" Actually - I did a little digging and found this page -

[ansible-project] Re: win_copy failing

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
I don't think win_copy can collect from a share like you are trying to do in the example above. The assumption is that the source file you are copying is on the ansible controller. One trick you could use is to run smbclient on the ansible controller to collect the files you want to deploy to

[ansible-project] Re: Adding Multiple Lines to file (Windows Servers)

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
blockinfile is not a windows module unfortunately. There is an as yet un merged module for manipulating the windows hosts file though - perhaps give that a try - https://github.com/ansible/ansible-modules-extras/pull/1455 Hope that helps, Jon On Thursday, 11 February 2016 10:34:55 UTC, Mark

[ansible-project] Re: Adding Multiple lines to file

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
Lots of examples of the various ways to loop here: http://docs.ansible.com/ansible/playbooks_loops.html#standard-loops Depending on what you are trying to achieve, you might actually find the win_template module is easier to work with rather than multiple calls to win_lineinfile Hope this

[ansible-project] Re: Unpack tar.gz on Windows Server?

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
If you want an example role to install 7zip - have a look in the integration tests test/integration/roles/test-win-msi/ All the best, Jon On Wednesday, 10 February 2016 21:55:55 UTC, Slim Slam wrote: > > The easiest way seems to be to install 7z http://www.7-zip.org and use > that. It can

[ansible-project] Re: Ansible managing Windows hosts with non admin user

2016-02-22 Thread 'J Hawkesworth' via Ansible Project
>From here it looks like this is possible, although you would have to tweak user rights: https://social.technet.microsoft.com/Forums/scriptcenter/en-US/60de5fcd-33e0-479b-9668-fcf683678a2f/winrm-for-nonadministrative-users?forum=ITCG I get the impression that the intention for WinRM is for

[ansible-project] Re: Windows File Difference

2016-02-23 Thread 'J Hawkesworth' via Ansible Project
At the moment I don't think there's anything in the windows modules that will help with this. If anyone knows better please say but I think today --check and --diff aren't implemented for windows modules. However, it might be possible to make use of the --check and --diff playbook command

[ansible-project] Re: Ansible windows modules

2016-02-23 Thread 'J Hawkesworth' via Ansible Project
I would recommend trying the win_package module which can take properties and, if you capture the product_id you can use that in your playbook to make sure it only attempts installation once. Hope this helps, Please report back if this works for you so others can learn from your experience.

[ansible-project] win_regedit; binary data

2016-02-25 Thread 'J Hawkesworth' via Ansible Project
Hi, Does anyone have an example of using win_regedit to set binary data? I have a hex encoded string from a reg export but so far not found a way to convert it to whatever powershell needs. Many thanks, Jon -- You received this message because you are subscribed to the Google Groups

[ansible-project] Re: Windows File Difference

2016-02-25 Thread 'J Hawkesworth' via Ansible Project
Hi Sorry, probably didn't explain myself very well and what I was proposing was probably pretty fragile. You'd have to set up a directory of reference files that you want to compare to, and another of candidate files. Then you'd need a playbook to use fetch to pull the candidate files back

[ansible-project] Re: win_regedit; binary data

2016-02-25 Thread 'J Hawkesworth' via Ansible Project
To follow up, it appears you need to convert the incoming data to a byte array. I have some prototype code that can do this and will tidy up the code and create a pull request to add this when I get the chance. If anyone else hits this before the PR is available let me know and I'll send you

[ansible-project] Re: win_template always changing?

2016-02-29 Thread 'J Hawkesworth' via Ansible Project
Hi I have noticed this behaviour when running the windows integration tests. As far as I can tell it is something that has started happening relatively recently. What version of ansible are you using? Many thanks, Jon On Monday, 29 February 2016 11:39:43 UTC, Chris Bennett wrote: > > Hi

[ansible-project] Re: Ansible managing Windows hosts with non admin user

2016-02-27 Thread 'J Hawkesworth' via Ansible Project
Thanks for this. Since ansible and pywinrm are behaving the same, it occurs to me that the winrm configuration might not suit pywinrm. >From the above it appears you have created specific configuration for winrm, >rather than using the settings that are applied if you run the

[ansible-project] Re: Ansible windows modules

2016-02-27 Thread 'J Hawkesworth' via Ansible Project
I have used the workaround described in the article to install a hotfix. I expanded the .msu and then used raw to run dism.exe to install the expanded file, so I hope the same workaround will work for you. Hope this helps, Jon -- You received this message because you are subscribed to the

[ansible-project] Re: Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote tem

2016-02-22 Thread 'J Hawkesworth' via Ansible Project
Hi, Can I check that you have replaced your ansible.cfg with a new version supplied with ansible 2.0.0.2? Jon On Monday, 22 February 2016 13:57:25 UTC, Timothy Vandenbrande wrote: > > I can confirm this. > I have this issue on ansible 2.0.0.2, but works on ansible 1.9.x > I get this error

[ansible-project] Re: Updated ansible to track latest, now I have error 'Connection' object has no attribute '_split_ssh_args'

2016-02-26 Thread 'J Hawkesworth' via Ansible Project
Not seen this myself but a couple of things to investigate. You don't mention which version of ansible you were running previously - if it wasn't from a development checkout, ensure you have run source hacking/env-setup Probably worth re-running even if you were on a dev checkout before. Also

[ansible-project] Re: Ansible managing Windows hosts with non admin user

2016-02-26 Thread 'J Hawkesworth' via Ansible Project
could you try running playbook with -vv this should show a bit more information about how ansible is connecting also check the event log on the windows host to see if the login request is a success. Something else you could try is to run the python pywinrm example here against your host:

[ansible-project] Re: Ansible windows modules

2016-02-24 Thread 'J Hawkesworth' via Ansible Project
Quang, I suggest you try running the installation as a user with Administrative privileges. You may also find you need to temporarily disable UAC prompting for Administrative users only, which on Server 2012 R2 can be achieved by modifying

[ansible-project] Re: Debugging Ansible 2 on Windows Server?

2016-02-15 Thread 'J Hawkesworth' via Ansible Project
Bit of a guess but I wonder if you are hitting a quota limit in the winrm configuration on your windows machine? MaxMemoryPerShellMB looks the most likely - see https://msdn.microsoft.com/en-us/library/windows/desktop/ee309367(v=vs.85).aspx Unpatched Server 2008 R2 had a bug that mis-set the

[ansible-project] Re: Debugging Ansible 2 on Windows Server?

2016-02-15 Thread 'J Hawkesworth' via Ansible Project
Glad increasing the quota got you going on S 2012. You can manually apply the hotfix, although my prefered way of getting round it was to upgrade to Windows Management Framework 4.0 (which includes powershell 4) if that's an option for you. I think there's an msi or msu to run to install it -

[ansible-project] Re: Monitor Windows file (web.config) on servers

2016-02-16 Thread 'J Hawkesworth' via Ansible Project
Above looks good. You could try using win_stat, which returns a checksum and then do whatever is necessary if the checksum has changed. Something like the following --- - hosts: all tasks: - name: stat the hosts file win_stat: path: C:\windows\system32\drivers\etc\hosts

[ansible-project] Re: Running NSSM from copied executables on windows and avoid installing NSSM

2016-02-16 Thread 'J Hawkesworth' via Ansible Project
You will need to (temporarily) turn of UAC prompting for Adminstrator users then. You can change this using win_regedit HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System ConsentPromptBehaviorAdmin needs to 0 for it to be off, and 2 to be back on again. Hope this helps, Jon On

[ansible-project] Re: Monitor Windows file (web.config) on servers

2016-02-16 Thread 'J Hawkesworth' via Ansible Project
So, not quite sure what's going on here but... register just stores the output from the win_stat command in a variable with the name you've given it. So you need to do something with the contents of the variable - hence the debug in the example playbook above Also I think variable names can't

[ansible-project] Re: Monitor Windows file (web.config) on servers

2016-02-16 Thread 'J Hawkesworth' via Ansible Project
Glad its working. I don't know why those other variable names might be failing. Perhaps worth checking your playbook is valid yaml. I like to use either notepad++ as it has YAML syntax hightlighting, or use www.yamlint.com to check for correctness. Jon On Tuesday, 16 February 2016 14:54:06

[ansible-project] Re: Debugging Ansible 2 on Windows Server?

2016-02-16 Thread 'J Hawkesworth' via Ansible Project
The only time I've seen a raw really not produce any output was on ansible 1.9.4 where one of the command args contained a > - however the same problem doesn't occurr in 2.0. Does it fail instantly or after a second or two? Only thing other I can think of is to try the update to Windows

[ansible-project] Re: win_package arguments format

2016-02-17 Thread 'J Hawkesworth' via Ansible Project
Are you using Ansible 2.0.0.2? I suggest trying to do away with the quotes if at all possible, even if you wind up with a full path to the setup.iss arguments: "-s -f1 C:\\Users\\UserName\\Desktop\\Software\\setup.exe" Jon On Wednesday, 17 February 2016 11:29:02 UTC, Gerald Spencer wrote: >

[ansible-project] Re: How to make symbolic links in windows via Ansible ?

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
Obviously you will need to connect as an Administrator user. You don't mention which version of windows you are controlling but you may just need to temporarily disable UAC prompt for Administrator users. On Server 2012 the setting for this is in

Re: [ansible-project] Random undefined variables (facts) since ansible 2.0 upgrade

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
Do you have fact gathering set to smart in your ansible.cfg? On Thursday, 11 February 2016 13:28:38 UTC, Michael Baydoun wrote: > > In our case, the facts are being gathered, and used other plays included > in site.yml, but later on in a subsequent play the a fact that was defined > previously

[ansible-project] Re: Powershell Script playbook no running on servers

2016-02-11 Thread 'J Hawkesworth' via Ansible Project
Hmm, not sure what is going on there. Try running with -v so you can see stdout from script module output Also check the event log to see if there is anything there. When run on the server do you have accept UAC prompt? Might need to turn that off to run remotely via ansible. Hope this

[ansible-project] Re: copy file from remote windows server to local machine?

2016-02-22 Thread 'J Hawkesworth' via Ansible Project
I may be missing the point here but is the fetch module what you need? Fetch works against windows hosts and linux hosts. Plenty of examples in the integration tests here: https://github.com/ansible/ansible/blob/devel/test/integration/roles/test_win_fetch/tasks/main.yml Hope this helps, Jon

[ansible-project] Re: Ansible Playbooks can run PowerShell scripts but not long ones

2016-02-22 Thread 'J Hawkesworth' via Ansible Project
Ok, there could be a number of things going on here. WimRM enforces quotas on things like maximum amount of memory used and other resources, presumably as a security measure. Another thing that could be going on here is that one or more of the 18 things that are installed require an interactive

[ansible-project] Re: The term '/bin/sh' is not recognized as the name of a cmdlet - PowerShell

2016-03-10 Thread 'J Hawkesworth' via Ansible Project
Can you share your ansible.cfg differences between a clean ansible.cfg? Looks like the result of some sudo/become settings are getting added to your setup module invocation on the windows box and confusing things. Jon On Wednesday, 9 March 2016 14:30:18 UTC, Peter Daniel wrote: > > I'm testing

[ansible-project] how to debug 'ERROR! failed to combine variables, expected dicts but got a 'dict' and a 'AnsibleUnicode''

2016-03-10 Thread 'J Hawkesworth' via Ansible Project
Hi, I've been refactoring an inventory file and moving some things out into group and host vars. When I try and use debug just to check that the inventory file is ok like this: ansible locahost -i bust_inventory -m debug I'm getting ERROR! failed to combine variables, expected dicts but

[ansible-project] Re: how to debug 'ERROR! failed to combine variables, expected dicts but got a 'dict' and a 'AnsibleUnicode''

2016-03-10 Thread 'J Hawkesworth' via Ansible Project
... and to answer my own question... remember when moving inventory vars, which may be expressed as key=value pairs into your host_vars or group_vars, that host_vars and group_vars expect proper yaml syntax i.e. key: value Jon On Thursday, 10 March 2016 15:44:45 UTC, J Hawkesworth wrote: > >

[ansible-project] Re: Check existence and state of a service on windows machine using win_service

2016-03-18 Thread 'J Hawkesworth' via Ansible Project
I suggest you add a task, before your win_service task that installs the service if it is not yet installed. Depending on what the service is, you might be able to use win_package to install it. If it is already installed, there is not much to loose by running the win_package task a second

[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-03-14 Thread 'J Hawkesworth' via Ansible Project
Hi Mark, I think you are getting pretty close. I can see a couple of issues in your playbook which might unstick you... First the with_items needs to go right at the end of all of the parameters for the vsphere guest module - at the moment you have the exsi parameter after the with_items.

[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-03-11 Thread 'J Hawkesworth' via Ansible Project
Hi Mark, I've not tried this myself with this specific module, but I think you should be able to use one of the with_ mechanisms in your playbook to create multiple vms. Have a look at http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-hashes Hope this helps, Jon On

[ansible-project] Re: Check existence and state of a service on windows machine using win_service

2016-03-19 Thread 'J Hawkesworth' via Ansible Project
You could run a raw powershell command like Get-Service nameOfService -ErrorAction SilentlyContinue and then register the result, then check You would need the '-ErrorAction SilentlyContinue' bit otherwise when the service doesn't exist, Get-Service will fail. also if you prefer you could do

[ansible-project] Re: Running exe file on windows from linux control machine

2016-03-09 Thread 'J Hawkesworth' via Ansible Project
Assuming your product is 64 bit, you can also install it on a windows machine somewhere and look in the following location in the registry to find the product_id: HKLM:\Software\microsoft\windows\currentversion\uninstall The package_id is only used to check whether the package has already been

[ansible-project] Re: Ansible Vault

2016-03-31 Thread 'J Hawkesworth' via Ansible Project
Hi Mark, Bit late to this one but as well as using group_vars folders I'd suggest organizing things so that you aren't trying to do this: ansible_ssh_pass: {{ winservers_password }} so you can avoid a vault lookup of a var. Instead I'd put the ansible_ssh_pass: ACTUAL_SECRET_PASSWORD into

[ansible-project] Re: Ansible winrm problem

2016-03-31 Thread 'J Hawkesworth' via Ansible Project
Guessing here, since this is not something I've tried This poster seemed to get the same error as you: In his case there was a proxy involved. Would there be a proxy in your scenario too? I think there are winrm proxy settings now although this isn't something I've tried.

[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-04-05 Thread 'J Hawkesworth' via Ansible Project
Mark, Something like this: --- - hosts: 127.0.0.1 connection: local user: root sudo: false gather_facts: false serial: 1 vars: vcenter_hostname: UK.server.local esxhost: xxx.xxx.xxx.xxx datastore: UK1 network: Web vmcluster: UKCLUSTER folder:

[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-04-05 Thread 'J Hawkesworth' via Ansible Project
Hi Mark, Quickest way to get going is probably to pass the serverlist file in to ansible using extra vars ansible-playbook your_playbook -e @/full/path/to/your/serverlist If you don't want to use the -e (extra vars) functionality, then I think you need to use include_vars, - see

[ansible-project] Re: Error ansible over powershell

2016-04-06 Thread 'J Hawkesworth' via Ansible Project
Hi, Do you have ansible_connection: winrm set against your host or better still in the group vars that apply to your windows hosts. See http://docs.ansible.com/ansible/intro_windows.html#inventory Ansible needs telling to use winrm, otherwise it will default to attempting ssh connection,

[ansible-project] Re: win_lineinfile backrefs not working

2016-04-06 Thread 'J Hawkesworth' via Ansible Project
Not used this module myself but I think perhaps you need to use $1 instead of \1 Have a look at the integration tests for this module here: https://github.com/ansible/ansible/blob/devel/test/integration/roles/test_win_lineinfile/tasks/main.yml There's a task that looks like this - name:

[ansible-project] Re: Launching applications remotely with GUI

2016-04-05 Thread 'J Hawkesworth' via Ansible Project
Generally ansible is intended to fail if the modules can't achieve their goals. When I'm developing playbooks I do sometime watch the GUI, although much of the checking I do is automated, typically by using register http://docs.ansible.com/ansible/playbooks_variables.html#registered-variables

[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-04-05 Thread 'J Hawkesworth' via Ansible Project
Looks like we have crossed messages. Ansible is pretty flexible, if that suits your need then that's good enough. If you use a role you can do away with the include_vars but putting your serverlist var in a vars/main.yml under your role. Roles are nice as they can magically load lots of stuff

[ansible-project] Re: Ansible AD Domain Authentication

2016-04-12 Thread 'J Hawkesworth' via Ansible Project
Hi Mark, If you run a (sudo) pip list on your ansible controller what version is reported for the 'kerberos' library? For some reason, ansible is still falling back to using basic auth in your case. When I've seen that its either that the connection variables aren't getting set up, or

[ansible-project] Re: Facing issues with WinRM connection

2016-04-08 Thread 'J Hawkesworth' via Ansible Project
Can you try re-running the script https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 please? Which version of Windows are you running against? On Thursday, April 7, 2016 at 12:10:56 PM UTC+1, Deepa Yr wrote: > > WinRM is already set up to

[ansible-project] Re: Problem with templates

2016-04-08 Thread 'J Hawkesworth' via Ansible Project
Hi Not sure exactly but it looks like you're mixing key=value args and yaml styl args. Try the following --- - hosts: all gather_facts: no vars: - my_list: [1,2,3,4] tasks: - name: TEMPLATE template: dest: /home/Ansible/dest.y src: src.j2 Or --- - hosts:

[ansible-project] Re: provision instance on AZURE

2016-04-12 Thread 'J Hawkesworth' via Ansible Project
Not sure what your specific problem is but there is a bunch of work being done on the Azure side of things at the moment with new modules being worked on at the moment. Have a look at these Pull Requests on github - perhaps you can help out with testing?

[ansible-project] Re: Windows authentication

2016-04-12 Thread 'J Hawkesworth' via Ansible Project
Hi, Perhaps you can use User Data feature of AWS to achieve this. Might be worth reading this if you have not seen it already: https://www.ansible.com/blog/easily-provision-windows Jon On Monday, April 11, 2016 at 2:51:05 PM UTC+1, Anjana Raghavendra P wrote: > > Hi, > > We are using CIS

[ansible-project] Re: Breaking up hosts file

2016-04-12 Thread 'J Hawkesworth' via Ansible Project
Create /etc/ansible/host_vars and /etc/ansible/group_vars Create group vars files like /etc/ansible/group_vars/myhosts.yml and enter variables for your 'myhosts' group in the myhosts.yml file. Remember that these are YAML files, so vars need to be in the form key: value NOT key=value Hope

[ansible-project] Re: Facing issues with WinRM connection

2016-04-12 Thread 'J Hawkesworth' via Ansible Project
Do you have the legacy winrm connectors set up (winrm originally listened on ports 80 (http) and 443 (https)? If you don't need these, then please remove them - there is an open defect regarding handling legacy listeners which stops the setup module from gathering facts. If you do need the

Re: [ansible-project] Re: Ansible AD Domain Authentication

2016-04-12 Thread 'J Hawkesworth' via Ansible Project
Anjana, I have not seen this error before but please advise the following: version of whichever python-kerberos libraries you are using on your ansible controller (see http://docs.ansible.com/ansible/intro_windows.html#installing-python-kerberos-dependencies) version of the python kerberos

[ansible-project] Re: Fetch from Windows Server 2012 Fails Silently?

2016-04-10 Thread 'J Hawkesworth' via Ansible Project
I can't see anything wrong with what you have got here so could you create a simplified reproducer and log a bug report? Many thanks, Jon On Sunday, 3 April 2016 17:42:22 UTC+1, Slim Slam wrote: > > I'm using the Ansible "fetch" module to fetch a file from the remote > Windows Server machine,

[ansible-project] Re: Fetch from Windows Server 2012 Fails Silently?

2016-04-10 Thread 'J Hawkesworth' via Ansible Project
Ah, sorry, you already did... https://github.com/ansible/ansible-modules-core/issues/3375 On Sunday, 10 April 2016 10:57:07 UTC+1, J Hawkesworth wrote: > > I can't see anything wrong with what you have got here so could you create > a simplified reproducer and log a bug report? > > Many thanks,

[ansible-project] Re: Generating pretty HTML report from the list-tasks option.

2016-04-09 Thread 'J Hawkesworth' via Ansible Project
Nice idea. I haven't seen anything like that. You might be able to do it by creating a custom callback plugin, although I've not investigated whether --list-task would actually generate any callback events. I'd be tempted to do something quick and dirty like this: echo "" >

[ansible-project] Re: How to create a service on a windows 10 machine?

2016-04-09 Thread 'J Hawkesworth' via Ansible Project
sc is a powershell alias for 'set-content' If you change your raw command to raw: sc.exe it will probably work. Better still install nssm (which is a service manager) and use win_nssm module. There is also a win_service_configure module if you prefer for creating modules but it

Re: [ansible-project] Re: Ansible AD Domain Authentication

2016-04-09 Thread 'J Hawkesworth' via Ansible Project
Hi, My guess would be you haven't got pykerberos installed. on your ansible controller. If you see transport=ssl in the connection information it isn't going via kerberos. Since you have a ticket set up I think its just that you don't have the pykerberos package installed. Hope this

[ansible-project] Ansible and 'Ubuntu on Windows'

2016-04-09 Thread 'J Hawkesworth' via Ansible Project
Hello, Microsoft announced Ubuntu on Windows recently - there's a bit of information about it here: https://insights.ubuntu.com/2016/03/30/ubuntu-on-windows-the-ubuntu-userspace-for-windows-developers/ Obviously this opens up intriguing possibility of running Ansible on a windows machine

[ansible-project] Re: Implementation question

2016-04-06 Thread 'J Hawkesworth' via Ansible Project
Sounds like you probably need to use inventory groups. See http://docs.ansible.com/ansible/intro_inventory.html You might need to use groups with dynamic inventory http://docs.ansible.com/ansible/intro_dynamic_inventory.html#static-groups-of-dynamic-groups HTH Jon On Tuesday, 5 April 2016

[ansible-project] Re: haw to save the output of a script in a file ansible 2.0.2

2016-04-07 Thread 'J Hawkesworth' via Ansible Project
Hi, You probably need to use the shell module instead of the command module - command runs commands without a shell. To use >> and 2>&1, which are thing that your shell gives you, you need to use the shell module. Hope this helps, Jon On Thursday, April 7, 2016 at 9:10:56 AM UTC+1, mondher

[ansible-project] Re: check if a (file or directory) symbolic links exists on a windows file system with the help of win_file

2016-03-19 Thread 'J Hawkesworth' via Ansible Project
I don't have any experience of using symlinks on windows, but my advice for construction windows paths (assuming you are using ansible 2.0 or later) is... 1/ If you need to double quote your path names, then always use double backslash for the path separator So win_stat:

[ansible-project] Re: Raw Command to run a UNC Powershell script

2016-03-24 Thread 'J Hawkesworth' via Ansible Project
Glad its working. Actually, you might be able to save yourself a step using the 'script' module which can deliver your powershell script to the windows hosts and run it with 1 module call. - name: Configure Tentacle hosts: all tasks: - name: Configure Tentacle script: config.ps1

[ansible-project] Re: win_stat poses an error when i try to get info about a file symbolic link actively in use by a processor

2016-03-21 Thread 'J Hawkesworth' via Ansible Project
It looks like a fix for this has already been made in latest development version of ansible. https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/powershell.ps1#L214 Are you able to try latest development version? Jon On Monday, 21 March 2016 05:48:53 UTC, ishan jain wrote:

[ansible-project] Re: establishing winrm connection failing

2016-03-26 Thread 'J Hawkesworth' via Ansible Project
Yes, the new names came in with Ansible 2.0. If you can, I would recommend using 2.0.0.2 or later if you are working with Windows - it's noticeably faster. Oh and check you are using pywinrm >= 0.11 as that speeds it up too. HTH, Jon -- You received this message because you are

[ansible-project] Re: Populate list from results (list)

2016-03-23 Thread 'J Hawkesworth' via Ansible Project
I think you can do this using the map filter something like (untested) - name: Set server names address for webapp proxy server set_fact: servers: "{{ ec2_facts.instances|map('private_ip_address')|list }}" Have a look at: http://jinja.pocoo.org/docs/dev/templates/#map HTH Jon

  1   2   3   4   5   6   7   >