[ansible-project] Re: ec2 host variables lost with refresh_inventory

2016-06-21 Thread Barry Kaplan
I am seeing similar behavior with 2.1. If I use refresh_inventory some of 
the hosts are removed and plays subsequently fail.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6640a5eb-5043-48ed-869f-f695bace959f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Build automation using ESXi, Ansible, Pysphere

2016-06-21 Thread Jason Hiatt
You only need the mapping for the distributed switches, this will not affect VM 
builds. There is a script that gets called at the end of the build process that 
changes the VMs network from the DHCP network to your desired network. If this 
step fails the VM will still get crested, it will just be on the wrong network. 
You will have to go into VCenter and manually change the VMs network. 

I'll write a script that gets the Morefs of your switches this week. 

> On Jun 21, 2016, at 01:36, Dibyendu Paul  wrote:
> 
> It is also not clear to me how do I map VMWare network and their Managed 
> Object Reference (MoRef)
> what are the information this should contain?
> {
> "192.168.1.0": "dvportgroup-123",
> "192.168.2.0": "dvportgroup-456"
> }
> how do I map 
> VirtualMachine-vm-*
> 
> HostSystem-host-*
> 
> Datastore-datastore-*
> 
> 
> 
> for example, I have a ESXI host, vCenter and 2 datastores.
> 
> 
> 
>> On Tuesday, 21 June 2016 08:50:12 UTC+5:30, Dibyendu Paul wrote:
>> Hi Jason 
>> Thank you.
>> Is there any way that a log rotation could be introduced for this project.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/Holm0CFBbLo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/b2265b23-0839-4574-b9cf-be616675b200%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/96EF1D45-F7F8-4572-8BAE-58965631EC90%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Build automation using ESXi, Ansible, Pysphere

2016-06-21 Thread Jason Hiatt
Please email me the yml file in the /var/www/html/builds directory 

> On Jun 21, 2016, at 21:03, Dibyendu Paul  wrote:
> 
> Mostly Ansible related logs.
> 
> It is also not clear to me how do I map VMWare network and their Managed 
> Object Reference (MoRef)
> what are the information this should contain?
> {
> "192.168.1.0": "dvportgroup-123",
> "192.168.2.0": "dvportgroup-456"
> }
> how do I map 
> VirtualMachine-vm-*
> 
> HostSystem-host-*
> 
> Datastore-datastore-*
> 
> 
> 
> for example, I have a ESXI host, vCenter and 2 datastores.
> 
> Basically I was not able to spin up a single VM yet. :(
> 
> 
>> On Wednesday, 22 June 2016 07:01:48 UTC+5:30, Jason Hiatt wrote:
>> Sure, which logs need rotated? 
>> 
>> > On Jun 20, 2016, at 22:20, Dibyendu Paul  wrote: 
>> > 
>> > Hi Jason 
>> > Thank you. 
>> > Is there any way that a log rotation could be introduced for this project. 
>> > 
>> > -- 
>> > You received this message because you are subscribed to a topic in the 
>> > Google Groups "Ansible Project" group. 
>> > To unsubscribe from this topic, visit 
>> > https://groups.google.com/d/topic/ansible-project/Holm0CFBbLo/unsubscribe. 
>> > To unsubscribe from this group and all its topics, send an email to 
>> > ansible-proje...@googlegroups.com. 
>> > To post to this group, send email to ansible...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/ansible-project/6aa3fe02-9827-437a-9bd3-6461ee252687%40googlegroups.com.
>> >  
>> > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/Holm0CFBbLo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/1cf87f3c-f12a-40f7-ae37-2af7ee641ccd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1EE43AEE-4097-411E-A5E2-E23398B8DC86%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Build automation using ESXi, Ansible, Pysphere

2016-06-21 Thread Jason Hiatt
Sure, which logs need rotated?

> On Jun 20, 2016, at 22:20, Dibyendu Paul  wrote:
> 
> Hi Jason 
> Thank you.
> Is there any way that a log rotation could be introduced for this project.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/Holm0CFBbLo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/6aa3fe02-9827-437a-9bd3-6461ee252687%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3387FD53-8F3D-43B9-80B9-DF4FD61E8F8D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-21 Thread Chun-Hung Huang
Hi James

Thanks :)
It works now

