From cbf79113c4e1651644af91a2877a100b442c346c Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 14 Jun 2016 18:33:35 +0100 Subject: [PATCH] Address Ansible bare variable usage When executing the role with Ansible 2.1, the following deprecation warning is issued in the output for some tasks. [DEPRECATION WARNING]: Using bare variables is deprecated. This patch addresses the tasks to fix the behaviour appropriately. The patch also addresses removing the use of with_items if the list only contains a single item. Change-Id: I8326d53d3a57fd84a55febc21f6ae1a64fced415 --- tasks/lxc_cache_preparation.yml | 2 +- tasks/lxc_install.yml | 2 +- tasks/lxc_install_apt.yml | 2 +- tasks/lxc_install_yum.yml | 10 +++------- tasks/lxc_kernel_tuning.yml | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tasks/lxc_cache_preparation.yml b/tasks/lxc_cache_preparation.yml index 08582405..3ca606f8 100644 --- a/tasks/lxc_cache_preparation.yml +++ b/tasks/lxc_cache_preparation.yml @@ -74,7 +74,7 @@ regexp: "{{ item.regexp }}" line: "{{ item.line }}" state: present - with_items: lxc_cache_sshd_configuration + with_items: "{{ lxc_cache_sshd_configuration }}" tags: - lxc-cache - lxc-cache-update diff --git a/tasks/lxc_install.yml b/tasks/lxc_install.yml index f69346aa..f636c99c 100644 --- a/tasks/lxc_install.yml +++ b/tasks/lxc_install.yml @@ -34,6 +34,6 @@ until: install_packages|success retries: 5 delay: 2 - with_items: lxc_pip_packages + with_items: "{{ lxc_pip_packages }}" tags: - lxc-pip-packages diff --git a/tasks/lxc_install_apt.yml b/tasks/lxc_install_apt.yml index 86c8ddcc..a0bf4c77 100644 --- a/tasks/lxc_install_apt.yml +++ b/tasks/lxc_install_apt.yml @@ -38,7 +38,7 @@ until: install_packages|success retries: 5 delay: 2 - with_items: lxc_packages + with_items: "{{ lxc_packages }}" tags: - lxc-apt-packages diff --git a/tasks/lxc_install_yum.yml b/tasks/lxc_install_yum.yml index bfdeb473..1b59e63e 100644 --- a/tasks/lxc_install_yum.yml +++ b/tasks/lxc_install_yum.yml @@ -21,18 +21,16 @@ until: install_packages|success retries: 5 delay: 2 - with_items: lxc_packages + with_items: "{{ lxc_packages }}" tags: - lxc-packages - name: Create base directories file: - path: "{{ item }}" + path: "/opt/lxc_embedded" state: "directory" owner: "root" group: "root" - with_items: - - /opt/lxc_embedded tags: - lxc-directories @@ -118,12 +116,10 @@ - name: Remove sub system lock if found file: - path: "{{ item }}" + path: "/var/lock/subsys/lxc" state: "absent" owner: "root" group: "root" - with_items: - - /var/lock/subsys/lxc tags: - lxc-directories diff --git a/tasks/lxc_kernel_tuning.yml b/tasks/lxc_kernel_tuning.yml index 2b05b992..ec34fc45 100644 --- a/tasks/lxc_kernel_tuning.yml +++ b/tasks/lxc_kernel_tuning.yml @@ -21,4 +21,4 @@ state: "{{ item.state|default('present') }}" reload: "{{ item.reload|default('yes') }}" ignore_errors: true - with_items: lxc_kernel_options + with_items: "{{ lxc_kernel_options }}"