testing #1

Merged
ejparker merged 4 commits from testing into prod 2024-12-25 03:34:33 -06:00
8 changed files with 120 additions and 1 deletions
Showing only changes of commit 947131120f - Show all commits

View file

@ -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
View file

@ -0,0 +1,4 @@
- name: test
ansible.builtin.file:
path: /tmp/ext4-{{item.name}}
state: directory

View file

@ -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:
item: "{{ mounts.nfs }}"
# - include_tasks: sshfs.yml
# loop: "{{ mounts }}"
# when: item == "sshfs"
when: mounts is defined

18
tasks/main.yml.bak Normal file
View file

@ -0,0 +1,18 @@
---
# tasks file for mount
- name: Set up mounts if variable is defined
block:
- include_tasks: ext4.yml
loop: "{{ mounts }}"
when: item.type == "ext4"
- include_tasks: nfs.yml
loop: "{{ mounts }}"
when: item.type == "nfs"
- include_tasks: sshfs.yml
loop: "{{ mounts }}"
when: item.type == "sshfs"
when: mounts is defined

59
tasks/nfs.yml Normal file
View file

@ -0,0 +1,59 @@
# 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: "{{ item }}"
notify: restart autofs
- name: create symlinks
ansible.builtin.file:
src: "/mnt/autofs/nfs/{{ item.name }}"
dest: "{{ item.local }}"
state: link
loop: "{{ item }}"
- 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
View file

@ -0,0 +1,4 @@
- name: test
ansible.builtin.file:
path: /tmp/sshfs-{{item.name}}
state: directory

3
templates/auto.nfs Normal file
View file

@ -0,0 +1,3 @@
{% for mount in nfs -%}
{{ mount.name }} -rw,soft,intr,rsize=8192,wsize=8192 {{ mount.host }}:{{ mount.remote }}
{%- endfor -%}

View file

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