[ansible-project] Re: Including vars_files based on a condition is getting failed

2018-11-11 Thread dan
I noticed that you ARE sending the "-e components=xyz" on the command line. Please ignore my other response - Google Groups isn't letting me delete it. On Saturday, November 10, 2018 at 11:00:03 PM UTC-6, anushake...@gmail.com wrote: > > Hi All, > > > I am trying to include vars_Files based

[ansible-project] Set hosts value with an extra-vars doesn't work for my Ansible role

2018-11-11 Thread Dylan Osef
I've got a problem with my ansible playbook : *My playbook is composed of 5 roles and looks like this :* --- - name: Création de la machine virtuelle {{ Host_Name }} à l'aide du template {{ vcenter_template }} hosts: localhost gather_facts: no roles: - roles/VMWare/deploy tags:

[ansible-project] Re: Including vars_files based on a condition is getting failed

2018-11-11 Thread dan
The error message states that "'components' is undefined", so assuming "components" are conditionally defined earlier, you'll have to put in another "when" clause to validate it is defined. Something like this: pre_tasks: - include_vars: /etc/ansible/anusha/hr/vars/main.yml

[ansible-project] Re: Including vars_files based on a condition is getting failed

2018-11-11 Thread anushakeshipeddy4
Thank you, that worked for me :) On Sunday, November 11, 2018 at 11:46:30 PM UTC+5:30, d...@linder.org wrote: > > You will need to place quotation marks around the value you're comparing > to if it is a string. > > This is what worked for me: > > - include_vars:

[ansible-project] Re: concatenate string with all list items

2018-11-11 Thread Theo Ouzhinski
You can use a filter to concatenate a string from a list. For example, "{{ my_list | join(' ') }}" You can read more about filters here . Theo On Friday, November 9, 2018 at 3:40:48 AM UTC-5, Fatima Elfakih

Re: [ansible-project] VMware dvs portgroup

2018-11-11 Thread Eino Tuominen
Hi Barry, Ansible 2.7 has subelements filter, which makes this rather easy. Given your second struct: vars: vmds: - vlanid: vlan1 vlan: 1 dvs: - DSwitch1 - DSwitch2 numports: 128 - vlanid: vlan2 vlan: 2 dvs: -

[ansible-project] Re: "/bin/sh: 1: powershell: not found\n"

2018-11-11 Thread Jordan Borean
There are a few things wrong with that inventory - Change the ansible_ssh_* variables to just ansible_*, e.g. ansible_ssh_port becomes ansible_port and so on - You are defining ansible_connection=winrm on the group but then override that with ansible_connection=local on the host

[ansible-project] Re: Including vars_files based on a condition is getting failed

2018-11-11 Thread dan
You will need to place quotation marks around the value you're comparing to if it is a string. This is what worked for me: - include_vars: /etc/ansible/anusha/hr/vars/main.yml when: components == "xyz" On Saturday, November 10, 2018 at 11:00:03 PM UTC-6, anushake...@gmail.com