Loop on Route53 with items

156 views
Skip to first unread message

Louis Borsu

unread,
Jun 18, 2015, 11:24:22 AM6/18/15
to ansible...@googlegroups.com
Hi, 

I would like to loop on items in an inventory group with the module Route53

I tried to methods but both failed, if you have any idea, it would be really appreciated :D

Method 1:
- route53:
    command: create
    overwrite: True
    zone: "{{ slaves_dns_zone }}"
    record: "{{ item | regex_replace('/.', '-') }}.{{ slaves_dns_record }}"
    type: PTR
    ttl: 300
    value: "{{ item }}"
    with_items: groups['slaves-private']

msg: unsupported parameter for module: with_items 

Method 2:
- include: route53-unique-slave.yml item=item
  with_dict: groups['mesos-slaves']

ERROR: [DEPRECATED]: include + with_items is a removed deprecated feature. Please update your playbooks. 

Then, I'm a bit out if idea :)

Thank you in advance! 

Yassen Damyanov

unread,
Jun 21, 2015, 4:22:44 AM6/21/15
to ansible...@googlegroups.com
Never had to deal with Amazon stuff but here my 2 cents: your first method fails because of wrong indentation:


On Thursday, June 18, 2015 at 6:24:22 PM UTC+3, Louis Borsu wrote:
Hi, 

I would like to loop on items in an inventory group with the module Route53

I tried to methods but both failed, if you have any idea, it would be really appreciated :D

Method 1:
- route53:
    command: create
    overwrite: True
    zone: "{{ slaves_dns_zone }}"
    record: "{{ item | regex_replace('/.', '-') }}.{{ slaves_dns_record }}"
    type: PTR
    ttl: 300
    value: "{{ item }}"
    with_items: groups['slaves-private']

msg: unsupported parameter for module: with_items 

You need to outdent the with_items clause, otherwise you state it is part of route53 arguments. Here a working example:

- name: important basic packages
  apt
:
    name
: "{{ item }}"
    state
: present
  with_items
:
   
- strace
   
- screen
   
- less
   
- man-db
   
- wget


HTH,
-Y

Louis Borsu

unread,
Jun 22, 2015, 8:06:30 AM6/22/15
to ansible...@googlegroups.com
OK, it worked, thank you => *FACEPALM*
Reply all
Reply to author
Forward
0 new messages