recursive loop detected in template string problem

926 views
Skip to first unread message

Yosef Yudilevich

unread,
Oct 17, 2016, 12:13:48 PM10/17/16
to Ansible Project
hi , how do i address CB.C1.COUNTER in CB.C1.BUCKETS_DICT

vars file:

CB:
  C1:
    COUNT: 4
    BUCKETS_DICT:
      - { bucket_name: "Test", bucket_type: 'couchbase', bucket_port: '11211', bucket_ram_quota: "{{ ( 800 / CB.C1['COUNT'] ) | int }}" }



task:

    - name: create buckets
      run_once: true
      shell: "/opt/couchbase/bin/couchbase-cli bucket-create -c 127.0.0.1:8091 --bucket={{ item.bucket_name }} --bucket-type={{ item.bucket_type }} --bucket-port={{ item.bucket_port }} --bucket-ramsize={{ item.bucket_ram_quota }} -u {{ admin_user }} -p {{ admin_password }}"
      with_items: "{{ CB.C1.BUCKETS_DICT }}"


thanks

Yosef Yudilevich

unread,
Oct 19, 2016, 5:19:26 AM10/19/16
to Ansible Project
need help with this really
cant move on with infrastructure
pls help

Łukasz Górski

unread,
Oct 19, 2016, 11:07:25 AM10/19/16
to ansible...@googlegroups.com
I can't answer the dictionary lookup question directly. I suggest you use a flatter variable structure instead if you can, i.e.

cb_c1_count: 4
cb_c1_buckets:
  - name: 'xxx'
  - type: 'yyy'
  - quota: "{{ 800 / cb_c1_count | int }}"

This should avoid using self-referential lookups. Not quite elegant for large number of variables though.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f3d21b7e-b547-4fe9-9b7f-bcd536542add%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Łukasz Górski
Administrator Systemu Linux
e-mail: l.go...@trojmiasto.pl

Tel. 058 321 95 65 Kom.
Moje miasto to Trójmiasto!

Trojmiasto.pl Sp. z o.o. ul. Wały Piastowskie 1, 80-855 Gdańsk
tel: 58 321-95-00 fax: 58 321-95-13 e-mail: in...@trojmiasto.pl
NIP 583-30-12-490, REGON 220563678
Sąd Rejonowy Gdańsk-Północ w Gdańsku, VII Wydział Gospodarczy Krajowego Rejestru Sądowego, KRS 0000300002, Kapitał zakładowy 2 150 000 PLN
fbTrojmiasto.pl na Facebooku. Dołącz do nas!
Reply all
Reply to author
Forward
0 new messages