ansible/roles/common/tasks/mounts.yml

63 lines
1.2 KiB
YAML
Raw Permalink Normal View History

2023-09-25 08:40:20 +00:00
# 2023-09-25
# Tasks: mounts
---
- ansible.builtin.include_vars: mounts.yml
- name: Create mount directories
ansible.builtin.file:
path: "{{ item }}"
owner: root
group: root
state: directory
mode: u=rwx,g=rwx,o=rwx
with_items: "{{ mounts_create }}"
when:
- ansible_facts['system'] == "Linux"
tags:
- system
- mounts
- create
- name: Append informations to fstab
ansible.builtin.lineinfile:
backup: true
path: "{{ fstab_path }}"
state: present
line: "# {{ item }}"
with_items:
- "master: {{ common_mastering }}"
- "updated: {{ ansible_date_time.date }}"
when:
- ansible_facts['system'] == "Linux"
tags:
- system
- mounts
- fstab
- append
- name: Append mount directories to fstab
ansible.builtin.lineinfile:
backup: true
path: "{{ fstab_path }}"
state: present
line: tmpfs {{ item }} tmpfs defaults,noatime 0 0
with_items: "{{ mounts_fstab_append }}"
when:
- ansible_facts['system'] == "Linux"
tags:
- system
- mounts
- fstab
- append
- name: Remount all mount
ansible.builtin.shell: |
mount -a
when:
- ansible_facts['system'] == "Linux"
tags:
- system
- mounts
- remount