Fix glance_nfs_client setting

glance_nfs_client adds 2 fstab entries, with then handler entry being
incorrectly ordered (src and name are the wrong way around).

This patch removes the redundant handler and moves the existing fstab
task to use the "mount" module which will add the entry to fstab and
ensure the filesystems are mounted.

Additionally this fixes a documentation bug where an incorrect variable
is referenced (glance_nfs_mounts).

Change-Id: I6e0f964d4279800d31119f380a239e2c4ae61cb5
Fixes-Bug: #1477081
This commit is contained in:
Andy McCrae 2015-07-22 11:41:26 +01:00 committed by Kevin Carter
parent 4f405f4704
commit c19915251f
3 changed files with 10 additions and 18 deletions

View File

@ -117,9 +117,9 @@ glance_policy_dirs: policy.d
## Define nfs information for glance. When the glance_nfs_client dictionary is ## Define nfs information for glance. When the glance_nfs_client dictionary is
## defined it will enable nfs shares as mounted directories. The ## defined it will enable nfs shares as mounted directories. The
## ``glance_nfs_mounts`` value is a list of dictionaries that must be filled ## ``glance_nfs_client`` value is a list of dictionaries that must be filled
## out completely to enable the persistent NFS mounts. ## out completely to enable the persistent NFS mounts.
# glance_nfs_mounts: # glance_nfs_client:
# - server: "127.0.0.1" ## Hostname or IP address of NFS Server # - server: "127.0.0.1" ## Hostname or IP address of NFS Server
# remote_path: "/images" ## Remote path from the NFS server's export # remote_path: "/images" ## Remote path from the NFS server's export
# local_path: "/var/lib/glance/images" ## Local path on machine # local_path: "/var/lib/glance/images" ## Local path on machine

View File

@ -31,12 +31,3 @@
state: "restarted" state: "restarted"
pattern: "{{ item }}" pattern: "{{ item }}"
with_items: glance_service_names with_items: glance_service_names
- name: Glance mount nfs
mount:
name: "{{ item.server }}:{{ item.remote_path }}"
src: "{{ item.local_path }}"
fstype: "{{ item.type }}"
opts: "{{ item.options }}"
state: "present"
with_items: glance_nfs_client

View File

@ -94,15 +94,16 @@
- glance-nfs - glance-nfs
- glance-nfs-local-path - glance-nfs-local-path
- name: Create nfs mounts - name: Glance mount nfs
lineinfile: mount:
dest: "/etc/fstab" name: "{{ item.local_path }}"
line: "{{ item.server }}:{{ item.remote_path }} {{ item.local_path }} {{ item.type }} {{ item.options }} 0 0" src: "{{ item.server }}:{{ item.remote_path }}"
backup: "true" fstype: "{{ item.type }}"
opts: "{{ item.options }}"
state: "mounted"
with_items: glance_nfs_client with_items: glance_nfs_client
when: > when: >
glance_nfs_client is defined glance_nfs_client is defined
notify: Glance mount nfs
tags: tags:
- glance-nfs - glance-nfs
- glance-nfs-fstab - glance-nfs-local-path