Complex args + with_items ansible 2.0

294 views
Skip to first unread message

DomaNitro

unread,
Dec 16, 2015, 9:59:58 AM12/16/15
to Ansible Project
Starting to test my roles with ansible 2.0 dev branch 

Complex args breaks when using with_  but works with 1.9.X

- name         : Loop 
  hosts        : all
  gather_facts : yes
  become       : True
  vars         :
     usermanage_groupsdb  :
        - name         : "group1"
          state        : "present"
          gid          : "5000"
          system       : "true"

        - name         : "group2"
          state        : "present"
          gid          : "5001"
          system       : "false"
  tasks:
       - debug: var=usermanage_groupsdb
       - name: groups | Create groups
         group:
         args: "{{ item }}"
         with_items: usermanage_groupsdb 


I am not sure if thats a bug or its by design. Since the complex args was not heavily documented. 
So I dont want to report it on github unless it is


Regards
Adham

Luca Berruti

unread,
Dec 16, 2015, 2:17:20 PM12/16/15
to Ansible Project
Hi Adham,

see https://github.com/ansible/ansible/issues/13518, the issue is tagged "v2  milestone"

Regards,
Luca

DomaNitro

unread,
Dec 16, 2015, 5:38:17 PM12/16/15
to Ansible Project
Hey 

That was fast 

fixed it 8716bf8021800a18cb8d6cfea3f296ba4f834692 :) 

Luca Berruti

unread,
Dec 17, 2015, 6:32:42 AM12/17/15
to Ansible Project
Now I get a "DEPRECATION WARNING":

[DEPRECATION WARNING]: Using variables for task params is unsafe, especially if the variables come from an external source like facts. This
feature will be removed
in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.



---
- hosts: localhost
  connection
: local
  gather_facts
: false
  vars
:
    my_dir
:
      path
: /tmp/2
      state
: directory
      mode
: 755
    h
: localhost
  tasks
:
   
- file:
      args
: '{{my_dir}}'

DomaNitro

unread,
Dec 19, 2015, 2:00:33 PM12/19/15
to Ansible Project

But, whats the point of having complex args if its not going to be dynamic ?
Reply all
Reply to author
Forward
0 new messages