Re: [ansible-project] trying to parse a dict to add users: missing something easy...

2017-01-31 Thread Stankovic, Marko
Hi Dan, 1. If you use a quote at the start, you should close it only at the end. So this should work: when: "{{ item['status'] }} == 'enabled'" 2. In line above, you don't need {{ and thus quotes, when using when: 'always use {{ }} except when

Re: [ansible-project] How to use with_items loop with vmware_guest module

2017-01-31 Thread Stankovic, Marko
Hi Matti, You've created a dictionary instead of a list. Check this document: http://docs.ansible.com/ansible/YAMLSyntax.html The proper use of "with_items" needs a list like this: vmware_guest_disks: - size_gb: 20 datastore: datastore1 - size_gb: 1 datastore: datastore1 -

Re: [ansible-project] How to use with_items loop with vmware_guest module

2017-01-31 Thread Stankovic, Marko
Now I realized that you probably wanted to use with_dict instead of with_items. In that case, you would need the "value" part: http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-hashes Cheers, Marko

Re: [ansible-project] How to put period between two variables

2017-02-07 Thread Stankovic, Marko
You are looking for the "bracket notation", as described here: http://docs.ansible.com/ansible/playbooks_variables.html#what-makes-a-valid-variable-name So, this should work in your example: "{{ groups[item.host][0] }}" Cheers, Marko CONFIDENTIALITY NOTICE: This message is the property of

Re: [ansible-project] Re: when condition on a variable starting with a string value

2017-02-07 Thread Stankovic, Marko
I know this is weird, but can't think of something better: - set_fact: distrib: "{{ distribsrv }}" Directoryname: "{{ Directorysrv }}" when: dual | regex_replace( '^SRV.*', 'True') | bool Cheers, Marko CONFIDENTIALITY NOTICE: This message is the property of International Game

Re: [ansible-project] what is

2017-02-02 Thread Stankovic, Marko
If you check the original readme.md: https://github.com/bennojoy/mysql/blob/master/README.md You'll see there are real double quotes in places you see It looks like an escaping error within the Ansible Galaxy site to me. Cheers, Marko

Re: [ansible-project] default for undefined dict

2017-02-08 Thread Stankovic, Marko
Hi, Try with this: {% for instance in instances %} pgservice : {{ (instance['mgservices'] | default(default_mgservice))['name'] }} {% endfor %} Cheers, Marko CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain

Re: [ansible-project] how to use ansible galaxy roles

2017-02-03 Thread Stankovic, Marko
Hi, The problem is caused by using "bare" variable in "with_items" in line 7 and few more lines below: https://github.com/bennojoy/mysql/blob/master/tasks/main.yml#L7 This file is last updated on Nov 4, 2014 when this was allowed, but it's not anymore:

Re: [ansible-project] async fails after running vsphere_guest

2017-01-25 Thread Stankovic, Marko
Nearly the same, but you missed the fact that sleeper1 variable contains "result": "When using register with a loop, the data structure placed in the variable will contain a results attribute that is a list of all responses from the module."

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Stankovic, Marko
u'3' means that the value is a string (unicode). Try with: {{ array[int(item)]['contactId'] }} __ CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC

Re: [ansible-project] deployment notifications - for all cases - OK and failed.

2017-02-23 Thread Stankovic, Marko
Hi, Maybe Slack callback plugin would work better for you? Enable it by adding slack to the callback_whitelist in /etc/ansible/ansible.cfg http://docs.ansible.com/ansible/intro_configuration.html#callback-whitelist Here's documentation from the plugin itself:

Re: [ansible-project] lineinfile with serial is overwriting the data

2017-02-23 Thread Stankovic, Marko
Hi, The lineinfile documentation says: "Normally this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, sometimes systems are configured or just broken in ways that prevent this." http://docs.ansible.com/ansible/lineinfile_module.html But I

Re: [ansible-project] True or false debug msg

