ansible-roles/evomaintenance/tasks/trap.yml
Jérémy Lecour 8920ff1ee4 Add "always_run: yes" where it's pertinent
There is also the "check_mode: no", but commented,
for when we switch to Ansible 2.2
2017-01-31 11:45:35 +01:00

31 lines
864 B
YAML

- name: is {{ home }}/.bash_profile present?
stat:
path: "{{ home }}/.bash_profile"
#check_mode: no (for migration to Ansible 2.2)
always_run: yes
register: bash_profile
- name: install shell trap in {{ home }}/.bash_profile
lineinfile:
dest: "{{ home }}/.bash_profile"
line: "trap \"sudo /usr/share/scripts/evomaintenance.sh\" 0"
insertafter: EOF
create: no
when: bash_profile.stat.exists
- name: is {{ home }}/.profile present?
stat:
path: "{{ home }}/.profile"
#check_mode: no (for migration to Ansible 2.2)
always_run: yes
register: profile
when: not bash_profile.stat.exists
- name: install shell trap in {{ home }}/.profile
lineinfile:
dest: "{{ home }}/.profile"
line: "trap \"sudo /usr/share/scripts/evomaintenance.sh\" 0"
insertafter: EOF
create: yes
when: not bash_profile.stat.exists