[ansible-project] How to keep the content returned by uri from being printed in the console?

2014-07-09 Thread Behrang Saeedzadeh
Hi all, Is there a way to stop Ansible from printing the content returned from a uri in the console and have return_content=true? Thanks in advance, Behrang -- You received this message because you are subscribed to the Google Groups Ansible Project group. To unsubscribe from this group and

[ansible-project] Including timestamps in PLAY [host] *** messages

2014-08-19 Thread Behrang Saeedzadeh
Hi all, Is there a way to include timestamps in the playbook and task header messages: PLAY [hostname] [2014-08-20 16:54:22] ** ... TASK: [Prepare users] [2014-08-20 16:54:23]

[ansible-project] Support looking up binary files as HTTP-based APIs are increasingly supporting uploading of BASE64 encoded binaries in JSON documents.

2017-09-19 Thread Behrang Saeedzadeh
Hi, This is in regards to #11594 . Many APIs these days allow embedding BASE64 encoded binary data in JSON documents. Here's an example from Databricks, wherein the "content" field

Re: [ansible-project] Is there a way to provide default values to a set of tasks?

2017-10-02 Thread Behrang Saeedzadeh
s to those roles > - more info here: > http://docs.ansible.com/ansible/latest/playbooks_reuse_roles.html#using-roles > > kind regards > Pshem > > > On Mon, 2 Oct 2017 at 15:49 Behrang Saeedzadeh <behr...@gmail.com > > wrote: > >> Hi, >&

[ansible-project] Is there a way to provide default values to a set of tasks?

2017-10-01 Thread Behrang Saeedzadeh
Hi, I am writing a role that contains a dozen of tasks that invoke REST APIs. All tasks have a set of common and identical configurations: - name: Task 1 uri: validate_certs: False method: POST user: "{{ user }}" password: "{{ pass }}" force_basic_auth: yes

[ansible-project] Is there a way to run tasks that have ALL of the tasks given as parameters to ansible-playbook?

2017-10-11 Thread Behrang Saeedzadeh
For example, let's pretend we have these tasks: - name: Task 1 tags: - foo - bar - name: Task 2 tags: - foo - name: Task 3 tags: - bar Is there a way to only execute tasks that have both of *foo* and bar *tags*? That's, only execute* Task 1*? -- You received this

[ansible-project] Re: Is there a way to run tasks that have ALL of the tasks given as parameters to ansible-playbook?

2017-10-11 Thread Behrang Saeedzadeh
ever, as far as I know, there is > no AND type of operator for tags. > > On Thursday, October 12, 2017 at 12:04:20 PM UTC+11, Behrang Saeedzadeh > wrote: >> >> For example, let's pretend we have these tasks: >> >> - name: Task 1 >> tags: >> - fo

[ansible-project] Does Ansible support inclusion of no-op/empty/placeholder tasks?

2017-10-12 Thread Behrang Saeedzadeh
In some test frameworks, we can start a test suite by providing a list of empty tests. Then we can implement the tests one by one. Similarly, I want to start a playbook by only providing the set of tasks I want to execute, without implementing them: - hosts: localhost tasks: - name: Step

[ansible-project] Is there a cleaner way to use json_query to filter an array based on the value of an attribute?

2017-10-17 Thread Behrang Saeedzadeh
Hi, The version of Ansible we are using does not support selectattr to filter a list based on attribute names. So I instead use something like this: set_fact: thing: '{{ (things | json_query("[?thing_name==''" + a_thing_name + "'']") | list)[0] }}' Is there a cleaner way to do this?

Re: [ansible-project] Looking for a more elegant way to declare complex variables

2017-11-20 Thread Behrang Saeedzadeh
Oops. I didn't know this module existed. I am maintaining a set of scripts that was written before 2.0 and this module were released. On Tuesday, November 21, 2017 at 1:45:25 AM UTC+11, Shanker Balan wrote: > > Hi Behrang, > > Comments inline... > > > On 20-Nov-2017,

Re: [ansible-project] Looking for a more elegant way to declare complex variables

2017-11-20 Thread Behrang Saeedzadeh
I want to pretty print the generated JSON file. Otherwise I would have used the template module. On Tuesday, November 21, 2017 at 1:51:30 AM UTC+11, Brian Coca wrote: > > Just a note, this task does x2 transformations it does not need to, if > you use template directly you avoid many problems.

[ansible-project] Looking for a more elegant way to declare complex variables

2017-11-19 Thread Behrang Saeedzadeh
Sensu is monitoring services like Nagios and the things it should monitor can be configured with JSON check definition files . A JSON check definition file can have one or more check definitions. Here is a simplified

[ansible-project] Why sometimes result of tasks looping over with_items entries are printed in one line and sometimes in multiple lines

2017-11-19 Thread Behrang Saeedzadeh
For example: TASK [hal9000 : Install packages] ok: [localhost] => (item=[u'python-lxml', u'jdk1.8.0_92']) TASK [hal9000 : Copy configurations] * ok: [localhost] => (item=a) ok: [localhost] => (item=b) ok: [localhost] => (item=c) ok: [localhost] => (item=d)

Re: [ansible-project] Is there a cleaner alternative to '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'

2017-10-30 Thread Behrang Saeedzadeh
gt; set_fact: > enabled_ports: "{{ intfs | json_query(enabled)}}" > vars: > enabled: "values(@)[?is_enabled && is_up && vlan_tag == `{{ > mgmt_vlan }}`]" > > kind regards > Pshem > > > On Mon, 30 Oct 201

[ansible-project] Is there a cleaner alternative to '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'

2017-10-29 Thread Behrang Saeedzadeh
Is there a cleaner alternative to: '{{ (things | json_query("[?name==''" + thing_name + "'']") }}' In particular, ideally I want to avoid: - String concatenation - Escaping of quotes -- You received this message because you are subscribed to the Google Groups "Ansible Project"

[ansible-project] Refactoring variables to avoid hard coding the same value over and over again

2017-10-19 Thread Behrang Saeedzadeh
I want to refactor the following vars file/playbook pair, to avoid hard-coding the app name in the value for log_dir attributes. --- # some-role-vars.yml some_role_config: - name: app1 log_dir: "/var/log/app1/app1.log" - name: app2 log_dir: "/var/log/app2/app2.log" - name: