Re: [ansible-project] Problem with "when" statement

2019-09-13 Thread MKPhil
hen statement. > > I'm not sure, but it sounds a bit as if the things you are comparing do > not contain the values you think they do > > Regards, K. > > > On Fri, Sep 13, 2019 at 7:42 PM MKPhil > > wrote: > >> >> I'm trying to compare two variables in a "

[ansible-project] Problem with "when" statement

2019-09-13 Thread MKPhil
I'm trying to compare two variables in a "when" statement - when x = y do something. This code works: when: unit_number == {{ disk_unit }} BUT I get a warning: [WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: unit_number ==

[ansible-project] Re: ansible playbook is failing with windows hosts

2019-09-10 Thread MKPhil
For windows hosts, use win_ping On Monday, 9 September 2019 21:09:10 UTC+1, Vowner wrote: > > Hi Experts, > > My ansible playbook of simple ping module is failing with my windows > host. > > My Playbbok > > --- > > - name: check ping status > hosts: all > tasks: > - name: ping servers

[ansible-project] Re: win_package

2019-09-09 Thread MKPhil
Can you share your playbook so we can see the command you are running? On Monday, 9 September 2019 16:25:08 UTC+1, Manish Kumar wrote: > > Can Anyone help on this ? > > On Monday, September 9, 2019 at 4:59:02 PM UTC+5:30, Manish Kumar wrote: >> >> Dear All, >> >> I am getting a very weird result

[ansible-project] Error adding disk with vmware_guest_disk

2019-09-09 Thread MKPhil
I'm trying to use the vmware_guest_disk module (Ansible v2.8.2) to add a disk to a VM but am getting an error. This is the relevant section of my playbook: - name: Add a Disk VM vmware_guest_disk: hostname: "{{ vc_hostname }}" username: "{{ vmware_user }}@{{

Re: [ansible-project] win_nssm

