-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[devsetup] allow configure nfs server on host
Related: OSPRH-6624 Signed-off-by: Martin Schuppert <[email protected]>
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ansible-playbook | ||
--- | ||
- name: Configure nfs server and exports | ||
become: true | ||
hosts: localhost | ||
gather_facts: true | ||
roles: | ||
- role: nfs_server | ||
vars: | ||
nfs_home: "{{ lookup('ansible.builtin.env', 'NFS_HOME')|default('/home/nfs', True) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
nfs_home: /home/nfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
- name: Install NFS packages | ||
ansible.builtin.yum: | ||
name: nfs-utils | ||
state: present | ||
|
||
- name: Start and enable NFS services | ||
ansible.builtin.systemd: | ||
name: nfs-server | ||
state: started | ||
enabled: true | ||
|
||
- name: Open nfsv4 port 2049/tcp (running config, non permanent) | ||
ansible.builtin.iptables: | ||
chain: INPUT | ||
destination_port: 2049 | ||
protocol: tcp | ||
ctstate: NEW | ||
syn: match | ||
jump: ACCEPT | ||
comment: Accept new NFS connections. | ||
|
||
- name: Create NFS shares | ||
ansible.builtin.file: | ||
path: "{{ nfs_home }}/{{ item }}" | ||
state: directory | ||
mode: '0777' | ||
group: nobody | ||
owner: nobody | ||
with_items: | ||
- glance | ||
- glance-staging | ||
- nova | ||
- cinder | ||
- cinder_image_conversion | ||
|
||
- name: Configure exports | ||
ansible.builtin.lineinfile: | ||
path: /etc/exports.d/osp.exports | ||
line: "{{ nfs_home }}/{{ item }} *(rw,sync,no_root_squash)" | ||
create: true | ||
mode: '0644' | ||
with_items: | ||
- glance | ||
- glance-staging | ||
- nova | ||
- cinder | ||
- cinder_image_conversion | ||
register: _export_shares | ||
|
||
- name: Export NFS share to the server | ||
when: | ||
- _export_shares.changed | ||
ansible.builtin.command: "exportfs -r" |