diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index 23b96d3f..1f1f1afe 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -57,6 +57,8 @@ owner: "{{ item.owner|default(glance_system_user_name) }}" group: "{{ item.group|default(glance_system_group_name) }}" mode: "{{ item.mode|default(omit) }}" + when: + - item.path not in glance_mount_points with_items: - { path: "/openstack", mode: "0755", owner: "root", group: "root" } - { path: "/etc/glance", mode: "0750" } @@ -73,6 +75,8 @@ owner: "{{ glance_system_user_name }}" group: "{{ glance_system_group_name }}" mode: "0755" + when: + - glance_system_user_home + '/images' not in glance_mount_points - name: Test for log directory or link shell: | @@ -93,7 +97,8 @@ owner: "{{ glance_system_user_name }}" group: "{{ glance_system_group_name }}" mode: "0755" - when: log_dir.rc != 0 + when: + - log_dir.rc != 0 - name: Install distro packages package: diff --git a/tasks/glance_post_install.yml b/tasks/glance_post_install.yml index 9fe12a5a..44436cc7 100644 --- a/tasks/glance_post_install.yml +++ b/tasks/glance_post_install.yml @@ -78,12 +78,6 @@ - Manage LB - Restart glance services -- name: Create nfs shares local path - file: - path: "{{ item.local_path }}" - state: directory - with_items: "{{ glance_nfs_client }}" - - name: Glance nfs mount(s) config_template: src: "glance-systemd-mount.j2" diff --git a/vars/main.yml b/vars/main.yml index 6b666883..8bf3c9d0 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -29,3 +29,13 @@ filtered_glance_services: |- {% endif %} {% endfor %} {{ services | sort(attribute='start_order') }} + +# Define all glance mountpoints when using NFS. If defined +# the corresponding directory will only be created by the +# mount point task. +glance_mount_points: |- + {% set mps = [] %} + {% for mp in glance_nfs_client %} + {% set _ = mps.append(mp.local_path) %} + {% endfor %} + {{ mps }}