12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- ---
- - name: setup firewall
- import_tasks: firewall.yml
- - name: Install nfs-utils
- package: name=nfs-utils state=present
- register: result
- until: result | success
- - name: Configure NFS
- lineinfile:
- dest: /etc/sysconfig/nfs
- regexp: '^RPCNFSDARGS=.*$'
- line: 'RPCNFSDARGS="-N 2 -N 3"'
- register: nfs_config
- - name: Restart nfs-config
- systemd: 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.metrics }}"
- - "{{ openshift.logging }}"
- - "{{ openshift.loggingops }}"
- - "{{ openshift.hosted.etcd }}"
- - "{{ openshift.prometheus }}"
- - "{{ openshift.prometheus.alertmanager }}"
- - "{{ openshift.prometheus.alertbuffer }}"
- - 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
- systemd:
- name: nfs-server
- state: started
- enabled: yes
- register: start_result
- - set_fact:
- nfs_service_status_changed: "{{ start_result | changed }}"
|