Re: [ansible-project] --skip-tags equivalent inside playbooks

2019-02-02 Thread Igor Cicimov
Kai, why would I use vars when I already have tags on my tasks which purpose, and only purpose, is filtering during execution? Also as I said back in 2015 https://groups.google.com/d/msg/ansible-project/WimzDEJLHJc/9U10Yjb4CQAJ it is hard to retrofit variables into hundreds of playbooks you

Re: [ansible-project] Ansible but with Python instead of YAML

2019-02-02 Thread Stuart Longland
On 1/2/19 11:07 pm, Thomas Güttler wrote: > I know how to create dicts, lists, strings, multiline-strings with > python. The syntax is easy and simple. > > I am lazy. I just don't know why I should learn a new language. It's not a language, it's a serialisation format like JSON, it's a superset

[ansible-project] Re: loop over dict2items

2019-02-02 Thread fusillator
I figure out that the problem was related to the variable name (tags) the name tags is also used for the special attribute tags useful for filtering tasks to be executed. Anyway changing the snippet using mytags instead of tags solves the error. - hosts: localhost tasks: - name: create a

[ansible-project] loop over dict2items

2019-02-02 Thread fusillator
Hi all, trying the following playbook taken from user_guide/playbooks_loops.html - hosts: localhost tasks: - name: create a tag dictionary of non-empty tags set_fact: tags_dict: "{{ (tags_dict|default({}))|combine({item.key: item.value}) }}" loop: "{{ tags|dict2items }}"

[ansible-project] Re: Does Ansible prevent 2 Tasks from modifying the same part of a system?(thus, Task 2 undoing what Task 1 did)

2019-02-02 Thread Sylvain Martel
Hi, thanks for the reply. What you describe will help a bit, but is not error proof when you have thousands of line of code(and any infrastructure will reach that point quickly). Human make mistake, or are lazy, so eventually, 2 pieces of code that change the same setting will happen. One

Re: [ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-02-02 Thread Kai Stian Olstad
On 29.01.2019 23:44, John Harmon wrote: Figured it out. I just call the variable with nothing else: - name: "Find the user_id for {{ user }}" set_fact: uid: "{{ (userinfo.json.users|selectattr('username','match',MYVAR)|list|first).user_id }}" Using ignore_errors is a bad

Re: [ansible-project] Does Ansible prevent 2 Tasks from modifying the same part of a system?(thus, Task 2 undoing what Task 1 did)

2019-02-02 Thread Kai Stian Olstad
On 25.01.2019 15:23, Sylvain Martel wrote: Hi, We are new to using ansible, and I saw something while going through our early code that had me worried. I have CoderA and CoderB that are starting to create roles and tasks. In one Task, coderA adds IIS features, but coderB, in another

Re: [ansible-project] Access specific elements using with_items / with_subelememts

2019-02-02 Thread Kai Stian Olstad
On 29.01.2019 15:11, Saranya N wrote: Hi Kai , M getting below error and I wonder why :( Can't parse arg end=u'3\xa0stride=2' as integer . You have gotten some strange character in there, delete it and write it again. Also please help me understand this, My first app is parent of

Re: [ansible-project] Access specific elements using with_items / with_subelememts

2019-02-02 Thread Kai Stian Olstad
On 29.01.2019 13:52, Saranya N wrote: I Hi Kai , I think this will make my 3rd app parent of 4th n so on.. I don't want that. First is parent of second. Second is parent of remaining all apps. Just split it on two task with different with_sequences -- Kai Stian Olstad -- You received

Re: [ansible-project] --skip-tags equivalent inside playbooks

2019-02-02 Thread Kai Stian Olstad
On 02.02.2019 05:39, Igor Cicimov wrote: Brian, I find the current usage of "tags" when calling a role via "roles:" or "include_role/import_role" is counter intuitive. The reason we tag tasks in our playbooks is for the purpose of filtering which we would expect to be the case in the above

Re: [ansible-project] Re: Issue with vmware_guest_snapshot module

2019-02-02 Thread Jörg Kastning
Hello Richard, although this thread is somewhat old I hope you are still reading here and have some advise for me, because I'm going to accomplish the same task. I'll have some virtual machines in my vSphere environment which I like to: 1. Take a snapshot and if successful 2. Run task