diff options
author | Samuli Silvius <s.silvius@partner.samsung.com> | 2019-03-23 13:54:34 +0200 |
---|---|---|
committer | Samuli Silvius <s.silvius@partner.samsung.com> | 2019-04-01 20:41:43 +0300 |
commit | 11ce29363400bfcc909c9b94eda01aeafc6c17dc (patch) | |
tree | dc0be6a94756946c249ce796b49bfb931b127dad /ansible/roles/nfs/tasks | |
parent | dc924a0cb81e1eed9f5bf152bfba076a45fe91e1 (diff) |
Fix nfs role issues based on molecule testing
Based on Molecule testing fix following issues on
nfs role.
- enable nfs services (previously only started)
- create handler for exportfs to deal idempotency
- add all kubernetes nodes to exports as it was dependent on ansible inventory order wheather correct hosts was on the list
- add inventory_hostname as default host incase ansible_host variable not defined.
Issue-ID: OOM-1756
Change-Id: Ib93e9d2a9cf49003d04dd5f890294eda1eb966ff
Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
Diffstat (limited to 'ansible/roles/nfs/tasks')
-rw-r--r-- | ansible/roles/nfs/tasks/main.yml | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ansible/roles/nfs/tasks/main.yml b/ansible/roles/nfs/tasks/main.yml index aca1771f..e7580b66 100644 --- a/ansible/roles/nfs/tasks/main.yml +++ b/ansible/roles/nfs/tasks/main.yml @@ -9,7 +9,7 @@ package: name: "{{ item }}" state: present - with_items: "{{ nfs_packages[ansible_os_family] }}" + loop: "{{ nfs_packages[ansible_os_family] }}" - name: Setup nfs server block: @@ -17,22 +17,25 @@ systemd: name: "{{ item }}" state: started - with_items: "{{ nfs_services[ansible_os_family] }}" + enabled: true + loop: "{{ nfs_services[ansible_os_family] }}" - name: Add hosts to exports template: src: exports.j2 dest: /etc/exports - - - name: Export nfs - command: exportfs -ar + notify: + - reload nfs when: - "'nfs-server' in group_names" +- name: Force notified handlers to run at this point + meta: flush_handlers + - name: Mount dockerdata-nfs mount: path: "{{ nfs_mount_path }}" - src: "{{ hostvars[groups['nfs-server'].0].ansible_host }}:{{ nfs_mount_path }}" + src: "{{ hostvars[groups['nfs-server'].0].ansible_host | default(hostvars[groups['nfs-server'].0].inventory_hostname) }}:{{ nfs_mount_path }}" fstype: nfs state: mounted when: |