--- # Title: Create /etc/profile.d/nano.sh for great justice - hosts: "{{ runtime_hosts | default('CHANGEME') }}" become: true tasks: - name: Check whether /etc/profile.d/nano.sh exists stat: path: /etc/profile.d/nano.sh register: nanosh - name: Create /etc/profile.d/nano.sh for great justice file: path: /etc/profile.d/nano.sh owner: root group: root mode: 0644 state: touch when: nanosh.stat.exists == false - name: Edit /etc/profile.d/nano.sh for great justice blockinfile: path: /etc/profile.d/nano.sh block: | alias nano="cat /usr/bin/vi" insertbefore: BOF