# warning assuming inventory_hostname is a true hostname, not just an ip - name: shared - hostname matches inventory ansible.builtin.hostname: name: "{{inventory_hostname}}" diff: true # fails on slackware (but works on freebsd) when: system != 'slackware' - name: shared - check if gnu screen is installed ansible.builtin.shell: executable: /bin/bash cmd: "[[ -x `which screen` ]] && echo there || echo absent" register: gnu_screen changed_when: false check_mode: false - name: shared - clean-up stock screenrc ansible.builtin.shell: executable: /bin/bash cmd: | mv -nv /etc/screenrc /etc/screenrc.dist grep -vE '^#|^$' /etc/screenrc.dist > /etc/screenrc.clean grep -vE '^#|^$' /etc/screenrc.dist > /etc/screenrc creates: /etc/screenrc.clean register: backup_screenrc when: gnu_screen.stdout == 'there' - name: shared - screenrc ansible.builtin.copy: src: screenrc dest: /etc/ mode: 0644 diff: true # previous clean-up tasks needs to apply first # otherwise there's loads of noise (screenrc diff) when: gnu_screen.stdout == 'there' and not ansible_check_mode - name: shared - priviledged and system-wide helper scripts ansible.builtin.copy: src: "{{item}}" dest: /usr/local/sbin/ mode: 0755 with_items: - what_eth_drivers.sh diff: true when: system != 'freebsd' #- name: define MAILFROM in cron # ansible.builtin.cron: # name: MAILFROM # env: yes # job: root@{{inventory_hostname}}