Using bare variables is deprecated php Ansible

511 views Asked by At

I have this ansible tasks an

- name: Install
  apt: pkg="php7.0-dev" state=present
  when: php.pecl_packages is defined

- name: Install Package
  shell: echo "\n\n\n\n\n\n\n\n\n" | pecl install {{ item }}
  register: pecl_result
  changed_when: "'already installed' not in pecl_result.stdout"
  failed_when: "pecl_result.stderr or ('ERROR' in pecl_result.stdout)"
  with_items: php.pecl_packages
  when: php.pecl_packages is defined

- name: Create extension .ini file
  template: >
    src="extension.tpl"
    dest="/etc/php/7.0/mods-available/{{ item }}.ini"
    owner="root"
    group="root"
    mode=0644
  with_items: php.pecl_packages
  when: php.pecl_packages is defined

- name: Enable extension
  shell: Php7enmod {{ item }}
  with_items: php.pecl_packages
  when: php.pecl_packages is defined

and default/main.yml as

php:
    install: '1'
    packages: [php7.0-mcrypt]
    peclpackages: [hash]

and templates/extension.tpl as

; Configuration for php PECL {{ item }} extension
extension={{ item }}.so

and I am still getting, bare variables is deprecated exception, how can I do this?

[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{php.pecl_packages}}').

1

There are 1 answers

2
Konstantin Suvorov On

You may want to search for "ansible bare variables" on SO or google...

Instead of with_items: php.pecl_packages use with_items: "{{php.pecl_packages}}".