summaryrefslogtreecommitdiffstats
path: root/roles/nfs_client/tasks/main.yml
blob: 3bccd8e9d2df373f02e4058f753c5423958b0a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
- 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=installed
  with_items: 
  - nfs-utils
  - rpcbind

- name: enable nfs-related services and run them (fedora)
  action: service name={{ item }}  enabled=true state=started
  with_items:
  - nfs-idmap
  - nfs-lock
  when: ansible_distribution == 'Fedora'

- name: enable nfs-related services and run them (rhel)
  action: service name={{ item }}  enabled=true state=started
  with_items:
  - rpcidmapd
  - rpcbind
  - nfs
  - nfslock
  when: ansible_distribution == 'RedHat'

- 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'