forked from evolix/ansible-roles
72 lines
1.9 KiB
YAML
72 lines
1.9 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
|
|
|
|
- name: /dev/shm is created (Debian 10 and later)
|
|
mount:
|
|
src: tmpfs
|
|
name: /dev/shm
|
|
fstype: tmpfs
|
|
opts: "{{ evolinux_fstab_dev_shm_options | mandatory }}"
|
|
state: mounted
|
|
when:
|
|
- evolinux_fstab_dev_shm
|
|
- ansible_distribution_major_version | version_compare('10', '>=')
|
|
|
|
- meta: flush_handlers
|