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

126 lines
3.1 KiB
YAML

# Setup our idmapd.conf file. It should be loaded automagically.
- name: idmapd.conf
copy: src=idmapd.conf dest=/etc/idmapd.conf
tags:
- nfs/client
notify:
- restart idmapd
- name: route config for netapp network
copy: src=route-eth1.{{ datacenter }} dest=/etc/sysconfig/network-scripts/route-eth1
when: datacenter == 'phx2' or datacenter == 'rdu2' or datacenter == 'staging'
tags:
- nfs/client
- name: check for netapp route
command: ip route show
register: netapproute
check_mode: no
changed_when: "1 != 1"
tags:
- nfs/client
- 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'
tags:
- nfs/client
- 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'
tags:
- nfs/client
#
# Install needed packages
#
- name: Install needed nfs packages
package:
name: "{{ item }}"
state: present
with_items:
- nfs-utils
- rpcbind
tags:
- nfs/client
- name: enable nfs-related services and run them (rhel 7 and Fedora)
service: name={{ item }} enabled=true state=started
with_items:
- rpcbind
- nfs-lock
when: ansible_distribution_major_version|int != 6
tags:
- nfs/client
- name: enable nfs-related services and run them (rhel6)
service: name={{ item }} enabled=true state=started
with_items:
- rpcidmapd
- rpcbind
- nfs
- nfslock
when: ansible_distribution_major_version|int == 6
tags:
- nfs/client
- name: nfs mount points (phx2)
mount: >
name={{ mnt_dir }}
src=ntap-phx2-c01-fedora01-nfs.storage.phx2.redhat.com:/{{ nfs_src_dir }}
fstype=nfs
opts={{nfs_mount_opts}}
passno=0
dump=0
state=mounted
when: datacenter == 'phx2'
tags:
- nfs/client
- name: nfs mount points (rdu)
mount: >
name={{ mnt_dir }}
src=172.31.1.11:/{{ nfs_src_dir }}
fstype=nfs
opts={{nfs_mount_opts}}
passno=0
dump=0
state=mounted
when: datacenter == 'rdu'
tags:
- nfs/client
#
# In stg we need to mount the koji01.stg volume rw and the
# production nfs volume ro. Since the setup here isn't good
# for multiple nfs mounts, we just hard code needed staging bits
# here. If it becomes more common to have multiple mounts, we
# should revisit how this role works.
#
- name: nfs mount points (stg) staging koji
mount: >
name=/mnt/fedora_koji
src=10.5.126.87:/mnt/fedora_koji
fstype=nfs4
opts={{nfs_mount_opts}}
passno=0
dump=0
state=mounted
when: datacenter == 'staging'
tags:
- nfs/client
- name: nfs mount points (stg) production koji ro
mount: >
name=/mnt/fedora_koji_prod
src=ntap-phx2-c01-fedora01-nfs.storage.phx2.redhat.com:/fedora_koji
fstype=nfs
opts=ro,hard,bg,intr,noatime,nodev,nosuid,nfsvers=3
passno=0
dump=0
state=mounted
when: datacenter == 'staging'
tags:
- nfs/client