forked from evolix/ansible-roles
Jérémy Lecour
5ffc94281f
The fstab file usually has fields separated by spaces but sometimes they are separated by tabs.
61 lines
1.6 KiB
YAML
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:
|
|
- fstab_content.stdout | regex_search('\s/home\s')
|
|
- 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:
|
|
- fstab_content.stdout | regex_search('\s/tmp\s')
|
|
- 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:
|
|
- fstab_content.stdout | regex_search('\s/usr\s')
|
|
- 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:
|
|
- fstab_content.stdout | regex_search('\s/var\s')
|
|
- 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
|