ansible/playbooks/setup_fog_nfs.yml
ladislav.dusa afc7817a81 conf added
2024-12-11 16:33:42 +01:00

49 lines
1.6 KiB
YAML
Executable File

- hosts: datacenter
name: Setup nfs
gather_facts: false
tasks:
- name: Install nfs
ansible.builtin.apt:
name: nfs-kernel-server
state: present
when: inventory_hostname in groups['fog']
- name: Reconfigure common-session
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "/images .*"
line: "/images *(rw,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0)"
become: true
when: inventory_hostname in groups['fog']
- name: Restart autofs service
ansible.builtin.service:
name: nfs-kernel-server.service
state: restarted
become: true
when: inventory_hostname in groups['fog']
- name: Creating a file with content wol service
ansible.builtin.copy:
dest: "/etc/auto.fog"
content: |
fog-images -fstype=nfs 192.168.77.108:/images
become: true
when: inventory_hostname in groups['morefine']
- name: Restart autofs service
ansible.builtin.service:
name: autofs.service
state: restarted
become: true
when: inventory_hostname in groups['morefine']
# - name: Creating script to fetch ldap info
# ansible.builtin.copy:
# dest: "/usr/local/bin/fetchSSHKeysFromLDAP"
# content: |
# #!/bin/bash
# ldapsearch -b "dc=sectorq,dc=eu" -H ldap://192.168.77.106:389 -x '(&(objectClass=ldapPublicKey)(cn='"$1"'))' 'sshPublicKey' | sed -n '/^ /{H;d};/sshPublicKey:/x;$g;s/\n *//g;s/sshPublicKey: //gp'
# owner: admin
# mode: '0744'
# when: inventory_hostname in groups['nas']