network_interface icon indicating copy to clipboard operation
network_interface copied to clipboard

Fails with Ansible 2.0

Open echo-devnull opened this issue 10 years ago • 1 comments

With this error:

TASK [bennojoy.network_interface : Install the required packages in Debian derivatives] ***
[DEPRECATION WARNING]: Using bare variables for environment is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{foo}}'). This feature will be removed in a future release. 
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [suproxy02.intra.fd.nl]: FAILED! => {"failed": true, "msg": "ERROR! environment must be a dictionary, received env (<class 'ansible.parsing.yaml.objects.AnsibleUnicode'>)"}

echo-devnull avatar Jan 26 '16 08:01 echo-devnull

This:

---
- env:
    RUNLEVEL: 1

needs to be:

---
env:
  RUNLEVEL: 1

And since 2.0 we need to quote environment variables:

- name: Install the required  packages in Redhat derivatives
  yum: name='{{ item }}' state=installed
  with_items: network_pkgs
  when: ansible_os_family == 'RedHat'

- name: Install the required packages in Debian derivatives
  apt: name='{{ item }}' state=installed update_cache=yes
  with_items: network_pkgs
  environment: "{{ env }}"
  when: ansible_os_family == 'Debian'

echo-devnull avatar Jan 26 '16 09:01 echo-devnull