File: ansible.template

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (25 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# platform = multi_platform_all
# reboot = false
# strategy = configure
# complexity = low
# disruption = medium

- name: "Get nfs and nfs4 mount points, that don't have {{{ MOUNTOPTION }}}"
  # 'no' before MOUNTOPTION isn't omission, it means a negation
  command: findmnt --fstab --types nfs,nfs4 -O no{{{ MOUNTOPTION }}} -n -P
  register: points_register
  check_mode: no
  changed_when: False
  # if no nfs/nfs4 entries are in /etc/fstab, findmnt command returns 1
  failed_when: False

- name: "Add {{{ MOUNTOPTION }}} to nfs and nfs4 mount points"
  mount:
    path: "{{ item | regex_search('TARGET=\"([^\"]+)\"','\\1') | first }}"
    src: "{{ item | regex_search('SOURCE=\"([^\"]+)\"','\\1') | first }}"
    fstype: "{{ item | regex_search('FSTYPE=\"([^\"]+)\"','\\1') | first }}"
    state: present
    opts: "{{ item | regex_search('OPTIONS=\"([^\"]+)\"','\\1') | first }},{{{ MOUNTOPTION }}}"
  # ansible doesn't escape correctly the tab character
  when: (points_register.stdout | length > 0) and '\\x09' not in item
  with_items: "{{ points_register.stdout_lines }}"