mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-04-30 21:41:53 +08:00
fix 1900 failures of the following case issue: `name[casing]: All names should start with an uppercase letter.` Signed-off-by: Ryan Lerch <rlerch@redhat.com>
41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
#####################################################
|
|
# Ensure PATH in /etc/crontab contains /usr/local/bin
|
|
#####################################################
|
|
|
|
---
|
|
- name: Check if PATH is set in crontab
|
|
lineinfile:
|
|
path: /etc/crontab
|
|
state: absent
|
|
regexp: '^PATH\s*='
|
|
check_mode: yes
|
|
changed_when: false
|
|
register: path_set_in_crontab
|
|
|
|
- name: Add PATH if not set in crontab
|
|
lineinfile:
|
|
path: /etc/crontab
|
|
state: present
|
|
insertbefore: BOF
|
|
line: 'PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin'
|
|
when: not path_set_in_crontab.found
|
|
|
|
- name: Check if PATH in crontab contains /usr/local/bin
|
|
lineinfile:
|
|
path: /etc/crontab
|
|
state: absent
|
|
regexp: '^PATH\s*=\s*(.*:)?/usr/local/bin(:.*)?\s*'
|
|
check_mode: yes
|
|
changed_when: false
|
|
register: local_in_path_in_crontab
|
|
when: path_set_in_crontab.found
|
|
|
|
- name: Append /usr/local/bin to PATH in crontab if missing
|
|
lineinfile:
|
|
path: /etc/crontab
|
|
state: present
|
|
backrefs: yes
|
|
regexp: '^(PATH\s*=\s*(?:.*\S)?)\s*$'
|
|
line: '\1:/usr/local/bin'
|
|
when: path_set_in_crontab.found and not local_in_path_in_crontab.found
|