# warning assuming inventory_hostname is a true hostname, not just an ip - name: shared - hostname matches inventory hostname: name: "{{inventory_hostname}}" # fails on slackware (but works on freebsd) when: system != 'slackware' - copy: content: | {{inventory_hostname}} dest: /etc/hostname when: system == 'debian' - copy: content: | {{inventory_hostname}} dest: /etc/HOSTNAME when: system == 'slackware' - lineinfile: path: /etc/rc.conf regexp: ^hostname= line: "hostname={{inventory_hostname}}" when: system == 'freebsd' - name: shared - check if gnu screen is installed 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 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 copy: src: screenrc dest: /etc/ mode: 0644 # 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 copy: src: "{{item}}" dest: /usr/local/sbin/ mode: 0755 with_items: - what_eth_drivers.sh when: system != 'freebsd' #- name: define MAILFROM in cron # cron: # name: MAILFROM # env: yes # job: root@{{inventory_hostname}}