[ansible-project] Re: Windows Domain/Ansible Kerberos Auth Issues Still

2020-06-11 Thread David Foley
Are these Linux Machines? 
how many Domain Controllers are in your Environment if you have more then 
one it may be doing a round-robin on the Kerberos and failing on one Domain 
and not on the other.: you need to start restricting down to only allow 
your Linux Server to Connect to one AD.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3ff7848c-d64b-4182-a1c0-c8786e236961o%40googlegroups.com.


[ansible-project] VM not joining domain

2020-06-10 Thread David Foley
Did you check the windows Event logs for the Active Directory 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/64defabf-bc9f-43e3-82fc-fd48e567e25ao%40googlegroups.com.


Re: [ansible-project] deploy VM from template and customize guest

2020-06-08 Thread David Foley
So you want to do something like Terraform init / plan & Apply and once 
finished you want to do a Terraform Destroy? 

No Ansible doesn't do State Files 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9b905e14-20a3-4f69-a5cc-c0a8a547ac3bo%40googlegroups.com.


Re: [ansible-project] deploy VM from template and customize guest

2020-06-08 Thread David Foley

>
> I'll assume you are refering to Custom Specs within vCenter :
>
>
You can use the following: 
https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html

*customization_spec*  

-
added in 2.6
Unique name identifying the requested customization specification.
This parameter is case sensitive.
If set, then overrides customization parameter values.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ad930091-eb03-4962-ae53-494beafd0f8ao%40googlegroups.com.


[ansible-project] Re: Vm mount iso and install vmware tools

2020-05-26 Thread David Foley
instead of the win_get_url use the win_package that will install the 
application for you vm_tools

  win_package:
  path: 
https://repo.saltstack.com/windows/Salt-Minion-3000-Py3-AMD64-Setup.exe
  product_id: 'Salt-Minion-3000-Py3-AMD64-Setup.exe'
  arguments: 'Salt-Minion-3000-Py3-AMD64-Setup.exe /S /master={{ 
master }} /minion-name={{ minion }}'
  state: present

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8a1c6358-a435-4069-9c3c-a3fbdc738e4c%40googlegroups.com.


[ansible-project] Re: facing the problem in mapping network drive

2020-05-26 Thread David Foley
Hi,

It may be easier to use PowerShell within an Ansible caller.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-7

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/aa3495ae-93b9-4b62-968f-12499462d467%40googlegroups.com.


Re: [ansible-project] ansible kerberos library is not installed

2020-05-25 Thread David Foley
I would advise speaking to your AD Team or your GPO Administrator, They may 
have updated their GPO Policies to stop communication over the ports used 
for Kerberos:  This Issue doesn't seem to be an Ansible issue but an issue 
with your Environment setup.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/09a4c5c9-e5ce-4766-93cc-0ef70013cbcd%40googlegroups.com.