2019-08-22 Thread MKPhil
win_nssm is for creating windows services with nssm (the Non-Sucking Service Manager). What you probably want is win_command ( https://docs.ansible.com/ansible/latest/modules/win_command_module.html) so something like: --- - name: Install Notepad++ gather_facts: false hosts: all tasks:

Re: [ansible-project] Need Help!!!!

2019-08-21 Thread MKPhil
You need to put your code in the tasks section of your playbook, e.g.: --- - name: Restart a service gather_facts: false hosts: all tasks: - name: Restart a service win_service: name: LoadRunnerAgent state: restarted ... If that doesn't work, what error or output

[ansible-project] Cannot rename VM with vmware_guest

2019-08-09 Thread MKPhil
According to https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html I can rename a VM with Ansible by using: - name: Rename a virtual machine (requires the virtual machine's uuid)

Re: [ansible-project] Get VMWare Hypervisor Maintenance Mode state

2019-07-26 Thread MKPhil
Looked at this - it seems that is only puts a host in to maintenance mode - I don't think it will query the current state without making changes On Friday, 26 July 2019 15:19:17 UTC+1, p.co...@bham.ac.uk wrote: > > How about utilising vmware_maintenancemode’s state parameter? > > > > >

[ansible-project] Get VMWare Hypervisor Maintenance Mode state

2019-07-26 Thread MKPhil
I want to check if a VMWare Hypervisor (ESXi Host) is in Maintenance Mode or not. I've been through the docs for the various vmware_* modules but I can't see any which will return this value. Have I missed it or isn't this possible with Ansible? -- You received this message because you are

[ansible-project] String templating issue in lookup plugin command

2019-07-23 Thread MKPhil
I've got a Playbook that uses a lookup plugin to retrieve a value but I seem to have a string templating issue. This is my playbook: --- - name: retrieve password hosts: localhost gather_facts: no vars: vmware_user: "SOMEUSER" # This Doesn't work: vmware_password: "{{

Re: [ansible-project] Powershell playbooks

2019-02-21 Thread MKPhil
You can reduce the PowerShell to one line and, if you're only interested in the output as a string, you can use *Out-String* command with the *-Width* parameter and a suitably large value: win_shell: Get-NetAdapter | Where-Object {$_.Status -eq "up"} | Out-String - Width 4096 results in:

[ansible-project] Re: WSMan does not exist.

2018-05-24 Thread MKPhil
Hi Jordan, I am running the latest script. If I step through the script in Debug mode of the PowerShell ISE, it hits line 278: If (!(Get-PSSessionConfiguration -Verbose:$false) -or (!(Get-ChildItem WSMan :\localhost\Listener))) It evaluates the Get-PSSessionConfiguration part OK and then the

[ansible-project] WSMan does not exist.

2018-05-24 Thread MKPhil
I'm trying to set up a Windows 2008R2 server using the ConfigureRemotingForAnsible.ps1 script but I get the error: dir : Cannot find drive. A drive with the name 'WSMan' does not exist. At line:98 char:3 + dir 'WSMan:\localhost\Plugin\' -Force:$force | ? { $_.name -like "$filter" } | ... +

[ansible-project] Variable gets registered even if when clause is false

2018-03-26 Thread MKPhil
In a playbook, a Variable gets registered even if "when" clause is false...Is this a bug? Consider this playbook --- - name: When test gather_facts: false hosts: all vars: now: true tasks: - name: Get hostname shell: hostname register: output when: now == true

[ansible-project] Re: KDC has no support for encryption type

2018-02-20 Thread MKPhil
crc des-cbc-md5 > default_tkt_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5 > > Hope this helps, > > Jon > > > On Monday, February 19, 2018 at 11:17:41 AM UTC, MKPhil wrote: >> >> When connecting from Ansible 2.3.0.0 to Windows 2008 (not R2) running >&g

[ansible-project] MS SQL lookup plugin

2018-01-18 Thread MKPhil
I'm on the lookout for a "lookup plugin" for Ansible that can run a SELECT query on Microsoft SQL databases and brings the results back. Does such a thing exist anywhere? I did try some google searches but found nothing of note. Phil -- You received this message because you are subscribed

[ansible-project] Re: Copying file from a remote windows share

2017-09-28 Thread MKPhil
Kinda managed to sort my own problem... I used this snippet in my PowerShell script: # Super-secret credentials... $network_user = "domain\user" $network_password = "monkey123" # Where do we want to connect to - note: do not use a trailing \ $remotepath = "\\server\path" # Convert to a secure

[ansible-project] Copying file from a remote windows share

2017-09-27 Thread MKPhil
Hi I'm trying to write a PowerShell script which, in part, copies a file from a remote windows share (via UNC path) which I am calling from Ansible (with the "script" module) but I'm getting "The network path was not found" errors. The path *does* exist and the Ansible user has read/write

[ansible-project] Re: Playbook gives inconsistent results

2017-07-14 Thread MKPhil
Here's a basic Playbook which has this functionality. All tasks run for servers A and B but fails when run only against B where B is a server that cannot be contacted. My point is that if I run this against Server B I should get the same result *regardless* of what other servers I run it

[ansible-project] clear_host_errors bug?

2017-06-29 Thread MKPhil
I'm running Ansible 2.3.1.0 and getting some off behaviour with clear_host_errors - is this a bug??? Here's a sample Playbook: --- - name: Check Servers gather_facts: false hosts: windows tasks: - name: Check server with win_ping win_ping: register: result

[ansible-project] Enforcing multiple parameters in a Module

2017-06-14 Thread MKPhil
I'm developing a Module and am trying to work out how to ensure my module gets the parameters it needs. There are two separate parameters, lets call them A and B. My Module requires that either just A is supplied, or just B, or both A *and *B - the only scenario that is not supported is no

[ansible-project] Add or Edit VMWare Disks

2017-05-31 Thread MKPhil
I'm trying to find out how to add or edit disks for existing VMWare VMs. Specifically I'd like to be able to: * Add an extra disk (server may have one or more disks already) * Extend the "nth" disk I've looked at the vmware_guest module but it doesn't seem to have the functionality I need. Any

[ansible-project] Strange vmware_guest error

2017-05-04 Thread MKPhil
Maybe I'm missing something, but why does this play to reconfigure an existing VM (set the CPU count): - name: Add CPU/RAM vmware_guest: datacenter: "{{ datacenter }}" hostname: "{{ vcenter }}" username: "{{ vmware_user }}" password: "{{ vmware_password

[ansible-project] Why does vmware_guest_facts require a datacenter parameter?

2017-05-02 Thread MKPhil
As per http://docs.ansible.com/ansible/vmware_guest_facts_module.html (and my own testing) the vmware_guest_facts module requires a "datacenter" parameter, however, the example given on that page does not include it. To me, it doesn't seem necessary given either the name or uuid of the VM.

[ansible-project] Can Ansible authenticate to VMware with a Kerberos ticket

2017-04-25 Thread MKPhil
I'm looking at then VMWare modules for Ansible and they all seem to require the vCenter username and password in the playbook. For security reasons, I'd prefer to use a Kerberos ticket (as the vCenter is domain-joined) - is this possible? Otherwise, how do we avoid plain-text passwords

[ansible-project] Shutdown a Windows server

2017-03-29 Thread MKPhil
I'm trying to create a Playbook to *Shutdown *a Windows server. I am aware of win_reboot but that does a *Reboot *(i.e. shutdown /r) - I want to do shutdown /s to turn a machine completely off. I've made a copy of win_reboot.py and changed the Python code so it does a shutdown /s but when I

[ansible-project] Ansible on Windows host with two FQDNs

2017-03-09 Thread MKPhil
Hi, I posted a similar question over on Stack Overflow but without any helpful replies so I thought I'd try this group too... I don't think it is an Ansible question per se but has arisen from our use of Ansible We have Windows servers with two NICs, two separate IPs and two FQDNs in DNS,