Use realpath filter instead of the stat/dir dance

We can make the deployment more efficient if we use the realpath
filter, instead of first checking for the directory and then
implementing the changes in a follow-up task.

This is more readable, simpler and faster to execute.

Change-Id: I6cfe8f0ef8fb1b3ebd8e68bf3bdd0aaf4b96e523
(cherry picked from commit b4140c9eed)
This commit is contained in:
Jesse Pretorius 2018-02-19 13:28:33 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 76a056974e
commit 581f180986
1 changed files with 1 additions and 6 deletions

View File

@ -31,11 +31,6 @@
set_fact:
tempest_admin_tenant_id: "{{ keystone_facts.id }}"
- name: Stat for tempest log dir
stat:
path: "{{ tempest_log_dir }}"
register: _tempest_log_dir_check
- name: Create tempest directories
file:
path: "{{ item.path }}"
@ -44,7 +39,7 @@
group: "root"
mode: "{{ item.mode|default('0755') }}"
with_items:
- path: "{{ (_tempest_log_dir_check.stat.exists and _tempest_log_dir_check.stat.islnk) | ternary(_tempest_log_dir_check.stat.lnk_source, tempest_log_dir) }}"
- path: "{{ tempest_log_dir | realpath }}"
- path: "{{ ansible_env.HOME }}/.tempest/etc"
- path: "{{ tempest_image_dir }}"