ansible-roles/evolinux-base/tasks/fstab.yml

61 lines
1.6 KiB
YAML

---
# TODO: trouver comment faire une copie initiale de /etc/fstab
# TODO: try to use the custom mount_uuid module for a different approach
- name: Fetch fstab content
command: "grep -v '^#' /etc/fstab"
check_mode: no
register: fstab_content
failed_when: False
changed_when: False
- name: /home partition is customized
replace:
dest: /etc/fstab
regexp: '([^#]\s+/home\s+\S+\s+)([a-z,]+)(\s+)'
replace: '\1{{ evolinux_fstab_home_options | mandatory }}\3'
notify: remount /home
when:
- "' /home ' in fstab_content.stdout"
- evolinux_fstab_home
- name: /tmp partition is customized
replace:
dest: /etc/fstab
regexp: '([^#]\s+/tmp\s+\S+\s+)([a-z,]+)(\s+)'
replace: '\1{{ evolinux_fstab_tmp_options | mandatory }}\3'
when:
- "' /tmp ' in fstab_content.stdout"
- evolinux_fstab_tmp
- name: /usr partition is customized
replace:
dest: /etc/fstab
regexp: '([^#]\s+/usr\s+\S+\s+)([a-z,]+)(\s+)'
replace: '\1{{ evolinux_fstab_usr_options | mandatory }}\3'
when:
- "' /usr ' in fstab_content.stdout"
- evolinux_fstab_usr
- name: /var partition is customized
replace:
dest: /etc/fstab
regexp: '([^#]\s+/var\s+\S+\s+)([a-z,]+)(\s+)'
replace: '\1{{ evolinux_fstab_var_options | mandatory }}\3'
notify: remount /var
when:
- "' /var ' in fstab_content.stdout"
- evolinux_fstab_var
- name: /var/tmp is created
mount:
src: tmpfs
name: /var/tmp
fstype: tmpfs
opts: "{{ evolinux_fstab_var_tmp_options | mandatory }}"
state: mounted
when:
- evolinux_fstab_var_tmp
- meta: flush_handlers