Merge pull request 'testing' (#1) from testing into prod
Reviewed-on: #1
This commit is contained in:
commit
b655bd5540
7 changed files with 103 additions and 1 deletions
|
@ -1,2 +1,6 @@
|
||||||
---
|
---
|
||||||
# handlers file for mount
|
# handlers file for mount
|
||||||
|
- name: restart autofs
|
||||||
|
service:
|
||||||
|
name: autofs
|
||||||
|
state: restarted
|
||||||
|
|
4
tasks/ext4.yml
Normal file
4
tasks/ext4.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
- name: test
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/ext4-{{item.name}}
|
||||||
|
state: directory
|
|
@ -1,2 +1,20 @@
|
||||||
---
|
---
|
||||||
# tasks file for mount
|
# tasks file for mount
|
||||||
|
|
||||||
|
- name: Set up mounts if variable is defined
|
||||||
|
block:
|
||||||
|
# - include_tasks: ext4.yml
|
||||||
|
# when: mounts.ext4
|
||||||
|
# with_items:
|
||||||
|
# - mounts.ext4
|
||||||
|
|
||||||
|
- include_tasks: nfs.yml
|
||||||
|
when: mounts.nfs is defined
|
||||||
|
vars:
|
||||||
|
nfs_mounts: "{{ mounts.nfs }}"
|
||||||
|
|
||||||
|
# - include_tasks: sshfs.yml
|
||||||
|
# loop: "{{ mounts }}"
|
||||||
|
# when: item == "sshfs"
|
||||||
|
|
||||||
|
when: mounts is defined
|
||||||
|
|
60
tasks/nfs.yml
Normal file
60
tasks/nfs.yml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
# tasks file for mounting nfs
|
||||||
|
- name: install autofs
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: autofs
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: install nfs-utils
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: nfs-utils
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: ensure nfs is in auto.master
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/autofs/auto.master
|
||||||
|
line: "/mnt/autofs/nfs /etc/autofs/auto.nfs"
|
||||||
|
state: present
|
||||||
|
create: true
|
||||||
|
notify: restart autofs
|
||||||
|
|
||||||
|
- name: deploy auto.nfs file
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: templates/auto.nfs
|
||||||
|
dest: /etc/autofs/auto.nfs
|
||||||
|
vars:
|
||||||
|
nfs: "{{ nfs_mounts }}"
|
||||||
|
notify: restart autofs
|
||||||
|
|
||||||
|
- name: create symlinks
|
||||||
|
ansible.builtin.file:
|
||||||
|
src: "/mnt/autofs/nfs/{{ item.name }}"
|
||||||
|
dest: "{{ item.local }}"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
loop: "{{ nfs_mounts }}"
|
||||||
|
|
||||||
|
- name: ensure rpcbind is running
|
||||||
|
service:
|
||||||
|
name: rpcbind
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: ensure nfs-client is running
|
||||||
|
service:
|
||||||
|
name: nfs-client.target
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: ensure remote-fs is running
|
||||||
|
service:
|
||||||
|
name: remote-fs.target
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: ensure autofs is running
|
||||||
|
service:
|
||||||
|
name: autofs
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
4
tasks/sshfs.yml
Normal file
4
tasks/sshfs.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
- name: test
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/sshfs-{{item.name}}
|
||||||
|
state: directory
|
3
templates/auto.nfs
Normal file
3
templates/auto.nfs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{% for mount in nfs -%}
|
||||||
|
{{ mount.name }} -rw,soft,intr,rsize=8192,wsize=8192 {{ mount.host }}:{{ mount.remote }}
|
||||||
|
{%- endfor -%}
|
|
@ -1,2 +1,11 @@
|
||||||
---
|
---
|
||||||
# vars file for mount
|
# vars file for mount on privtorrents.actcur.com
|
||||||
|
|
||||||
|
mounts:
|
||||||
|
nfs:
|
||||||
|
- name: deluge
|
||||||
|
host: host.actcur.com
|
||||||
|
remote: /mnt/butter/video/deluge
|
||||||
|
local: /mnt/deluge
|
||||||
|
|
||||||
|
# end of file
|
||||||
|
|
Loading…
Add table
Reference in a new issue