2017-02-17 Thread Stankovic, Marko
Hi, You can use jinja2 template: - debug: msg: "File {% if file_info.stat.exists %}exists{% else %}doesn't exist{% endif %}." More info: http://jinja.pocoo.org/docs/templates/ Cheers, Marko CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC

Re: [ansible-project] vars_prompt in Ansible

2017-02-09 Thread Stankovic, Marko
Hi, I'm not getting a syntax error with default: "{{ username }}" It works (the default value is assigned if no input), but the default value is not templated in the prompt. This is printed instead: Please enter group name for user: [{{ username }}]: I believe it's related to this issue:

Re: [ansible-project] Calling a dictionary based on an existing variable

2017-02-17 Thread Stankovic, Marko
Hi, How about having three files in vars directory (eg. pvs_vars.yml, stage_vars.yml, prod_vars.yml) with the same variable in it (ldapserver) and using include_vars module this way: - include_vars: "{{ env }}_vars.yml" More info: http://docs.ansible.com/ansible/include_vars_module.html

Re: [ansible-project] Create a Array of integer

2017-02-17 Thread Stankovic, Marko
Hi, I tested this (note the '|list' part at the point of variable usage, because I couldn't fit it in set_fact): --- - hosts: localhost tasks: - set_fact: uidRange: "[{% for index in range(50,60) %}'test{{ index }}',{% endfor %}]" - debug: var: uidRange|list And got this

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Stankovic, Marko
You're welcome. I just figured out we were scratching our right ear with left hand. The same result can be accomplished by using with_items: "{{ array }}" Then you can access the attributes by item.contactId and item.contactAccount: - set_fact: msg: "{{ item.contactId }}" with_items: "{{

Re: [ansible-project] Ansible script work with array

2017-01-20 Thread Stankovic, Marko
Sorry, I posted the solution without trying it. It's not int(item), but item | int(). So, this works for me: msg: "{{ array[item | int()]['contactId'] }}" __ CONFIDENTIALITY NOTICE: This message

Re: [ansible-project] How to use include_vars with "name=" in playbook?

2016-11-04 Thread Stankovic, Marko
Kai Stian Olstad is right. If you remove this part: shared: "{{ common }}" the user1 variable won't be undefined. Cheers, Marko __ CONFIDENTIALITY NOTICE: This message is the property of

Re: [ansible-project] Ansible Can not handle .tar.gz file and gives error

2016-12-09 Thread Stankovic, Marko
Hi Balu, If you did something like this: wget http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz then you've downloaded the html page saying you have to accept the OTN license terms. Can you check the filesize of the downloaded file? If your file is 100+MB then

Re: [ansible-project] MODULE FAILURE using Replace and with_together

2016-12-01 Thread Stankovic, Marko
I'm sorry, that was wrong solution. Cheers, Marko __ CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain

Re: [ansible-project] MODULE FAILURE using Replace and with_together

2016-12-01 Thread Stankovic, Marko
Hi, The last sed has an unescaped single quote. You should replace this: sed "s/'//g" with this: sed "s/"'"//g" That's a single quote surrounded by double quotes. Backslash won't work. You'll find some explanations here:

Re: [ansible-project] Ack! Color! Make it stop!

2016-12-07 Thread Stankovic, Marko
To do this forever, uncomment (or add) this line in /etc/ansible/ansible.cfg: nocolor = 1 Documentation: http://docs.ansible.com/ansible/intro_configuration.html#nocolor Cheers, Marko __

Re: [ansible-project] Re: with_items and register in a role/main.yml

2016-12-07 Thread Stankovic, Marko
Hi Stewart, First: including only "copy_release" tag makes ansible skip the first task, as it's tagged only with "copy_files". Second: you can also use with_filetree lookup (introduced in Ansible 2.2) or

Re: [ansible-project] Includes with limits and tags?

2017-03-03 Thread Stankovic, Marko
There's this feature request related to your question: https://github.com/ansible/ansible/issues/14117 Cheers, Marko CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret