News for hackers. Stuff that matters.
Re:Ansible 2.0 released by Spivak on Tuesday January 12, 2016 @04:43PM (#10890628)
You're talking about eliminating duplicates in a list right?

    my_list | unique
I think this is what you're looking for. Any transformation of data that can't be done with the standard filters can be done with a simple filter plugin written in python.
Re:Ansible 2.0 released by davexunit on Tuesday January 12, 2016 @05:30PM (#10890900)
>You're talking about eliminating duplicates in a list right?

No, I'm talking about any atbitrary list processing operation. Some combination of map, fold, and filter, for example.

So, in order to do that in an Ansible playbook, I need to write a Python function to do it and use it in the YAML file as a filter because the DSL isn't expressive enough to do it on its own. So... why wouldn't I want to just use Python again?

Re:Ansible 2.0 released by hakutsuru on Wednesday January 13, 2016 @03:36PM (#10897283)
I feel as though I do process lists via ansible. You could be less abstract and provide code. Otherwise, it is hard to take this complaint seriously.

Here we install Jenkins jobs....

  - name: create the job config.xml files
    sudo: true
    template:
      src={{ item }}
      dest={{ conf_jenkins_home }}/jobs/{{ item | basename | replace(".xml.j2", "") }}/config.xml
      owner=jenkins
      group=jenkins
      mode=0600
    with_fileglob:
      - ../templates/jobs/*
    notify: restart Jenkins

And install SonarQube plugins...

  - name: install sonar plugins
    sudo: true
    get_url:
      url={{ item.value.url }}
      dest=/opt/sonarqube/extensions/plugins
      owner={{ ansible_ssh_user }}
      group={{ ansible_ssh_user }}
      mode=0755
    with_dict: "{{ sonarqube_plugins }}"