ansible/roles/nfs/client/tasks/main.yml

82 lines
2.3 KiB
YAML

- name: route config for netapp network
copy: src=route-eth1.{{ datacenter }} dest=/etc/sysconfig/network-scripts/route-eth1
when: datacenter == 'phx2' or datacenter == 'rdu2'
- name: check for netapp route
command: ip route show
register: netapproute
always_run: yes
changed_when: "1 != 1"
- name: run netapp route if needed in phx2
command: /etc/sysconfig/network-scripts/ifup-routes eth1
when: netapproute.stdout.find("10.5.88.0") == -1 and datacenter == 'phx2'
- name: run netapp route if needed in rdu
command: /etc/sysconfig/network-scripts/ifup-routes eth1
when: netapproute.stdout.find("172.31.1.0") == -1 and datacenter == 'rdu'
#
# Install needed packages
#
- name: Install needed nfs packages
yum: pkg={{ item }} state=present
with_items:
- nfs-utils
- rpcbind
- name: enable nfs-related services and run them (fedora20 and newer)
service: name={{ item }} enabled=true state=started
with_items:
- rpcbind
- nfs-lock
when: ansible_distribution == 'Fedora' and ansible_distribution_major_version > '19'
- name: enable nfs-related services and run them (rhel7)
service: name={{ item }} enabled=true state=started
with_items:
- rpcbind
- nfs-lock
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version == '7'
- name: enable nfs-related services and run them (rhel6)
action: service name={{ item }} enabled=true state=started
with_items:
- rpcidmapd
- rpcbind
- nfs
- nfslock
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version == '6'
- name: nfs mount points (phx2)
mount: >
name=/{{ mnt_dir }}
src=vtap-fedora-nfs01.storage.phx2.redhat.com:/vol/{{ nfs_src_dir }}
fstype=nfs
opts={{nfs_mount_opts}}
passno=0
dump=0
state=mounted
when: datacenter == 'phx2'
- name: nfs mount points (rdu)
mount: >
name=/{{ mnt_dir }}
src=172.31.1.10:/vol/{{ nfs_src_dir }}
fstype=nfs
opts={{nfs_mount_opts}}
passno=0
dump=0
state=mounted
when: datacenter == 'rdu'
- name: nfs mount points (stg)
mount: >
name=/{{ mnt_dir }}
src=10.5.126.87:/mnt/{{ nfs_src_dir }}
fstype=nfs4
opts={{nfs_mount_opts}}
passno=0
dump=0
state=mounted
when: datacenter == 'staging'