Merge "Cleanup directory creation tasks"

This commit is contained in:
Zuul 2018-07-02 23:15:51 +00:00 committed by Gerrit Code Review
commit 9c2fb768df
1 changed files with 22 additions and 45 deletions

View File

@ -50,55 +50,32 @@
mode: "0755" mode: "0755"
with_items: "{{ glance_nfs_client }}" with_items: "{{ glance_nfs_client }}"
- name: Create glance dir - name: Create glance directories
file: file:
path: "{{ item.path }}" path: "{{ item.path | realpath }}"
state: directory state: directory
owner: "{{ item.owner|default(glance_system_user_name) }}" owner: "{{ item.owner | default(glance_system_user_name) }}"
group: "{{ item.group|default(glance_system_group_name) }}" group: "{{ item.group | default(glance_system_group_name) }}"
mode: "{{ item.mode|default(omit) }}" mode: "{{ item.mode | default(omit) }}"
when: when:
- item.path not in glance_mount_points - "item.path not in glance_mount_points"
with_items: with_items:
- { path: "/openstack", mode: "0755", owner: "root", group: "root" } - path: "/openstack"
- { path: "/etc/glance", mode: "0750" } mode: "0755"
- { path: "/var/cache/glance" } owner: "root"
- { path: "{{ glance_system_user_home }}" } group: "root"
- { path: "{{ glance_system_user_home }}/cache/api", mode: "0700" } - path: "/etc/glance"
- { path: "{{ glance_system_user_home }}/cache/registry" } mode: "0750"
- { path: "{{ glance_system_user_home }}/scrubber" } - path: "/var/cache/glance"
- path: "{{ glance_system_user_home }}"
- name: Create glance images dir - path: "{{ glance_system_user_home }}/cache/api"
file: mode: "0700"
path: "{{ glance_system_user_home }}/images/" - path: "{{ glance_system_user_home }}/cache/registry"
state: directory - path: "{{ glance_system_user_home }}/scrubber"
owner: "{{ glance_system_user_name }}" - path: "{{ glance_system_user_home }}/images"
group: "{{ glance_system_group_name }}" mode: "0755"
mode: "0755" - path: "/var/log/glance"
when: mode: "0755"
- glance_system_user_home + '/images' not in glance_mount_points
- name: Test for log directory or link
shell: |
if [ -h "/var/log/glance" ]; then
chown -h {{ glance_system_user_name }}:{{ glance_system_group_name }} "/var/log/glance"
chown -R {{ glance_system_user_name }}:{{ glance_system_group_name }} "$(readlink /var/log/glance)"
else
exit 1
fi
register: log_dir
failed_when: false
changed_when: log_dir.rc != 0
- name: Create glance log dir
file:
path: "/var/log/glance"
state: directory
owner: "{{ glance_system_user_name }}"
group: "{{ glance_system_group_name }}"
mode: "0755"
when:
- log_dir.rc != 0
- name: Install distro packages - name: Install distro packages
package: package: