Merge "Support opera test in functest releng"
[releng.git] / prototypes / xci / playbooks / roles / configure-nfs / tasks / main.yml
1 ---
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2017 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 # TODO: this is for xenial and needs to be adjusted for different distros
11 - block:
12     - name: make NFS directories
13       file:
14         dest: "{{ item }}"
15         mode: 0777
16         state: directory
17       with_items:
18         - "/images"
19         - "/volumes"
20     - name: configure NFS service
21       lineinfile:
22         dest: /etc/services
23         state: present
24         create: yes
25         line: "{{ item }}"
26       with_items:
27         - "nfs        2049/tcp"
28         - "nfs        2049/udp"
29     - name: configure NFS exports
30       lineinfile:
31         dest: /etc/exports
32         state: present
33         create: yes
34         line: "{{ item }}"
35       with_items:
36         - "/images         *(rw,sync,no_subtree_check,no_root_squash)"
37         - "/volumes        *(rw,sync,no_subtree_check,no_root_squash)"
38     # TODO: the service name might be different on other distros and needs to be adjusted
39     - name: restart ubuntu xenial NFS service
40       service:
41         name: nfs-kernel-server
42         state: restarted
43   when: ansible_distribution_release == "xenial"