Marcos Entenza
2020-02-16 3ec1481938fc048b65e968a9598997b8a01604c9
ansible/configs/sap-hana/software.yml
@@ -7,14 +7,63 @@
    - debug:
        msg: "Software tasks Started"
- name: Install and configure NFS Server
- name: Ensure NFS Server is installed, SAP Software Device Mounted and Ansible Installed
  hosts: bastion
  become: True
  gather_facts: True
  roles:
    # Install and deloy NFS Server
    - { role: "host-ocp-nfs", when: install_nfs }
  tasks:
    - name: Ensure NFS directory exists
      file:
        path: "/nfs"
        state: directory
    - name: Mount up device by UUID
      mount:
        path: /nfs
        src: /dev/vdb
        fstype: xfs
        state: present
    - name: 'Ensure required packages are installed'
      package:
        name: '{{ item }}'
        state: installed
      with_items:
      - nfs-utils
      - firewalld
    - name: 'Ensure firewalld is running'
      service:
        name: firewalld
        state: started
        enabled: yes
    - name: 'Open Firewall for NFS use'
      firewalld:
        port: "{{ item }}"
        permanent: yes
        state: enabled
        immediate: yes
      with_items:
      - 111/tcp
      - 111/udp
      - 2049/tcp
      - 2049/udp
    - name: "Ensure export file contains the directory to be shared"
      lineinfile:
        path: /etc/exports
        state: present
        regexp: "^/nfs"
        line: "/nfs *(insecure,rw,root_squash,no_wdelay,sync)"
    - name: 'Ensure nfs-server is restarted and running'
      service:
        name: nfs-server
        state: restarted
        enabled: yes
    - name: Ensure Ansible is installed
      yum:
        name: ansible