Very thanks for your help


Max

James Tanner於 2016年6月22日星期三 UTC+8上午3時07分49秒寫道:
>
> Your with_items line is indented too far. It should align with the first 
> letter of the word "name".
>
> On Tuesday, June 21, 2016 at 8:57:47 AM UTC-4, Chun-Hung Huang wrote:
>>
>> Hi Mark Matthews and ALL
>>
>> I meet the same problem with create Create multiple VMware guests with a 
>> Playbook.
>> Could your share / show your playbook with me?
>>
>> Or help me to fix my playbook?
>>
>> My playbook is
>>
>>
>> - name: Testing vsphere_guest module in VMware
>>   hosts: localhost
>>   connection: local
>>   vars_prompt:
>> - name: "vcenter_hostname"
>>   prompt: "Enter vcenter hostname"
>>   private: no
>>   default: "vcsa"
>> - name: "vcenter_user"
>>   prompt: "Enter vCenter username"
>>   private: no
>>   default: root
>> - name: "vcenter_pass"
>>   prompt: "Enter vcenter password"
>>   private: yes
>> - name: "esxi_hostname"
>>   prompt: "Enter esxi hostname"
>>   private: no
>>   tasks:
>> - name: Testing gater facts from vSphere
>>   vsphere_guest:
>> vcenter_hostname: "{{ vcenter_hostname }}"
>> validate_certs: no
>> username: "{{ vcenter_user }}"
>> password: "{{ vcenter_pass }}"
>> guest: "{{ item }}"
>> from_template: yes
>> template_src: openSUSELeap42.1_Template
>> esxi:
>>   datacenter: Lab
>>   hostname: "{{ esxi_hostname }}"
>> with_items:
>>   - server01
>>   - server02
>>
>>
>> Error message is
>>
>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "'item' is 
>> undefined"}
>>
>>
>> item is undefined.
>> But I already have with_items ??
>>
>>
>> Thanks
>>
>>
>> Max
>>
>> Mark Matthews於 2016年4月5日星期二 UTC+8下午11時16分15秒寫道:
>>>
>>> Hi guys
>>>
>>> Just to let you know, I just worked it out.
>>>
>>> I removed the following variable "serverlist: files/hostnames "
>>>
>>> And then changed the with_items to the following:
>>>
>>>   with_items:
>>> - ans_testserver01
>>> - ans_testserver02
>>>
>>> The playbook now creates both VMs (ans_testserver01 and 
>>> ans_testserver02) when it is run.
>>>
>>> I dont know if that is the correct way of doing it, but it seems to be 
>>> working for me.
>>>
>>>
>>>
>>> On Thursday, March 10, 2016 at 5:00:18 PM UTC, Mark Matthews wrote:

 Hi

 Is it at all possible to create multiple VMware VM's using an Ansible 
 playbook? Giving each VM a unique name (server1, server2, server3, 
 server4)?

 I can see anyway of doing this using the following playbooks, as it 
 keeps failing?

 ---
  - hosts: 127.0.0.1
connection: local
user: root
sudo: false
gather_facts: false
serial: 1
vars:
  vcenter_hostname: UK.server.local
  esxhost: xxx.xxx.xxx.xxx
  datastore: UK1
  network: Web
  vmcluster: UKCLUSTER
  guest_name: server1, server2, server3, server4 
  folder: Utilities
  notes: Created by Ansible

