123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- ---
- - name: Install nfs-utils
- package: name=nfs-utils state=present
- - name: Configure NFS
- lineinfile:
- dest: /etc/sysconfig/nfs
- regexp: '^RPCNFSDARGS=.*$'
- line: 'RPCNFSDARGS="-N 2 -N 3"'
- register: nfs_config
- - name: Restart nfs-config
- service: name=nfs-config state=restarted
- when: nfs_config | changed
- - name: Ensure exports directory exists
- file:
- path: "{{ openshift.hosted.registry.storage.nfs.directory }}"
- state: directory
- - name: Ensure export directories exist
- file:
- path: "{{ item.storage.nfs.directory }}/{{ item.storage.volume.name }}"
- state: directory
- mode: 0777
- owner: nfsnobody
- group: nfsnobody
- with_items:
- - "{{ openshift.hosted.registry }}"
- - "{{ openshift.hosted.metrics }}"
- - "{{ openshift.hosted.logging }}"
- - name: Configure exports
- template:
- dest: /etc/exports.d/openshift-ansible.exports
- src: exports.j2
- notify:
- - restart nfs-server
- # Now that we're putting our exports in our own file clean up the old ones
- - name: register exports
- command: cat /etc/exports.d/openshift-ansible.exports
- register: exports_out
- - name: remove exports from /etc/exports
- lineinfile:
- dest: /etc/exports
- line: "{{ item }}"
- state: absent
- with_items: "{{ exports_out.stdout_lines | default([]) }}"
- when: exports_out.rc == 0
- notify:
- - restart nfs-server
- - name: Enable and start services
- service:
- name: "{{ item }}"
- state: started
- enabled: yes
- register: start_result
- with_items:
- - nfs-server
- - set_fact:
- nfs_service_status_changed: "{{ start_result | changed }}"
|