forked from evolix/ansible-roles
Don't add the trap if it is present or commented
This commit is contained in:
parent
beff333a1a
commit
b7cede7654
|
@ -1,15 +1,16 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: is evomaintenance installed?
|
- name: search profile for presence of evomaintenance
|
||||||
stat:
|
command: 'grep -q "trap.*sudo.*evomaintenance.sh"'
|
||||||
path: "/usr/share/scripts/evomaintenance.sh"
|
changed_when: False
|
||||||
register: evomaintenance_script
|
failed_when: False
|
||||||
check_mode: no
|
register: grep_profile_evomaintenance
|
||||||
|
|
||||||
|
# Don't add the trap if it is present or commented
|
||||||
- name: "Add evomaintenance trap for '{{ user.name }}'"
|
- name: "Add evomaintenance trap for '{{ user.name }}'"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
state: present
|
state: present
|
||||||
dest: '/home/{{ user.name }}/.profile'
|
dest: '/home/{{ user.name }}/.profile'
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
line: 'trap "sudo /usr/share/scripts/evomaintenance.sh" 0'
|
line: 'trap "sudo /usr/share/scripts/evomaintenance.sh" 0'
|
||||||
when: evomaintenance_script.stat.exists
|
when: grep_profile_evomaintenance.rc != 0
|
||||||
|
|
Loading…
Reference in a new issue