tasks:
 - name: Create VM from template
   vsphere_guest:
 vcenter_hostname: "{{ vcenter_hostname }}"
 username: "{{ username }}"
 password: "{{ password }}"
 guest: "{{ guest_name }}"
 vm_extra_config:
   notes: "{{ notes }}"
   folder: "{{ folder }}"
 from_template: yes
 template_src: "{{ vmtemplate }}"
 cluster: "{{ vmcluster  }}"
 resource_pool: "/Resources"
 
 esxi:
   datacenter: UK
   hostname: "{{ esxhost }}"

 Any ideas or suggestions would be really appreciated.

 Cheers



-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d891a706-5144-405c-b50f-ee6172c5e772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Docker container fails to reload

2016-06-21 Thread Guy Knights
Hi Johannes,

It's a git clone of the stable-2.1 branch. I recently (like, today) did a 
'git pull' in addition to 'git submodule update --recursive' and tried 
again, still got the same error.

I just tried switching back to the stable-2.0.0.1 branch and it seems to be 
working fine, so it appears to be a specific 2.1 issue.

Thanks,
Guy

On Thursday, June 2, 2016 at 1:31:56 AM UTC-7, Johannes Kastl wrote:
>
> On 31.05.16 21:23 Guy Knights wrote: 
>
> > I only started getting this recently after I started using ansible 2.1. 
> The 
> > docker task in question hasn't been modified in a long time, and if I 
> > manually remove the container from the host and re-run the playbook, it 
> > starts the container ok. 
>
> How did you install ansible 2.1? Recently there was an error because 
> some git submodules were not up to date and caused problems... 
>
> Johannes 
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/25c89602-1d8a-4ecc-b148-7f90bfd54bd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-21 Thread Kenny Evitt
I'm trying to run a (PowerShell) script with a path in its name:

```
- name: Run a script
  script: '"./files/name of a script.ps1" -Param1 {{ variable_name }}'
```

The above is only the latest attempting at quoting/escaping I've tried. 
Regardless, I get an error like this when I run the playbook containing the 
above task:

```
TASK [Run a script] *
task path: /etc/ansible/playbook.yml:38
<192.168.200.245> ESTABLISH WINRM CONNECTION FOR USER: 
SOME-HOST\Administrator on PORT 5986 TO 192.168.200.245
<192.168.200.245> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name 
"ansible-tmp-1466538051.8-95578181041077").FullName | Write-Host -Separator 
'';
<192.168.200.245> PUT "/etc/ansible/"./files/name\" TO 
"C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1466537998.0-243829631467080\name"
fatal: [some-host]: FAILED! => {"failed": true, "msg": "file or module does 
not exist: \"/etc/ansible/\"./files/name\\\""}

```

Any ideas?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c47b22ba-2d85-47c7-a0b3-c0028e5242dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Module for managing comment delimited sections in configuration files?

2016-06-21 Thread Alan Langford
I have a couple of situations where there are informal sections in a 
configuration file that are delimited by comments, and I'd like to update 
these with Ansible. Is there a module for this?

For example, the file some.cfg looks like this:

# this is the some.cfg file
var1=1
var2=2

# some section start
svar1=1
svar2=2
# some section end

var3=3

I want to be able to replace the variables delimited by "some section 
start" and "some section end". This is complicated by the fact that the 
delimiters are created ad-hoc by application developers, so there's no 
consistent syntax.

I can't assemble the file from components because users can take actions 
that cause the file to change, so there's no master copy.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a3d14f29-d679-4ade-b1f0-a6025717e2d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-21 Thread James Tanner
Your with_items line is indented too far. It should align with the first 
letter of the word "name".

