Hello,
This is my first post in this group. Please bear with my newbieness.

I am trying to clean up a deprecation warning in my ansible code, related 
to a variable I am using called 'netgroups', which is a list.

The code:

-   name: Configure netgroups in sudoers.d
    template: src=sudoers.j2 dest="/etc/sudoers.d/50_{{ item }}" owner=root 
group=root mode=0400
    with_flattened:
     - ['netgroups']
    when: hostvars[inventory_hostname]['netgroups'][0] is defined

The warning:

TASK [common : Configure netgroups in sudoers.d] 
*******************************
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your 
playbooks so that the environment value uses the
full variable syntax ('{{netgroups}}').
This feature will be removed in a future release. Deprecation warnings can 
be
disabled by setting deprecation_warnings=False in ansible.cfg.
changed: [localhost] => (item=netgroupZ)

Here is the ansible-playbook command:

export ANSIBLE_HOST_KEY_CHECKING=False;ansible-playbook -i "localhost," 
site.yml --connection=local --extra-vars "netgroups=['netgroupZ']"

Note that the netgroups variable is set with the extra-vars option to a 
list in the ansible-playbook command. After changing ['netgroups'] 
to '{{netgroups}}' in the code, this error is received:

[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future 
this will be a fatal error.: 'netgroups' is
undefined.
This feature will be removed in a future release. Deprecation warnings can 
be disabled by setting
deprecation_warnings=False in ansible.cfg.
skipping: [localhost]

Any ideas? Thanks in advance.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8ba3a929-728b-4082-bf21-5eb68822fb61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to