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
This commit is contained in:
Jesse Pretorius 2016-06-14 18:33:35 +01:00
parent ef6f746bed
commit cbf79113c4
5 changed files with 7 additions and 11 deletions

View File

@ -74,7 +74,7 @@
regexp: "{{ item.regexp }}" regexp: "{{ item.regexp }}"
line: "{{ item.line }}" line: "{{ item.line }}"
state: present state: present
with_items: lxc_cache_sshd_configuration with_items: "{{ lxc_cache_sshd_configuration }}"
tags: tags:
- lxc-cache - lxc-cache
- lxc-cache-update - lxc-cache-update

View File

@ -34,6 +34,6 @@
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
with_items: lxc_pip_packages with_items: "{{ lxc_pip_packages }}"
tags: tags:
- lxc-pip-packages - lxc-pip-packages

View File

@ -38,7 +38,7 @@
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
with_items: lxc_packages with_items: "{{ lxc_packages }}"
tags: tags:
- lxc-apt-packages - lxc-apt-packages

View File

@ -21,18 +21,16 @@
until: install_packages|success until: install_packages|success
retries: 5 retries: 5
delay: 2 delay: 2
with_items: lxc_packages with_items: "{{ lxc_packages }}"
tags: tags:
- lxc-packages - lxc-packages
- name: Create base directories - name: Create base directories
file: file:
path: "{{ item }}" path: "/opt/lxc_embedded"
state: "directory" state: "directory"
owner: "root" owner: "root"
group: "root" group: "root"
with_items:
- /opt/lxc_embedded
tags: tags:
- lxc-directories - lxc-directories
@ -118,12 +116,10 @@
- name: Remove sub system lock if found - name: Remove sub system lock if found
file: file:
path: "{{ item }}" path: "/var/lock/subsys/lxc"
state: "absent" state: "absent"
owner: "root" owner: "root"
group: "root" group: "root"
with_items:
- /var/lock/subsys/lxc
tags: tags:
- lxc-directories - lxc-directories

View File

@ -21,4 +21,4 @@
state: "{{ item.state|default('present') }}" state: "{{ item.state|default('present') }}"
reload: "{{ item.reload|default('yes') }}" reload: "{{ item.reload|default('yes') }}"
ignore_errors: true ignore_errors: true
with_items: lxc_kernel_options with_items: "{{ lxc_kernel_options }}"