Re: [ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-25 Thread David Foley
It's outputting your items list, as you have msg on the list if you are looking 
to put the info you need to use a register then either var or message that 
register

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cf0ed58a-48ea-4ecb-b9bc-4b36790aae06%40googlegroups.com.


Re: [ansible-project] What are the possible setups for ansible in the cloud to configure on premise devices?

2020-05-23 Thread David Foley

>
>
>>- What is your Cloud Service Provider that this PoC will take place ? 
>>   - Using just "OpenVPN" Soultion on a cloud provider isn't best 
>>   practice when it comes to Security you can download an OpenVPN 
>> instance on 
>>   EC2 market, but you may have better option using the AWS offering for 
>>   better Routing and Security options:  I haven't seen companies using 
>>   OpenVPN as a soultion to make a connection from On-prem to Cloud
>>
>>
I don't think the Cloud had your use case in mind when it was first 
offered, a better PoC would be how to use Terraform / Ansible / Packer for 
a Multi-Cloud Hybrid Solution: if you are Studying in the Cloud Field a 
better PoC would be a Multi-Cloud Environment as a HA Setup.

For Example: 

If you are Running an Application on AWS how can we have a Fault Torelance 
Solution on GCP within the Same Region for GDPR: If you have German 
Customer their Data needs to have jurisdiction within Germany. With this in 
mind if your AWS Region in Germany goes down how do we make sure Fault 
Torelance is in place and Traffic is routed to a Secondary Cloud Provider 
(Azure / GCP) Similar to an On-Prem Solution were a Company would have 2 
Datacenters in within the Same Country but in different locations 
(Availability Zones).
 
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b0d7cdef-8c25-4333-8a67-c86b6fa3ebc1%40googlegroups.com.


[ansible-project] win_domain_computer module

2020-05-21 Thread David Foley
If your looking at doing work on Active Directory; you may need to switch over 
to "win_domain_membership"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4264a2b3-c0ef-4c3d-96c3-ea621ee0bb3a%40googlegroups.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread David Foley
Another way I know is to send the reg to the stdout and cat that stdout 
into the other playbook.
similar to outputting to the File, but if the API Value is big you may be 
better off with the Text File.


 register: test
   - debug: msg="{{test.stdout}}"

 


  tasks:
   - shell: cat "{{test.stdout}}"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bef73289-d9ca-43be-bfba-9dcd0514ab08%40googlegroups.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread David Foley
Why two Playbook ? 

But either way, Copy the Reg to a Local Json File

Then in your Second Playbook Just read in the JSON File 

 name: Read Json File
shell: cat Info.json
register: json_file


(json_file.stdout | from_json).VALUE

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d5ceca07-32d7-4a76-8079-984ee24d26b9%40googlegroups.com.


[ansible-project] Re: Passing data from ansible to service now table

2020-05-21 Thread David Foley
Is the Body Correct ? and that you aren't missing any JSON values? 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9191ee55-8d85-432e-937e-93d8bf7a995f%40googlegroups.com.


[ansible-project] Re: vmotion condition

2020-05-19 Thread David Foley
Hi Mani,


Your best bet would be to use PowerCLI, 
https://communities.vmware.com/thread/539904?start=15=0

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dccf80c7-accd-4d7e-9d9d-92e41e184ef1%40googlegroups.com.


Re: [ansible-project] Re: how to install a specific KB from windows update

2020-05-18 Thread David Foley

>
>
>>> It seems every Question you post in here 90% of the troubleshooting 
>>> seems to be issues around your indentation, I'll recommend reading up on 
>>> the basic of Ansible and how yaml works if your having issues like these... 
>>> Also can you Please fix this from the code you have above, Run it and see 
>>> what error comes out from it ? 
>>
>>
If you read the Ansible Doc on Win_update 
https://docs.ansible.com/ansible/latest/modules/win_updates_module.html  
 You code seems fine, again Run it and see what issues you get..

 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/72131d09-b8dc-44ef-8da2-9275f4090d81%40googlegroups.com.


[ansible-project] Re: is there a progress bar in TASK?

2020-05-17 Thread David Foley
A Quick Google Search Returned this for me. I'll assume you did the same? 

https://stackoverflow.com/questions/41194021/how-can-i-show-progress-for-a-long-running-ansible-task



On Sunday, May 17, 2020 at 6:26:50 PM UTC+1, Tony Wong wrote:
>
> is there a progress bar available in TASK?
>
> [image: Screen Shot 2020-05-17 at 10.25.19 AM.png]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1561b216-726e-47f2-956e-f862b12d3cf6%40googlegroups.com.


[ansible-project] Re: how to install a specific KB from windows update

2020-05-17 Thread David Foley
When you Run Windows Update it returns all available Updates as you can see 
from your Output it's skipping as they aren't in the Whitelist

Your WHEN statement is wrong.  you need to Set it to something like when: 
update_result.reboot_required == True 


On Sunday, May 17, 2020 at 6:43:28 PM UTC+1, Tony Wong wrote:
>
> I am trying to install a specific update KB4541509
>
> but it is not getting installed. I got the playbook running but not 
> getting installed
>
> here is from the ansible win log
>
> 2020-05-17 10:22:51Z Creating Windows Update session...
> 2020-05-17 10:22:51Z Create Windows Update searcher...
> 2020-05-17 10:22:51Z Setting the Windows Update Agent source catalog...
> 2020-05-17 10:22:51Z Requested search source is 'windows_update'
> 2020-05-17 10:22:51Z Search source set to 'windows_update' 
> (ServerSelection = 2)
> 2020-05-17 10:22:51Z Searching for updates to install
> 2020-05-17 10:28:12Z Found 6 updates
> 2020-05-17 10:28:12Z Creating update collection...
> 2020-05-17 10:28:12Z Skipping update d1fe2427-174b-4b7b-ba04-69aa90060d12 
> - Microsoft .NET Framework 4.8 for Windows Server 2012 R2 for x64 
> (KB4486105) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update ce061df5-b9f2-475f-9850-50ad5b7b9693 
> - 2020-02 Security Update for Adobe Flash Player for Windows Server 2012 R2 
> for x64-based Systems (KB4537759) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update ebfa39a3-52fe-4ff1-b7d4-375ad1654c04 
> - 2020-03 Servicing Stack Update for Windows Server 2012 R2 for x64-based 
> Systems (KB4540725) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update 533cf583-0396-4862-a1d5-6200a46f82ba 
> - 2020-05 Security and Quality Rollup for .NET Framework 3.5, 4.5.2, 4.6, 
> 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows 8.1 and Server 2012 R2 for 
> x64 (KB4556401) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update 2221dd34-39bb-4f16-b320-be49fe4a6b95 
> - Windows Malicious Software Removal Tool x64 - v5.82 (KB890830) as it was 
> not found in the whitelist
> 2020-05-17 10:28:12Z Skipping update 4aeb4fc1-39c2-4514-be30-33e57845a002 
> - 2020-05 Security Monthly Quality Rollup for Windows Server 2012 R2 for 
> x64-based Systems (KB4556846) as it was not found in the whitelist
> 2020-05-17 10:28:12Z Calculating pre-install reboot requirement...
> 2020-05-17 10:28:12Z Native job completed with output: 
> Name   Value  
> 
> 
>   
>    -  
> 
> 
>   
> updates{}  
> 
> 
>  
> found_update_count 0  
> 
> 
>   
> changedFalse  
> 
> 
>   
> reboot_requiredFalse  
> 
> 
>   
> installed_update_count 0  
> 
> 
>   
> filtered_updates   {2221dd34-39bb-4f16-b320-be49fe4a6b95, 
> 4aeb4fc1-39c2-4514-be30-33e57845a002, d1fe2427-174b-4b7b-ba04-69aa90060d12, 
> ce061df5-b9f2-475f-9850-50ad5b7b9693...}
> 
>   
>
>
>
>
> not sure why it was looking for 

[ansible-project] Ansible vmware_content_deploy_template

2020-05-15 Thread David Foley
Hi All,

I'm getting the Following Error When trying to Run an Ansible Playbook. 
even when i have validate_certs Set to False, it's still displaying the 
issue.

Unverified HTTPS request is being made. Adding certificate verification is 
strongly advised. See: 
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  
InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py


---
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Deploy Virtual Machine from template in content library
vmware_content_deploy_template:
  hostname: "{{ Host }}"
  username: "{{ user }}"
  password: "{{ pass }}"
  template: WIN10-V3-SDBLD12
  datastore: "{{ datastore }}"
  folder: /vm
  datacenter: Cork
  host: "{{ ESXi }}"
  name: Test_Machine
  validate_certs: False
  state: present
delegate_to: localhost



ansible-playbook t.yaml -v

ansible-playbook 2.9.9
  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/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its 
verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its 
verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its 
verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from 
/usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc

PLAYBOOK: t.yaml 
**Positional
 
arguments: t.yaml
become_method: sudo
inventory: (u'/etc/ansible/hosts',)
forks: 5
tags: (u'all',)
verbosity: 5
connection: smart
timeout: 10
1 plays in t.yaml

PLAY [localhost] 
**META:
 
ran handlers

TASK [Deploy Virtual Machine from template in content library] 
task
 
path: /srv/ansible/t.yaml:5
 ESTABLISH LOCAL CONNECTION FOR USER: root
 EXEC /bin/sh -c 'echo ~root && sleep 0'
 EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/root/.ansible/tmp `"&& mkdir 
/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 && echo 
ansible-tmp-1589555313.13-6894-196031450684677="` echo 
/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 `" ) && 
sleep 0'
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/_text.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/vmware.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/vmware_rest_client.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/basic.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/six/__init__.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/urls.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/_collections_compat.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/__init__.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/formatters.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/validation.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/converters.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/pycompat24.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/__init__.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/process.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/parsing/convert_bool.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/_utils.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/common/parameters.py
Using module_utils file 
/usr/lib/python2.7/dist-packages/ansible/module_utils/parsing/__init__.py
Using module_utils file 

Re: [ansible-project] installing windows updates on windows hosts

2020-05-13 Thread David Foley
Again you seem to be missing vaules 


reboot: yes
When: """ 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/719f19da-9014-4fde-beaa-d97fc617%40googlegroups.com.


Re: [ansible-project] installing windows updates on windows hosts

2020-05-13 Thread David Foley
Also appears you are missing the Tasks: element in your playbook

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e144217-99a6-4ee1-b03c-7da997a244e3%40googlegroups.com.


[ansible-project] Re: Create VM from ISO on ESXI

2020-05-11 Thread David Foley

>
> Hi,
>

you could just use the following Folder: / 

That will automatically place the Server into the path of  Datacenter/vm/

Using Folder would place it into a more specific folder if needed i.e 
Folder Datacenter/vm/Development/

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/249344c1-783c-4e64-990e-8928353b500b%40googlegroups.com.


[ansible-project] Re: How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread David Foley


Using the Example Curl -X you can use the Ansible URI Module curl -X POST 
http://developer:developer@localhost:8080/job/test/buildWithParameter 
--data-urlencode json='{"parameter": [{"name":"paramA", "value":"123"}]}'---
  - name: Jenkins Remote Build 
hosts: localhost
connection: local
tasks:
- name: Adding Virtual Machine to Blackout
  uri:
url: 
http://developer:developer@localhost:8080/job/test/buildWithParameter
method: POST
body_format: JSON
body:
"{\"parameter\": [{\"name\":\"Test\"}, 
{\"vaule\":\"123\"}]}status_code: 200


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/493bd37e-c52c-49e2-8280-9353b423023d%40googlegroups.com.


[ansible-project] How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread David Foley
Hi,

In order to push jobs from Ansible or even Python to Jenkins you need to make 
sure Remote Trigger is enable and an API Token has been created for your 
Jenkins User. You can Then just use a Post request using the Ansible URI module 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/81063e55-65f0-487d-9953-03a2cd19b00c%40googlegroups.com.


[ansible-project] Help with Conditions

2020-05-05 Thread David Foley
Hi All,

Just wondering is their a better way of doing the Following?


---
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Getting vCenter Details 
uri:
  url: http:///mdb/{{ fqdn }}
  return_content: yes
  body_format: json
register: mdb_console
  - copy:
  content: "{{ mdb_console }}"
  dest: 
"/usr2/dfoley/jenkins/workspace/vSphere/Virtual_Machine_Decommissioning/mdb_console.json"


  - name: Getting VM Info
block:
  - name: Get virtual machine info 
vmware_vm_info:
  validate_certs: no
  hostname: "{{ mdb_console.json.0['console'] }}"
  username: "{{ user }}"
  password: "{{ pass }}"
delegate_to: localhost
register: vm_info
when: mdb_console.json.0['console'] is defined
  - copy:
  content: "{{ item }}"
  dest: 
"/usr2/dfoley/jenkins/workspace/vSphere/Virtual_Machine_Decommissioning/MachineInfo.json"
with_items:
  - "{{ vm_info.virtual_machines | json_query(query) }}"
vars:
  query: "[?guest_name=='{{ VM_Name }}']"


  - name: Getting VM Info
block:
  - name: Get virtual machine info
vmware_vm_info:
  validate_certs: no
  hostname: "{{ mdb_console.json.0['vconsole'] }}"
  username: "{{ user }}"
  password: "{{ pass }}"
delegate_to: localhost
register: vm_info
when: mdb_console.json.0['console'] is not defined
  - copy:
  content: "{{ item }}"
  dest: 
"/usr2/dfoley/jenkins/workspace/vSphere/Virtual_Machine_Decommissioning/MachineInfo.json"
with_items:
  - "{{ vm_info.virtual_machines | json_query(query) }}"
vars:
  query: "[?guest_name=='{{ VM_Name }}']"


  
  - name: Read Json File
shell: cat /usr2/dfoley/jenkins/workspace/vSphere/
Virtual_Machine_Decommissioning/MachineInfo.json
register: json_file


  - name: Power Down Virutal Machine
vmware_guest_powerstate:
  validate_certs: no
  hostname: "{{ mdb_console.json.0['console'] }}"
  username: "{{ user }}"
  password: "{{ pass }}"
  name: "{{ VM_Name }}"
  state: powered-off
delegate_to: localhost
when: (json_file.stdout | from_json).power_state != "poweredOff" and 
mdb_console.json.0['console'] is defined


  - name: Power Down Virutal Machine
vmware_guest_powerstate:
  validate_certs: no
  hostname: "{{ mdb_console.json.0['vconsole'] }}"
  username: "{{ user }}"
  password: "{{ pass }}"
  name: "{{ VM_Name }}"
  state: powered-off
delegate_to: localhost
when: (json_file.stdout | from_json).power_state != "poweredOff" and 
mdb_console.json.0['console'] is not defined



Looking at maybe something I'm used to with Salt.

- name: Power Down Virutal Machine
vmware_guest_powerstate:
  validate_certs: no
 {% if mdb_console.json.0['console is defind %}
  hostname: "{{ mdb_console.json.0['console'] }}"
 {% else %}
  hostname: "{{ mdb_console.json.0['vconsole'] }}"
 {% endif %} 
  username: "{{ user }}"
  password: "{{ pass }}"
  name: "{{ VM_Name }}"
  state: powered-off
delegate_to: localhost
when: (json_file.stdout | from_json).power_state != "poweredOff"


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/610b85f9-36ba-44c1-8fb6-4853ce5dfe54%40googlegroups.com.


[ansible-project] Re: Running roles for every host mentioned in inventory file

2020-05-02 Thread David Foley
Not sure if it's possible with ansbile but with Salt you can set Grains and do 
if else statements based on those grains 

{% if role[host1] } 
- role: host1 
{% elif role[hoat2] %}
-role: host 2
{%endif%}

I would look up condition s for ansible 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/babcda8b-87d5-42fd-a39e-f3fb94ab4290%40googlegroups.com.


Re: [ansible-project] Ansible Multiple virtual machines or templates with same name found.

2020-04-29 Thread David Foley
Having issues extracting UUID
Has anyone in the group successful deployed using the path should it be

/Folder/Data center/vm/folder/template_name 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cba65736-b6f7-4018-8953-42e197fe37ac%40googlegroups.com.


Re: [ansible-project] Ansible Multiple virtual machines or templates with same name found.

2020-04-29 Thread David Foley
Hi
It would be nice to have different names for templates but
I don't have control of the templates just working on the automation of
different tasks within our infrastructure.



On Wed 29 Apr 2020, 19:02 Dick Visser,  wrote:

> Maybe I'm stating the obvious but you should make sure there are no
> duplicate templates.
> Or, as the docs you quoted say, use the UUID to identify it.
>
> On Wed, 29 Apr 2020 at 18:58, David Foley  wrote:
>
>>
>> Hi All,
>>
>> Trying to Deploy a Virtual Machine on a Cluster within a DataCenter which
>> appears that a Template with the Same name is on a different Cluster within
>> the Same Datacenter:
>>
>> Looking at the Following from the Doc:
>> can someone help me with the absolute path ?
>>
>> I tried the following
>>
>> template: "Corp\San Diego\QR\.Golden Tempates\WS2016-DSC-0819" which
>> didn't appear to Work.
>>
>> *template*
>> <https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html#parameter-template>
>> -
>> Template or existing virtual machine used to create new virtual machine.
>> If this value is not set, virtual machine is created without using a
>> template.
>> If the virtual machine already exists, this parameter will be ignored.
>> This parameter is case sensitive.
>> You can also specify template or VM UUID for identifying source.
>> version_added 2.8. Use hw_product_uuid from vmware_guest_facts as UUID
>> value.
>> From version 2.8 onwards, absolute path to virtual machine or template
>> can be used.
>>
>>
>> TASK [Virtual Machine customization] 
>> ***
>> fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": 
>> "Multiple virtual machines or templates with same name [WS2016-DSC-0819] 
>> found."}
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/32ad5fa6-bc48-451b-90b6-9718671225d9%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/32ad5fa6-bc48-451b-90b6-9718671225d9%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwO12bcZbWAy5CvnNF%3DfgyKLZRgZ4UQeHFQtwBYSvjgb1A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwO12bcZbWAy5CvnNF%3DfgyKLZRgZ4UQeHFQtwBYSvjgb1A%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJUZ6v7ZkfRSTO9kR-gZvyRDyZuNcnyKu38%2BeFxhUofkPTeUyw%40mail.gmail.com.


[ansible-project] Ansible Multiple virtual machines or templates with same name found.

2020-04-29 Thread David Foley

Hi All,

Trying to Deploy a Virtual Machine on a Cluster within a DataCenter which 
appears that a Template with the Same name is on a different Cluster within 
the Same Datacenter:

Looking at the Following from the Doc:
can someone help me with the absolute path ? 

I tried the following 

template: "Corp\San Diego\QR\.Golden Tempates\WS2016-DSC-0819" which didn't 
appear to Work. 

*template*  

-
Template or existing virtual machine used to create new virtual machine.
If this value is not set, virtual machine is created without using a 
template.
If the virtual machine already exists, this parameter will be ignored.
This parameter is case sensitive.
You can also specify template or VM UUID for identifying source. 
version_added 2.8. Use hw_product_uuid from vmware_guest_facts as UUID 
value.
>From version 2.8 onwards, absolute path to virtual machine or template can 
be used.


TASK [Virtual Machine customization] ***
fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": "Multiple 
virtual machines or templates with same name [WS2016-DSC-0819] found."}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/32ad5fa6-bc48-451b-90b6-9718671225d9%40googlegroups.com.


[ansible-project] Re: ssl: the specified credentials were rejected by the server

2020-04-25 Thread David Foley
It's best to move to an Agent-Based configuration management Tool Such as 
SaltStack for Windows if your Machines are been managed by GPO which is 
preventing Ansible to Connect.
Or else configure everything before the machine joins the Domain

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/50d2441e-079e-4b84-b90f-1987a719bcce%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread David Foley
You need to do loop on the var

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4f261b1b-17ae-475d-ba8d-dbe7b8aead5a%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread David Foley
You need to debug out the message

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/10241fc0-733f-4839-a1a3-fce4818545e7%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-22 Thread David Foley
Still ident While Fixing The Last Ident Issue you seem to have moved 
everything to the Left: 

Abhijeet Kasurde Just attached the Correct Way of Doing It;

I would Recommend Reading / Watching Some Ansible Videos before taken on 
some Projects: you may end-up doing more harm then good within your 
Environment  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5563ddd6-a7fe-4287-bf54-be68796dcdfa%40googlegroups.com.


[ansible-project] Re: Need to Deploy OS using ansible playbook

2020-04-21 Thread David Foley

If the Server is an HP maybe try this Module: 

https://docs.ansible.com/ansible/latest/modules/hpilo_boot_module.html


Or Dell IDrac 

https://github.com/dell/dellemc-openmanage-ansible-modules



On Tuesday, April 21, 2020 at 11:17:10 AM UTC+1, Pavan Nr wrote:
>
> need to deploy WS2019 OS on bare-metal server not in virtual machine 
>
> On Tuesday, April 21, 2020 at 3:22:05 PM UTC+5:30, David Foley wrote:
>>
>> When you say deploy an OS:
>>
>> is this a bare-metal Server or a  Virtual Machine on vSphere ? 
>>
>> On Tuesday, April 21, 2020 at 9:16:13 AM UTC+1, Pavan Nr wrote:
>>>
>>> Hi All,
>>>
>>> any one experimented how to deploy OS using playbook ?
>>> how to call WDS Server using ansible playbook?
>>>
>>> if anyone done , please share me steps.
>>>
>>> regards,
>>> Pavan 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eff4e6b3-dfb6-43e6-9010-f6121ff91859%40googlegroups.com.


[ansible-project] Re: Proxmox VM provisioning with ansible - how to run task on created vm?

2020-04-21 Thread David Foley
Hi

I currently have the Following Playbook that creates Windows Virtual 
Machines: 
If you need to do other tasks on the Virtual Machine; I'll recommend 
creating a Pipeline within a CI/CD platform:

For Example:
I have a number of Tasks 

   - Create Machine
   - Create AD Object
   - Join Domain
   - Install Applications On Server
   - Update SCCM 
   - Configure Second HardDrive on machine if Requested in Form:
   - Add DSC Agent onto Server


Tasks 4 will be Taken Care for you if you set AutoLogin:



---
- name: Running Create Virtual Machine Playbook
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
  - name: Virtual Machine and customization
vmware_guest:
  validate_certs: no
  hostname: "{{ vcenter }}"
  username: "{{ username }}"
  password: "{{ password }}"
  cluster : "{{ cluster }}"
  datacenter: "{{ datacenter }}"
  name: "{{ VM_Name }}"
  folder: /
  template: "{{ template }}"
  state: poweredon
  datastore: "{{ datastore }}"
  disk:
  - size_gb: 40
type: thin
datastore: "{{ datastore }}"
  networks:
  - name: "{{ network_name }}"
ip: "{{ ip }}"
netmask: "{{ netmask }}"
gateway: "{{ gateway }}"
dns_servers:
- 10.10.10.10
- 10.10.10.20
type: static
  wait_for_ip_address: yes
  wait_for_customization: yes
  customization:
hostname: "{{ VM_Name }}"
dns_servers:
- 10.10.10.10
- 10.10.10.20
dns_suffix:
- localhost.com
- ap.localhost.com
domain: "{{ domain }}"
autologon: yes
password: "{{ local_pass }}"
runonce:
- powershell.exe -ExecutionPolicy Unrestricted wget https://raw.
githubusercontent.com/ansible/ansible/devel/examples/scripts/
ConfigureRemotingForAnsible.ps1 -OutFile C:\Windows\Temp\
ConfigureRemotingForAnsible.ps1
- powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows\
Temp\ConfigureRemotingForAnsible.ps1 -EnableCredSSP -DisableBasicAuth -
Verbose
  hardware:
memory_mb: "{{ mb }}"
num_cpus: "{{ cpu }}"
delegate_to: localhost



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f04a8024-babd-4f03-b1f3-1c66fc6a16fd%40googlegroups.com.


[ansible-project] Re: Need to Deploy OS using ansible playbook

2020-04-21 Thread David Foley
When you say deploy an OS:

is this a bare-metal Server or a  Virtual Machine on vSphere ? 

On Tuesday, April 21, 2020 at 9:16:13 AM UTC+1, Pavan Nr wrote:
>
> Hi All,
>
> any one experimented how to deploy OS using playbook ?
> how to call WDS Server using ansible playbook?
>
> if anyone done , please share me steps.
>
> regards,
> Pavan 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/682b4d8c-8c45-4b8c-8143-83763098b65b%40googlegroups.com.


[ansible-project] Re: How generate dynamic host file with only IP of concrete vendor (by MAC)

2020-04-20 Thread David Foley
I'm using the following Playbook, which is taken the IP Address Entered 
from the Jenkins Pipeline:

---
  - name: Running Appened To Ansible Host File Playbook
hosts: localhost
connection: local
tasks:
- name: Adding The IP Address of the Newly Created Server to Ansible 
Host File
  blockinfile:
path: /etc/ansible/hosts
block: |

  [win]
  "{{ ip }}"

  [win:vars]
  ansible_user="{{ service }}"
  ansible_password="{{ service_pass}}"
  ansible_connection=winrm
  ansible_winrm_transport=credssp
  ansible_winrm_server_cert_validation=ignore

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3af699c5-544b-4251-afee-2594ca969abc%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-19 Thread David Foley

>
> $ sudo apt update
>> $ sudo apt install software-properties-common
>> $ sudo apt-add-repository --yes --update ppa:ansible/ansible
>> $ sudo apt install ansible
>>
>> https://docs.ansible.com/ansible/2.3/intro_installation.html

No you don't need to have the latest Ubuntu 19 

>  
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8d575edb-65a0-4d98-b6d7-c6a0ca349ac8%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-19 Thread David Foley
Can you Install Ansible 2.9 on a Test Machine and Retest on this version ? 


>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd7813fa-88fd-4a75-8112-3dce3819459b%40googlegroups.com.


[ansible-project] Re: How to mix a reboot handler with a service restart handler in the same Ansible playbook?

2020-04-19 Thread David Foley
Looking at Ansible Reboot a Machine:

- name: Reboot a slow machine that might have lots of updates to apply
  reboot:
reboot_timeout: 3600

This will Reboot the System and Test the connection: I wonder if you do a 
Timeout of zero: default is 6000 what happens if you set this to zero, 

Also the Return Value from the above is 

*rebooted*  

boolean
always 
true if the machine was rebooted

*Sample:*
True


I haven't Tested this code:

- name: Reboot a slow machine that might have lots of updates to apply
  reboot:
reboot_timeout: 3600
  register: reboot

  - debug:
  var: reboot.rebooted

- name: Service Restart
  service:
name: httpd
state: restarted
  when: "{{ reboot }}" == no



   

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6251ea49-de6e-4b1e-82c3-2be23dd15dfb%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
Why Aren't you using your Local Machine using Atom or VS Code to build your 
Yaml files then using WinSCP copy the playbooks over ? 

On Saturday, April 18, 2020 at 9:43:00 PM UTC+1, Tony Wong wrote:
>
> what editor can i use on my ubuntu box? I cant use anything other than 
> vim. 
>
>
> still getting the error. 
>
> tony@ubuntu:~/ansiblework$ ansible-playbook info.yml
>  [WARNING]: provided hosts list is empty, only localhost is available. 
> Note that the implicit localhost does not match 'all'
>
> ERROR! Syntax Error while loading YAML.
>   mapping values are not allowed in this context
>
> The error appears to be in '/home/tony/ansiblework/info.yml': line 3, 
> column 8, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
> name: get info vm
>   hosts: localhost
>^ here
>
> On Sat, Apr 18, 2020 at 1:26 PM David Foley  > wrote:
>
>> ---
>> - name: get info vm
>>   hosts: localhost
>>   connection: local
>>   gather_facts: false
>>   tasks:
>>   - name: get info about the virtual machine
>> vmware_guest_info:
>>   hostname: vcnerter
>>   username: 
>>   password: 
>>   datacenter: DC
>>   validate_certs: False
>>   name: myvm
>>   schema: "vsphere"
>>   properties: ["config.hardware.memoryMB", "guest.disk", 
>> "overallStatus"]
>> delegate_to: localhost
>> register: info
>>   
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/3000e6a2-0db0-4bd5-8fba-ec114f5240e4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/3000e6a2-0db0-4bd5-8fba-ec114f5240e4%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/672cc33a-758f-4083-a48b-0882cb11e453%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
you missing* " - " *



On Saturday, April 18, 2020 at 9:46:14 PM UTC+1, Tony Wong wrote:
>
>
>
> On Sat, Apr 18, 2020 at 1:42 PM Tony Wong > 
> wrote:
>
>> what editor can i use on my ubuntu box? I cant use anything other than 
>> vim. 
>>
>>
>> still getting the error. 
>>
>> tony@ubuntu:~/ansiblework$ ansible-playbook info.yml
>>  [WARNING]: provided hosts list is empty, only localhost is available. 
>> Note that the implicit localhost does not match 'all'
>>
>> ERROR! Syntax Error while loading YAML.
>>   mapping values are not allowed in this context
>>
>> The error appears to be in '/home/tony/ansiblework/info.yml': line 3, 
>> column 8, but may
>> be elsewhere in the file depending on the exact syntax problem.
>>
>> The offending line appears to be:
>>
>> name: get info vm
>>   hosts: localhost
>>^ here
>>
>> On Sat, Apr 18, 2020 at 1:26 PM David Foley > > wrote:
>>
>>> ---
>>> - name: get info vm
>>>   hosts: localhost
>>>   connection: local
>>>   gather_facts: false
>>>   tasks:
>>>   - name: get info about the virtual machine
>>> vmware_guest_info:
>>>   hostname: vcnerter
>>>   username: 
>>>   password: 
>>>   datacenter: DC
>>>   validate_certs: False
>>>   name: myvm
>>>   schema: "vsphere"
>>>   properties: ["config.hardware.memoryMB", "guest.disk", 
>>> "overallStatus"]
>>> delegate_to: localhost
>>> register: info
>>>   
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/3000e6a2-0db0-4bd5-8fba-ec114f5240e4%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/3000e6a2-0db0-4bd5-8fba-ec114f5240e4%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4c975ae3-3aef-4c8f-8e09-85adb4b96b68%40googlegroups.com.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
---
- name: get info vm
  hosts: localhost
  connection: local
  gather_facts: false
  tasks:
  - name: get info about the virtual machine
vmware_guest_info:
  hostname: vcnerter
  username: 
  password: 
  datacenter: DC
  validate_certs: False
  name: myvm
  schema: "vsphere"
  properties: ["config.hardware.memoryMB", "guest.disk", "overallStatus"
]
delegate_to: localhost
register: info
  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3000e6a2-0db0-4bd5-8fba-ec114f5240e4%40googlegroups.com.


[ansible-project] Re: Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
hosts: localhost
  gather_facts: false
  tasks:
  - vmware_guest_info:
  hostname:  "{{ vcenter_hostname }}"
  username: eu\wavesservice
  password: GHb!DW|79Z5i
  validate_certs: no
  datacenter: Test
  name: "{{ VM_Name }}"
  schema: "vsphere"
  properties: ["runtime.powerState"]
delegate_to: localhost
register: vminfo

  - debug:
  var: vminfo

  - vmware_guest_powerstate:
  validate_certs: no
  hostname: "{{ vcenter_hostname }}"
  username: eu\wavesservice
  password: GHb!DW|79Z5i
  name: "{{ VM_Name }}"
  state: powered-off
delegate_to: localhost
when: vminfo != "poweredOff"


  - name: Deleting The Virutal Machine
vmware_guest:
  hostname:  "{{ vcenter_hostname }}"
  username: eu\wavesservice
  password: GHb!DW|79Z5i
  validate_certs: no
  cluster: "{{ cluster_name }}"
  name: "{{ VM_Name }}"
  state: absent
delegate_to: localhost
register: facts


---
- name: get info vm
  hosts: localhost
  connection: local
  gather_facts: false
  tasks:
  - name: get info about the virtual machine
vmware_guest_info:
  hostname: vcnerter
  username: 
  password: 
  datacenter: DC
  validate_certs: False
  name: myvm
  schema: "vsphere"
  properties: ["config.hardware.memoryMB", "guest.disk", "overallStatus"
]
delegate_to: localhost
register: info
  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/05188019-3473-41eb-ba7a-1984ab313e81%40googlegroups.com.


Re: [ansible-project] Re: Need some suggestion

2020-04-16 Thread David Foley
If you are looking to break your application roles up into some sort of micro 
service: I would suggest looking at Ansible plugin for Jenkins and configure a 
pipeline with choces, based on these it will callthe roles, or you can have a 
pipeline for each role with a downstream from the main pipeline. 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69cec0ae-7026-48d2-962c-7b3fd2132aa7%40googlegroups.com.


[ansible-project] "msg": "Local object for PUT does not exist"

2020-04-15 Thread David Foley
Remote_user I would do connection: local, also what's the folder permission on 
that playbook folder? 


 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d673621c-73b1-4ac3-ba79-98192c157d13%40googlegroups.com.


[ansible-project] Re: Need Assistance With Ansible Error

2020-04-15 Thread David Foley
It's not refusing the connection, but no harm in trying;

Did you add the key to known hosts file?



https://www.techrepublic.com/article/how-to-easily-add-an-ssh-fingerprint-to-your-knownhosts-file-in-linux/

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/10f5d94f-eea8-4d20-ad49-1ed45dc1a9d3%40googlegroups.com.


Re: [ansible-project] Login/Password encryption in host file

2020-04-14 Thread David Foley

You could use vault / hash or shadow your password and use that hashed value. 
Or you could add you job to a CI/CD pipeline add your credentials into that 
pipeline which will be hashed out on Stdout

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d4e726a7-c2c9-4009-b4da-7f9e5b889b0f%40googlegroups.com.


[ansible-project] Help with a Windows target node

2020-04-14 Thread David Foley
Is the user part of the local Admin group or has access to login to the machine 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/320c80d3-ab20-4ddc-a3fa-12ca3e668124%40googlegroups.com.


[ansible-project] Ansible With_Item as Variable

2020-04-14 Thread David Foley
Hi All,

Could do with some Help with this issue:

I am trying to get the Powerstate of a Virtual Machine and power off when 
powerstate != poweroff
and looking at a way to copy the copy the Cluster variable to a Text File:

---
- name: Running Create Virtual Machine Playbook
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
  - name: Getting Info from Virtual Machine
vmware_vm_info:
  validate_certs: no
  hostname: "{{ vcenter }}"
  username: "{{ user }}"
  password: "{{ password }}"
  folder: "/"
delegate_to: localhost
register: vminfo
  - debug:
  msg: "{{ item.power_state }}"
with_items:
  - "{{ vm_info.virtual_machines | json_query(query) }}"
vars:
  query: "[?guest_name=='win201_old']"
  
   - vmware_guest_powerstate:
   validate_certs: no
   hostname: "{{ vcenter }}"
   username: "{{ user }}"
   password: "{{ password }}"
   name: win201_old
   state: powered-off
 delegate_to: localhost
 when: "{{ item.power_state }}" != "poweredOff"

   - name: Copy Variable
 copy:
  content: '{{ item.cluster }}'
  dest: /srv/ansible/test.txt 
   delegate_to: localhost

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5a5cc162-6dea-4af5-b5a9-af061ab8a1a0%40googlegroups.com.


[ansible-project] Re: need assistance with this playbook

2020-04-14 Thread David Foley
Hi Tony:

I think you need to look at powercli for ESXi Configuration: 

On Tuesday, April 14, 2020 at 2:28:33 PM UTC+1, Tony Wong wrote:
>
> how do i create a ansible vmware playbook with following
>
>
> - join esx host to domain
> - setup ntp with - 0.pool.ntp.org, 1.pool.ntp.org
> - set advance settings on host : VMkernel.Boot.hyperthreadingMitigation 
> to True
> - reboot host
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/620e0b8b-728a-4e63-af4b-72b12b7fbe8d%40googlegroups.com.


[ansible-project] Re: ansible add esxi host to datacenter or folder

2020-04-13 Thread David Foley
Hi Tony,

Looking at the Documentation 
https://docs.ansible.com/ansible/latest/modules/vmware_host_module.html

- name: Add ESXi Host to vCenter
  vmware_host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
cluster: cluster_name
esxi_hostname: '{{ esxi_hostname }}'
esxi_username: '{{ esxi_username }}'
esxi_password: '{{ esxi_password }}'
state: present
  delegate_to: localhost

This code will add the host to a Cluster, 


On Monday, April 13, 2020 at 4:48:40 PM UTC+1, Tony Wong wrote:
>
> I am new to ansible and want to know how to add a esxi host to vcenter in 
> a datacenter
>
> I have the following in a yml file but not sure what else to do
>
>
> - hosts: localhost
>   connection: local
>   tasks:
> - name: include vars
>   include_vars:
>
> - name: Add ESXi Host to vCenter
>   vmware_host:
> hostname: '{{ vcenter_hostname }}'
> username: '{{ vcenter_username }}'
> password: '{{ vcenter_password }}'
> datacenter: datacenter_name
> esxi_hostname: '{{ esxi_hostname }}'
> esxi_username: '{{ esxi_username }}'
> esxi_password: '{{ esxi_password }}'
> state: present
>   delegate_to: localhost
> ~
>
>
>
>
> please help as vmware ansible seems very limited in info 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7d76788c-cc3f-4530-80cd-626b4700cf1c%40googlegroups.com.


[ansible-project] Re: ansible updating vmware tools on windows vms

2020-04-13 Thread David Foley
I have supplied a completed Playbook for you to use ? what else are you 
looking for ? 


On Sunday, April 12, 2020 at 11:20:26 PM UTC+1, Tony Wong wrote:
>
> I created a yml file like this. I just need to test it on one vm. 
>
> ---
> - hosts all
>   gather_facts: false
>   connection: local
>   user: remote
>
>   vars:
> vcenter_hostname: 'vcenter.domain.com'
> username: 'administrator@vsphere.local'
> password: ''
> datacenter_name: 'DC1'
> VM_Name: 'vm1'
>
> - name: Running VMTools Playbook
>   hosts: localhost
>   gather_facts: false
>   connection: local
>   tasks:
>   - name: Get Virtual Machine info
> vmware_guest_info:
>   validate_certs: no
>   hostname: "{{ vcenter_hostname }}"
>   username: "{{ user }}"
>   password:  "{{ pass }}"
>   validate_certs: no
>   datacenter: "{{ datacenter_name }}"
>   name: "{{ VM_Name }}"
>   schema: "vsphere"
>   properties:
> delegate_to: localhost
> register: vminfo
>
>   - name: Updating VM Tools
> vmware_guest_tools_upgrade:
>   validate_certs: no
>   hostname: "{{ vcenter_hostname }}"
>   username: "{{ user }}"
>   password: "{{ pass }}"
>   datacenter: "{{ datacenter_name }}"
>   uuid: "{{ vminfo.instance.config.uuid }}"
> delegate_to: localhost
>
>
>
> what else do i need?
>
> On Sunday, April 12, 2020 at 10:16:23 AM UTC-7, Tony Wong wrote:
>>
>> does anyone have a playbook or how do i get started with a playbook 
>> updating vmwasr tools on windows guests?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d2519fad-602f-4502-a4f2-5478fb110f2e%40googlegroups.com.


[ansible-project] ansible updating vmware tools on windows vms

2020-04-12 Thread David Foley
Trythe following code,
I am because the tools moulde is looking for a UUID of the Machine I'm first 
doing a Gather_facts on that machine inorder to get the UUID then importing 
that as a variable in the next task


:---
- name: Running VMTools Playbook
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
  - name: Get Virtual Machine info
vmware_guest_info:
  validate_certs: no
  hostname: "{{ vcenter_hostname }}"
  username: "{{ user }}"
  password:  "{{ pass }}"
  validate_certs: no
  datacenter: "{{ datacenter_name }}"
  name: "{{ VM_Name }}"
  schema: "vsphere"
  properties:
delegate_to: localhost
register: vminfo

  - name: Updating VM Tools
vmware_guest_tools_upgrade:
  validate_certs: no
  hostname: "{{ vcenter_hostname }}"
  username: "{{ user }}"
  password: "{{ pass }}"
  datacenter: "{{ datacenter_name }}"
  uuid: "{{ vminfo.instance.config.uuid }}"
delegate_to: localhost

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/39e0a881-62e9-463c-94f8-0b5e67e2031e%40googlegroups.com.


[ansible-project] Re: Powershell code in Ansible playbook returns non zero error code

2020-04-10 Thread David Foley

Have you Tested the Powershell Code on a local machine to make sure it's 
working ? 
You could:

   - Create the Powershell Script in Name.ps1
   - Copy Name.ps1 to Temp
   - Run it and then Remove name.ps1 from Temp Folder


In the past, I had issues with running Powershell Scripts using Ansible, 
Now if i need to use Powershell, Adding / Removing AD Objects I just use 
SaltStack for that.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0e12eadc-9c16-4882-8ee8-515ade5339cd%40googlegroups.com.


[ansible-project] Re: Problems Creating VMs From Template

2020-04-09 Thread David Foley
Can you test on a Different Linux OS, like Ubuntu and a Different Network 
vSwitch 

On Thursday, April 9, 2020 at 4:37:26 PM UTC+1, AJ wrote:
>
> Nope it's unreliable. Ran it a few more times, it completely worked a 
> couple times, then the 3rd time it worked on the first VM and failed on the 
> 2nd VM because the network was unavailable.
> So with open vmtools it doesn't even change the guest network settings.
> With native vmtools it changes all the guest network settings, but roughly 
> 75% of the time the IP is unreachable unless I "jump start" it by consoling 
> into the guest and initiate some kind of traffic from the VM.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e5fcb99d-b388-47d1-9011-99e1dd0a96d2%40googlegroups.com.


[ansible-project] Re: Problems Creating VMs From Template

2020-04-09 Thread David Foley
If i can remember Correctly: I had the Same issue with Static IP not taken 
affect, as my AutoLogin wasn't working, Once i fixed the Password on the 
template, Static IP Address were taken effect.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d3d507e5-dfa6-4129-a63e-6f605daf83c2%40googlegroups.com.


[ansible-project] Re: Problems Creating VMs From Template

2020-04-09 Thread David Foley

>
> I'm using Ansible to Deploy Windows machines: having no issues, out side 
> of your Code: Outside of your code I'm not using both of the following:  
>

>-  start_connected: True
>-wait_for_ip_address: yes 
>
> Not sure if Static IP Address settings need to have login set to use to 
configure the Static IP 

customization:
hostname: "{{ VM_Name }}"
dns_servers:
- 
dns_suffix:
- 
domain: "{{ domain }}"
autologon: yes
password: "{{ local_pass }}"
runonce:
- 

But i also see you don't have   delegate_to: localhost

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5cef026b-f747-416a-b6fe-3a9d4d6c8170%40googlegroups.com.


[ansible-project] Re: How to increase VM OS disk, from template, using ansible vmware guest module

2020-04-08 Thread David Foley
Hi Bhanu,

Are you trying to Deploy From Template but to Increase the Disk , if so a 
simple 

vm_disk:
  disk1:
size_gb: 10
type: thin
datastore: storage001

What is not supported is the decrease the disk size 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c679a37b-3281-4733-86e7-47b0f80ebb60%40googlegroups.com.


Re: [ansible-project] Re: Ansible Get vSphere Virtual Machines

2020-04-08 Thread David Foley

>
> Hi Gobi,


I was using that above, but it outputs all information,
I was trying to only output the guest_name with the with_item loop 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6a5bc48a-36ba-48db-8fc0-9e78af9beadd%40googlegroups.com.


[ansible-project] Re: Ansible Get vSphere Virtual Machines

2020-04-08 Thread David Foley

>
> Hi Gobi
>

that outputs the first on the Json List, how would i do a loop ?

i Tried with_items

 - debug:
msg: "{{ item.tags }}"
  with_items:
- "{{ vm_info.virtual_machines.guest_name }}"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9d2f330c-e546-45f0-b8c4-a34b4d0efafd%40googlegroups.com.


[ansible-project] Ansible Get vSphere Virtual Machines

2020-04-08 Thread David Foley
Hi All,

Trying to Output only the Virtual Machine Name: but having issues with the 
Json output

---
- name: Running Create Virtual Machine Playbook
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
  - name: Get VMs
vmware_vm_info:
  validate_certs: no
  hostname: 
  username: 
  password: 
  vm_type: vm
delegate_to: localhost
register: vminfo
  - debug:
  var: vminfo.virtual_machines.guest_name
  - local_action: copy content={{ vminfo.virtual_machines.guest_name }} 
dest=/srv/ansible/vmname.json
  



I'm currently getting the following Error:



TASK [debug] 
*
ok: [localhost] => {
"vminfo.virtual_machines.guest_name": "VARIABLE IS NOT DEFINED!"
}

This is the JSON output if i just do a var vminfo

{
  "failed": false, 
  "virtual_machines":
  [
{
  "guest_name": "", 
  "guest_fullname": "CentOS 7 (64-bit)", 
  "esxi_hostname": "e", 
  "tags": [],
   "cluster": "",
"vm_network": 
{
  "": 
  {
"ipv4": [""], 
"ipv6": []
}, 
"": 
{"ipv4": [""], 
  "ipv6": []}, 
  "": {"ipv4": [""], "ipv6": ["f"]}}, "mac_address": [""], 
"attributes": {}, "power_state": "poweredOn", "ip_address": "", "uuid": 
"4212ca75-8a0a-e9dc-95bc-3ee10ea6af11"
},


   {
"guest_name": "", "guest_fullname": "Microsoft Windows 8 (64-bit)", 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/218fea74-3de0-468f-a9d7-8ab73f826a6a%40googlegroups.com.


[ansible-project] Ansible with Windows Shared Folder

2020-03-31 Thread David Foley
Hi,

I'm trying to roll out Microsoft DSC Using the following Playbook to 
install the application

---
- name: 
  hosts: win
  gather_facts: false
  #connection: win
  tasks:
  - name: Install DSC
win_shell: 'Set-DscLocalConfigurationManager -Path \\\DSCSource\AA-DSC\DscMetaConfigs\Approved -Verbose -Force'


  - name: Run Pooling
win_shell: 'Update-DscConfiguration -Wait -Verbose'


  - name: Get DSC
win_shell: 'Get-DscConfigurationStatus -All'



I'm getting the following Error:: When i run it 

fatal: []: FAILED! => {"changed": true, "cmd": "powershell.exe 
-ExecutionPolicy Unrestricted Set-DscLocalConfigurationManager -Path 
\\DSCSource\\AA-DSC\\DscMetaConfigs\\Approved -Verbose 
-Force", "delta": "0:00:02.843573", "end": "2020-03-31 10:21:53.598630", 
"msg": "non-zero return code", "rc": 1, "start": "2020-03-31 
10:21:50.755056", "stderr": "Set-DscLocalConfigurationManager : \\\DSCSource\\AA-DSC\\DscMetaConfigs\\Approved is not a valid 
\r\ndirectory.\r\nAt line:1 char:1\r\n+ Set-DscLocalConfigurationManager 
-Path \\\DSC ...\r\n+ 
~\r\n   
 + CategoryInfo  : NotSpecified: (:) 
[Set-DscLocalConfigurationManager], ArgumentException\r\n+ 
FullyQualifiedErrorId : 
System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.SetDscL
 
\r\n   ocalConfigurationManagerCommand", "stderr_lines": 
["Set-DscLocalConfigurationManager 
: \\\DSCSource\\AA-DSC\\DscMetaConfigs\\Approved is not a 
valid ", "directory.", "At line:1 char:1", "+ 
Set-DscLocalConfigurationManager -Path \\\DSC ...", "+ 
~", "   
 + CategoryInfo  : NotSpecified: (:) 
[Set-DscLocalConfigurationManager], ArgumentException", "+ 
FullyQualifiedErrorId : 
System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.SetDscL
 
", "   ocalConfigurationManagerCommand"], "stdout": "", "stdout_lines": []}


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e944b06a-2b67-453a-83d8-2b17001a05e0%40googlegroups.com.


[ansible-project] Re: Weird Kerberos Issues with WinRM and a new host spun up from vmware_guest

2020-03-10 Thread David Foley
Did you Configure the WinRM ? for CredSSP ? 

  runonce:
- powershell.exe -ExecutionPolicy Unrestricted wget 
https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
 
-OutFile C:\Windows\Temp\ConfigureRemotingForAnsible.ps1
- powershell.exe -ExecutionPolicy Unrestricted -File 
C:\Windows\Temp\ConfigureRemotingForAnsible.ps1 -EnableCredSSP 
-DisableBasicAuth -Verbose


[win]
  SERVER_IP

  [win:vars]
  ansible_user=".\Administrator"
  ansible_password=
  ansible_connection=winrm
  ansible_winrm_transport=credssp
  ansible_winrm_server_cert_validation=ignore

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8f29eadc-4389-4cfd-b203-4e3b133c5293%40googlegroups.com.


Re: [ansible-project] Ansible Split JSON Return

2020-03-06 Thread David Foley


On Thursday, March 5, 2020 at 8:48:12 PM UTC, Kai Stian Olstad wrote:
>
> On 05.03.2020 15:52, David Foley wrote: 
> > Have the Following Playbook Which Returns the following 
> > 
> > ok: [localhost] => { 
> > "mdb.json": [ 
>
> The [ is telling us that mdb.json is a list, the fist element in a list 
> i 0. 
>
> > { 
> > "mac-address": "xx:xx:xx:xx:xx" 
> > } 
> > ] 
> > } 
>
>  
>
> >   - debug: 
> >   msg: "{{ mdb.json.split(':') }}" 
> > 
> > What i would like to Return is just 
> > 
> >  "msg":  "xx:xx:xx:xx:xx" 
>
> That would be {{ mdb.json.0['mac-address'] }} 
>
> because of the dash in mac-address you need to use [] notation and not 
> the dot notation on that one. 
>
>
> -- 
> Kai Stian Olstad 
>

Thanks Kai,

that worked i was also able to Split('-')[0] and that only outputted the 
xxx:xxx:xxx:xx just what i was looking for.  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6ada225d-044c-41d8-9def-a2add77d7b48%40googlegroups.com.


[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread David Foley
-
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Getting Mac Address 
uri: 
  url: http://.com 
  return_content: yes

register: mdb
  - debug:
  msg: "{{ mdb.json }}"


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c598fea5-0c18-44b4-a72e-8ffa20d402c8%40googlegroups.com.


[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread David Foley
When i do Both 

"{{ mdb.json.mac-address }}"
"{{ mdb.json.split(':')[1:6] | join(':') }}"

It returns 

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'list object' has no attribute 
'mac'\n\nThe error appears to be in '/srv/Ansible/mdb.yaml': line 8, column 
5, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\nregister: mdb\n  - 
debug:\n^ here\n"}

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'list object' has no attribute 
'split'\n\nThe error appears to be in '/srv/Ansible/mdb.yaml': line 8, 
column 5, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\nregister: mdb\n  - 
debug:\n^ here\n"}


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a32f963e-ae87-45ac-b930-0fbd78e46de6%40googlegroups.com.


[ansible-project] Ansible Split JSON Return

2020-03-05 Thread David Foley
Have the Following Playbook Which Returns the following

ok: [localhost] => {
"mdb.json": [
{
"mac-address": "xx:xx:xx:xx:xx"
}
]
}


--
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Getting Mac Address 
uri: url="http://.com?field=mac-address; return_content=yes
register: mdb
  - debug:
  msg: "{{ mdb.json.split(':') }}"

What i would like to Return is just 

 "msg":  "xx:xx:xx:xx:xx"

But Split doesn't seem to work 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bbc6205a-89fe-452d-ad71-ef72a3714e0a%40googlegroups.com.


[ansible-project] Re: How to use an IF Else Statement with Ansible Playbook

2020-02-21 Thread David Foley
So i have updated the Script as follows: 
 

> ---
> - hosts: localhost
>   gather_facts: false
>   tasks:
>   - vmware_guest_info:
>   hostname: 
>   username: 
>   password: 
>   validate_certs: no
>   datacenter: Test
>   name: Win10
>   schema: "vsphere"
>   properties: ["runtime.powerState"]
> delegate_to: localhost
> register: vminfo
>   - debug:
>   var: vminfo
>
>
>   - vmware_guest_powerstate:
>   validate_certs: no
>   hostname: 
>   username: 
>   password: 
>   name: Win10
>   state: powered-off
> delegate_to: localhost
> register: deploy
> when: vminfo['powerState'] == "poweredOn"
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ca1f7883-e732-42b0-ad81-b3e7cf6d1771%40googlegroups.com.


[ansible-project] Re: How to use an IF Else Statement with Ansible Playbook

2020-02-21 Thread David Foley

>
> HI Davide
>

 When i use 

when: vminfo["runtime.powerState"] == "poweredOn"

Im Getting 

fatal: [localhost]: FAILED! => {"msg": "The conditional check 
'vminfo[\"runtime.powerState\"] == \"poweredOn\"' failed. The error was: 
error while evaluating conditional (vminfo[\"runtime.powerState\"] == 
\"poweredOn\"): 'dict object' has no attribute 'runtime.powerState'\n\nThe 
error appears to be in '/srv/ansible/t.yaml': line 20, column 5, but 
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n\n  - vmware_guest_powerstate:\n^ 
here\n"}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/42f81a44-c1c7-46d1-8718-69dda22cb96f%40googlegroups.com.


[ansible-project] How to use an IF Else Statement with Ansible Playbook

2020-02-21 Thread David Foley
Hi,

Can Someone help with a IF Else Statment within Ansible.

If i Run a a GetStatus Playbook the Register: vminfo outputs the Following:


ok: [localhost] => {
"vminfo": {
"changed": false,
"failed": false,
"instance": {
"runtime": {
"powerState": "poweredOn"
}
}
}


What I'm trying to-do is place this into an if Else Statment
My play book is below


---
- name: Running Delete Virtual Machine playbook
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
- vmware_guest_info:
hostname: vctst01
username: 
password: 
validate_certs: no
datacenter: Test
name: Win10
schema: "vsphere"
properties: ["runtime.powerState"]
  delegate_to: localhost
  register: vminfo
- debug:
var: vminfo

{% if vminfo == 'poweredOff' %}

- name: Deleting
  vmware_guest:
hostname: vctst01
username:
password: 
validate_certs: no
cluster: Test
name: Win10
state: absent
  delegate_to: localhost
  register: facts

{% else %}
- name: Powering Down
  vmware_guest_powerstate::
validate_certs: no
hostname: vctst01
username: 
password: 
name: Win10
state: powered-off
  delegate_to: localhost
  register: deploy

- name: Deleting Machine
  vmware_guest:
hostname: vctst01
username: 
password: 
validate_certs: no
cluster: Test
name: Win10
state: absent
  delegate_to: localhost
  register: facts
{% endif % }

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/de617a22-2b8d-489e-a510-0042196dcf68%40googlegroups.com.


[ansible-project] Re: ansible ping failure to windows host

2020-02-20 Thread David Foley
Did you check your Firewall to make sure icmp is opened or allowed  ?
i'll create a simple playbook create new folder on the windows host for the 
connection i'll use ssh instead of WINRM since you have ssh installed 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8ba8186f-2725-448a-a4eb-ec5f18274b17%40googlegroups.com.


Re: [ansible-project] Ansible Create vSphere Virtual Machine

2020-02-17 Thread David Foley
Ok I'm using just / as the folder seems to be bypassing that now 

but not sure what could be causing the following:: fatal: [localhost -> 
localhost]: FAILED! => {"changed": false, "msg": "Failed to create a 
virtual machine : Unable to access the virtual machine configuration: 
Unable to access file [vsanDatastore] /win10-template.vmtx"}


On Monday, February 17, 2020 at 4:06:39 PM UTC, Dick Visser wrote:
>
> On Mon, 17 Feb 2020 at 16:53, Jorge Rúa > 
> wrote: 
> > 
> > Try with : 
> > folder: "{{ yourfolder | d ('/') }}" 
>
> For everyone else that is wondering what the 'd' filter is, it's an 
> alias for 'default'  :) 
>
>
> -- 
> Dick Visser 
> Trust & Identity Service Operations Manager 
> GÉANT 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/589fb946-7419-404d-a01d-b39e2eb79fde%40googlegroups.com.


[ansible-project] Re: Ansible Create vSphere Virtual Machine

2020-02-17 Thread David Foley

>
> When i Enter the virtualMachine Name _ Folder I'm getting the following 
>

 No Folder /TESTMACHINE match in search path.. 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/475056ee-60ad-4a4f-ab88-6bb6cf0b4d27%40googlegroups.com.


[ansible-project] Ansible Create vSphere Virtual Machine

2020-02-17 Thread David Foley
Ansible playbook fails to deploy Virtual Machine: Can't Find Folder 
How can I deploy a Virtual machine without any Folders within the Cluster ? 

---
- name: Running Create Virtual Machine Playbook
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
- name: Virtual Machine customization
  vmware_guest:
validate_certs: no
folder:  "{{ }}"
hostname: "{{ }}"
username:  "{{ }}"
password:  "{{ }}"
cluster :  "{{ }}"
customization_spec:  "{{ }}"
name:  "{{ }}"
template: "{{ }}"
state: poweredon
disk:
  - datastore:  "{{ }}"
networks:
- name:  "{{ }}"
  device_type: e1000e
customization:
  autologon: yes
hardware:
  memory_mb: 2048
  num_cpus: 1
  delegate_to: localhost
   # wait_for_ip_address: True

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fed0cb7e-644a-4344-a18c-01cf3a87beef%40googlegroups.com.