Create a Array of integer

245 views
Skip to first unread message

Christian Iuga

unread,
Feb 14, 2017, 1:20:28 PM2/14/17
to Ansible Project
Hi,


To manage ldap entry ( via new ansible modules ldap_attr and ldap_entry ) i need a different uidNumber than already exist

to making it i'm doing these jobs :

    - name: Initialize an empty list for our strings
      set_fact:
        uidRange: []
    - name: create array
      set_fact: uidRange="{{ uidRange }} + [ {{ item| to_json  }} ]"
      with_sequence: start=5000 end=6000

then on my code, i making a array difference with uidNumber already exist ( via ansible-plugin-lookup_ldap
) ( uidNumber="{{ uidRange| difference(uidUsed) |min }}" )

But i'm not fully satify as the task "create array" create lot of output

  adding the option "no_log: True" is not helping it's replace all iteration with censored due to no_log

Do you known how to disable output of a task or  have you a better way to create a array of integer ?


Stankovic, Marko

unread,
Feb 17, 2017, 6:49:46 AM2/17/17
to Ansible Project
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 output:
ok: [localhost] => {
"changed": false,
"uidRange|list": [
"test50",
"test51",
"test52",
"test53",
"test54",
"test55",
"test56",
"test57",
"test58",
"test59"
]
}
CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret information. This message is intended solely for the use of the addressee. If you are not the intended recipient and have received this message in error, please delete this message from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.
Reply all
Reply to author
Forward
0 new messages