On Tuesday, June 21, 2016 at 8:57:47 AM UTC-4, Chun-Hung Huang wrote:
>
> Hi Mark Matthews and ALL
>
> I meet the same problem with create Create multiple VMware guests with a 
> Playbook.
> Could your share / show your playbook with me?
>
> Or help me to fix my playbook?
>
> My playbook is
>
>
> - name: Testing vsphere_guest module in VMware
>   hosts: localhost
>   connection: local
>   vars_prompt:
> - name: "vcenter_hostname"
>   prompt: "Enter vcenter hostname"
>   private: no
>   default: "vcsa"
> - name: "vcenter_user"
>   prompt: "Enter vCenter username"
>   private: no
>   default: root
> - name: "vcenter_pass"
>   prompt: "Enter vcenter password"
>   private: yes
> - name: "esxi_hostname"
>   prompt: "Enter esxi hostname"
>   private: no
>   tasks:
> - name: Testing gater facts from vSphere
>   vsphere_guest:
> vcenter_hostname: "{{ vcenter_hostname }}"
> validate_certs: no
> username: "{{ vcenter_user }}"
> password: "{{ vcenter_pass }}"
> guest: "{{ item }}"
> from_template: yes
> template_src: openSUSELeap42.1_Template
> esxi:
>   datacenter: Lab
>   hostname: "{{ esxi_hostname }}"
> with_items:
>   - server01
>   - server02
>
>
> Error message is
>
> fatal: [localhost]: FAILED! => {"failed": true, "msg": "'item' is 
> undefined"}
>
>
> item is undefined.
> But I already have with_items ??
>
>
> Thanks
>
>
> Max
>
> Mark Matthews於 2016年4月5日星期二 UTC+8下午11時16分15秒寫道:
>>
>> Hi guys
>>
>> Just to let you know, I just worked it out.
>>
>> I removed the following variable "serverlist: files/hostnames "
>>
>> And then changed the with_items to the following:
>>
>>   with_items:
>> - ans_testserver01
>> - ans_testserver02
>>
>> The playbook now creates both VMs (ans_testserver01 and ans_testserver02) 
>> when it is run.
>>
>> I dont know if that is the correct way of doing it, but it seems to be 
>> working for me.
>>
>>
>>
>> On Thursday, March 10, 2016 at 5:00:18 PM UTC, Mark Matthews wrote:
>>>
>>> Hi
>>>
>>> Is it at all possible to create multiple VMware VM's using an Ansible 
>>> playbook? Giving each VM a unique name (server1, server2, server3, server4)?
>>>
>>> I can see anyway of doing this using the following playbooks, as it 
>>> keeps failing?
>>>
>>> ---
>>>  - hosts: 127.0.0.1
>>>connection: local
>>>user: root
>>>sudo: false
>>>gather_facts: false
>>>serial: 1
>>>vars:
>>>  vcenter_hostname: UK.server.local
>>>  esxhost: xxx.xxx.xxx.xxx
>>>  datastore: UK1
>>>  network: Web
>>>  vmcluster: UKCLUSTER
>>>  guest_name: server1, server2, server3, server4 
>>>  folder: Utilities
>>>  notes: Created by Ansible
>>>
>>>tasks:
>>> - name: Create VM from template
>>>   vsphere_guest:
>>> vcenter_hostname: "{{ vcenter_hostname }}"
>>> username: "{{ username }}"
>>> password: "{{ password }}"
>>> guest: "{{ guest_name }}"
>>> vm_extra_config:
>>>   notes: "{{ notes }}"
>>>   folder: "{{ folder }}"
>>> from_template: yes
>>> template_src: "{{ vmtemplate }}"
>>> cluster: "{{ vmcluster  }}"
>>> resource_pool: "/Resources"
>>> 
>>> esxi:
>>>   datacenter: UK
>>>   hostname: "{{ esxhost }}"
>>>
>>> Any ideas or suggestions would be really appreciated.
>>>
>>> Cheers
>>>
>>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4169ebf8-9663-4278-9141-390ade20b887%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Bootstrap Ansible Master in EC2 ?

2016-06-21 Thread Jeremy Young
I'd use Packer  to create an AMI that includes 
any prerequisites that you need and use IAM to give the instance that your 
provision from that AMI the permissions that it needs for other AWS API 
calls.  Your instance should use an IAM Instance profile, not access key 
and secret key.

On Tuesday, June 21, 2016 at 6:12:32 AM UTC-5, Matthew Kettlewell wrote:
>
> Hello - 
>
> I've been trying to wrap my head around the best approach to bootstrapping 
> and provisioning an Ansible master node in ec2, and let it provision the 
> rest of the network from inside ec2 ( vs controlling things from my laptop )
>
> I think I understand most of it, but what I'm not real sure on, is the 
> best approach to handling the various secure credentials.
>
> My laptop would have it's own set of AWS credentials, and then the 
> bootstrapped Ansible master would have it's own as well... what's the best 
> way to securely transfer that?  is Ansible vault the correct approach here?
>
>
> I'm kind of surprised that I'm not finding a lot of examples on Github, 
> which leads me to believe I'm trying to create an anti-pattern of some 
> sort, so thought I'd ping the group and see what approaches you might have 
> for bootstrapping and provisioning and Ansible master withing AWS.
>
>
> Any tips, blog posts or github examples would be warmly welcome.
>
>
>
> Thanks
>
> Matt
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/aa4ca7b6-c8dd-455b-9c8c-0d57437473ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Unsure how to merge this dict/list into a single dict/list

2016-06-21 Thread Mike Biancaniello
It sounds like you are looking to do something like this:

https://github.com/chepazzo/ansible-filters-extras/blob/master/filter_plugins/listofdicts.py#L121

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0a661556-aa7f-4ee2-9676-49373836f16e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-21 Thread Christoph Wegener
The section about roles in the 'Ansible: Up and Running' book covers this 
topic quite well.
The recommendation in the book is to always prefix var names inside the 
role with the name of the role, which I believe is for the exact reason of 
avoiding the scenario that you ran into.



On Friday, June 17, 2016 at 6:53:11 AM UTC+10, Trond Hindenes wrote:
>
> I managed to at least get around the error:
> The trick is to use "internal" variables inside the role which never get 
> set outside the role. So if I have 2 "external" vars where the role wiill 
> set some 3rd variable depending on those two, the trick is to not re-use 
> the name of one of the two "external" ones. I've posted a working example 
> of this here:
>
>
> https://drive.google.com/file/d/0B81YECbGAyfWaW5rbVRQNlpQT2c/view?usp=sharing
>
> It's a little bit of extra work really having to watch out for this but at 
> least I got it working. I'd still consider it a bug tho.
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5f50082c-6c13-4310-96fc-ddb45c6ebd16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Variables from another server

2016-06-21 Thread Josh Smift
http://docs.ansible.com/ansible/playbooks_variables.html has some more
docs about this too.

  -Josh (j...@care.com)

(apologies for the automatic corporate disclaimer that follows)




This email is intended for the person(s) to whom it is addressed and may 
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, 
distribution, copying, or disclosure by any person other than the addressee(s) 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email and delete the message and any 
attachments from your system.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/22377.20950.534728.187242%40gargle.gargle.HOWL.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Variables from another server

2016-06-21 Thread Josh Smift
AS> If I dump hostvars, I can see the information I want does exist, I
AS> just can't convince Google to show me an example to follow.

In general, you want something like

  hostvars['server1']['ansible_ssh_host']

for the ansible_ssh_host variable on the host 'server1'; or, if the target
hostname is in a variable called 'host', something like

  hostvars[host]['ansible_ssh_host']

or whatever.

  -Josh (j...@care.com)

(apologies for the automatic corporate disclaimer that follows)




This email is intended for the person(s) to whom it is addressed and may 
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, 
distribution, copying, or disclosure by any person other than the addressee(s) 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email and delete the message and any 
attachments from your system.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/22377.20874.957961.412309%40gargle.gargle.HOWL.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible raw module & Cisco WLC

2016-06-21 Thread Christoph Wegener
I think you are correct.

Here's a slightly related thread on this topic:
http://stackoverflow.com/questions/24762108/logging-into-a-cisco-wireless-controller-via-ssh

On Tuesday, June 14, 2016 at 8:35:03 PM UTC+10, David Vávra wrote:
>
> I believe that authentication based on RSA key-pair cannot be used with 
> Cisco WLC firmware. Or can be?
>
> 2016-06-14 12:27 GMT+02:00 Christoph Wegener  >:
>
>> Have you tried using RSA key pairs instead of username/password?
>>
>> On Tuesday, June 14, 2016 at 6:39:43 PM UTC+10, David Vávra wrote:
>>>
>>> Hi, have anyone been succesful with at least logging in to Cisco WLC 
>>> device with Ansible? I'm not able to make it work, most probably because of 
>>> extra (nonstandard) prompt for User: 
>>>
>>> (Cisco Controller)
>>> User: xxx
>>> Password:**
>>> (Cisco Controller) >
>>>
>>> Thanks for any advice on this.
>>>
>>> --
>>> DV
>>>
>>>
>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/ansible-project/xpHZ7JFEhw4/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> ansible-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/c847dffd-6f4c-49a7-813f-e5f652763cfc%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5590c574-addd-4709-b2da-f8b860eabcbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Variables from another server

2016-06-21 Thread Anthony Sheetz
The challenge isn't finding facts about the current server the playbook is 
running on. It's using facts about another server in the current playbook. 
I've already collected the facts I need - I just need to know how to access 
facts from another server for use on the current server.

On Tuesday, June 21, 2016 at 6:56:28 AM UTC-4, Matthew Kettlewell wrote:
>
> Would ec2_facts or ec2_remote_facts do what you're looking for?
>
> http://docs.ansible.com/ansible/ec2_remote_facts_module.html
> http://docs.ansible.com/ansible/ec2_facts_module.html
>
>
>
> On Monday, June 20, 2016 at 2:04:53 PM UTC-5, Anthony Sheetz wrote:
>>
>> I need to access information discovered from another server for a 
>> template on the server I'm configuring.
>>
>> We are using AWS, and I'm of course using ec2.py to discover my hosts. I 
>> first configure a utility server, and then configure my web servers. I tag 
>> the utility server with an appropriate Name, and then in my web server 
>> configuration playbook I include a bit to discover facts about the utility 
>> server using appropriate tags. How do I then reference the facts about the 
>> utility server in the templates for the web server?
>>
>> If I dump hostvars, I can see the information I want does exist, I just 
>> can't convince Google to show me an example to follow.
>>
>> Here's an example playbook which DOES NOT work, but does illustrate the 
>> context:
>>
>> ---
>>>
>>> # Called like: ansible-playbook -i ./ec2.py --extra-vars "chaos=test" 
 aws_playground.yaml
>>>
>>> - name: Collect our facts on bc-util
>>>
>>>   hosts: "tag_Name_{{ chaos }}_bc_util"
>>>
>>>   tasks:
>>>
>>>   - debug: var=ansible_all_ipv4_addresses
>>>
>>>  
>>
>>> - name: Set up a bc-web server
>>>
>>>   hosts: "tag_Name_{{ chaos }}_bc_web"
>>>
>>>   become: yes
>>>
>>>   become_user: root
>>>
>>>   remote_user: admin
>>>
>>>   tasks:
>>>
>>>   - debug: msg="{{ hostvars }}"
>>>
>>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a8c77ef1-c804-4b1a-8cef-bd6528b5572c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Create a VM from a virtual disk file (vmdk)

2016-06-21 Thread 'sterlij1' via Ansible Project
Hi All,

I've been given a vmdk file from a vendor and can successfully create a 
custom VM using my vsphere client manually by clicking through the 'custom' 
steps and pointing to the vmdk file.

In all the ansible documentation and examples I've seen people point to a 
cd image (iso). Is there a way to get ansible to use vmdk file without the 
need to use a templated VM?

I'm using ansible 1.9.4

Regards

sterlij1

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1e501c27-7de0-46d1-846b-e57ba2e24a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-21 Thread Chun-Hung Huang
Hi Mark Matthews and ALL

I meet the same problem with create Create multiple VMware guests with a 
Playbook.
Could your share / show your playbook with me?

Or help me to fix my playbook?

My playbook is


- name: Testing vsphere_guest module in VMware
  hosts: localhost
  connection: local
  vars_prompt:
- name: "vcenter_hostname"
  prompt: "Enter vcenter hostname"
  private: no
  default: "vcsa"
- name: "vcenter_user"
  prompt: "Enter vCenter username"
  private: no
  default: root
- name: "vcenter_pass"
  prompt: "Enter vcenter password"
  private: yes
- name: "esxi_hostname"
  prompt: "Enter esxi hostname"
  private: no
  tasks:
- name: Testing gater facts from vSphere
  vsphere_guest:
vcenter_hostname: "{{ vcenter_hostname }}"
validate_certs: no
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
guest: "{{ item }}"
from_template: yes
template_src: openSUSELeap42.1_Template
esxi:
  datacenter: Lab
  hostname: "{{ esxi_hostname }}"
with_items:
  - server01
  - server02


Error message is

fatal: [localhost]: FAILED! => {"failed": true, "msg": "'item' is 
undefined"}


item is undefined.
But I already have with_items ??


Thanks


Max

Mark Matthews於 2016年4月5日星期二 UTC+8下午11時16分15秒寫道:
>
> Hi guys
>
> Just to let you know, I just worked it out.
>
> I removed the following variable "serverlist: files/hostnames "
>
> And then changed the with_items to the following:
>
>   with_items:
> - ans_testserver01
> - ans_testserver02
>
> The playbook now creates both VMs (ans_testserver01 and ans_testserver02) 
> when it is run.
>
> I dont know if that is the correct way of doing it, but it seems to be 
> working for me.
>
>
>
> On Thursday, March 10, 2016 at 5:00:18 PM UTC, Mark Matthews wrote:
>>
>> Hi
>>
>> Is it at all possible to create multiple VMware VM's using an Ansible 
>> playbook? Giving each VM a unique name (server1, server2, server3, server4)?
>>
>> I can see anyway of doing this using the following playbooks, as it keeps 
>> failing?
>>
>> ---
>>  - hosts: 127.0.0.1
>>connection: local
>>user: root
>>sudo: false
>>gather_facts: false
>>serial: 1
>>vars:
>>  vcenter_hostname: UK.server.local
>>  esxhost: xxx.xxx.xxx.xxx
>>  datastore: UK1
>>  network: Web
>>  vmcluster: UKCLUSTER
>>  guest_name: server1, server2, server3, server4 
>>  folder: Utilities
>>  notes: Created by Ansible
>>
>>tasks:
>> - name: Create VM from template
>>   vsphere_guest:
>> vcenter_hostname: "{{ vcenter_hostname }}"
>> username: "{{ username }}"
>> password: "{{ password }}"
>> guest: "{{ guest_name }}"
>> vm_extra_config:
>>   notes: "{{ notes }}"
>>   folder: "{{ folder }}"
>> from_template: yes
>> template_src: "{{ vmtemplate }}"
>> cluster: "{{ vmcluster  }}"
>> resource_pool: "/Resources"
>> 
>> esxi:
>>   datacenter: UK
>>   hostname: "{{ esxhost }}"
>>
>> Any ideas or suggestions would be really appreciated.
>>
>> Cheers
>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/611c0fa0-e272-47c2-bcdc-d6bd3cbb86fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Bootstrap Ansible Master in EC2 ?

2016-06-21 Thread Matthew Kettlewell
Hello - 

I've been trying to wrap my head around the best approach to bootstrapping 
and provisioning an Ansible master node in ec2, and let it provision the 
rest of the network from inside ec2 ( vs controlling things from my laptop )

I think I understand most of it, but what I'm not real sure on, is the best 
approach to handling the various secure credentials.

My laptop would have it's own set of AWS credentials, and then the 
bootstrapped Ansible master would have it's own as well... what's the best 
way to securely transfer that?  is Ansible vault the correct approach here?


I'm kind of surprised that I'm not finding a lot of examples on Github, 
which leads me to believe I'm trying to create an anti-pattern of some 
sort, so thought I'd ping the group and see what approaches you might have 
for bootstrapping and provisioning and Ansible master withing AWS.


Any tips, blog posts or github examples would be warmly welcome.



Thanks

Matt


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/178f11c7-a2b2-4cdb-a9e7-bb84d05d32a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Variables from another server

2016-06-21 Thread Matthew Kettlewell
Would ec2_facts or ec2_remote_facts do what you're looking for?

http://docs.ansible.com/ansible/ec2_remote_facts_module.html
http://docs.ansible.com/ansible/ec2_facts_module.html



On Monday, June 20, 2016 at 2:04:53 PM UTC-5, Anthony Sheetz wrote:
>
> I need to access information discovered from another server for a template 
> on the server I'm configuring.
>
> We are using AWS, and I'm of course using ec2.py to discover my hosts. I 
> first configure a utility server, and then configure my web servers. I tag 
> the utility server with an appropriate Name, and then in my web server 
> configuration playbook I include a bit to discover facts about the utility 
> server using appropriate tags. How do I then reference the facts about the 
> utility server in the templates for the web server?
>
> If I dump hostvars, I can see the information I want does exist, I just 
> can't convince Google to show me an example to follow.
>
> Here's an example playbook which DOES NOT work, but does illustrate the 
> context:
>
> ---
>>
>> # Called like: ansible-playbook -i ./ec2.py --extra-vars "chaos=test" 
>>> aws_playground.yaml
>>
>> - name: Collect our facts on bc-util
>>
>>   hosts: "tag_Name_{{ chaos }}_bc_util"
>>
>>   tasks:
>>
>>   - debug: var=ansible_all_ipv4_addresses
>>
>>  
>
>> - name: Set up a bc-web server
>>
>>   hosts: "tag_Name_{{ chaos }}_bc_web"
>>
>>   become: yes
>>
>>   become_user: root
>>
>>   remote_user: admin
>>
>>   tasks:
>>
>>   - debug: msg="{{ hostvars }}"
>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ab05d0fb-9391-4e5f-b5f3-ab3db392f780%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Include many vars in one go

2016-06-21 Thread 'James Morgan' via Ansible Project
Hi,

Is it possible to load many files in one go? In a similar way to the yum 
module?

My issue is that I have ~80 application files that I load from vars.

  pre_tasks:
- name: Load default application config
  include_vars: "{{ item }}"
  with_fileglob: "{{ playbook_dir }}/vars/app_default-*.yml"
  no_log: True

When I do this with large inventories of 100's of boxes it logs a line for 
every include which is a lot.

I would prefer if I could load all in one go per host.

I have added no_log: True to reduce the noise but its still pretty noisey

Many thanks

James

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd9be5cb-ddf8-4eca-b694-2e2d7076d5fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Build automation using ESXi, Ansible, Pysphere

2016-06-21 Thread Dibyendu Paul
It is also not clear to me how do I map VMWare network and their Managed 
Object Reference (MoRef)
what are the information this should contain?
{
"192.168.1.0": "dvportgroup-123",
"192.168.2.0": "dvportgroup-456"
}
how do I map 

VirtualMachine-*vm-**

HostSystem-*host-**

Datastore-*datastore-**


for example, I have a ESXI host, vCenter and 2 datastores.


On Tuesday, 21 June 2016 08:50:12 UTC+5:30, Dibyendu Paul wrote:
>
> Hi Jason 
> Thank you.
> Is there any way that a log rotation could be introduced for this project.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b2265b23-0839-4574-b9cf-be616675b200%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.