- name: Find unwanted motd scripts ansible.builtin.find: paths: /etc/update-motd.d/ file_type: any register: collected_files - name: Delete unwanted motd scripts ansible.builtin.file: path: "{{ item.path }}" state: absent with_items: "{{ collected_files.files }}" - name: Remove Debian legal notice (/etc/motd) ansible.builtin.file: path: /etc/motd state: absent - name: Set facts about platform ansible.builtin.set_fact: is_orangepi: false is_rockpi: false - name: Try to detect Orange Pi ansible.builtin.lineinfile: path: /etc/armbian-release regex: 'orange' state: absent changed_when: false register: orangepi_armbian - name: Set fact about Orange Pi ansible.builtin.set_fact: is_orangepi: true when: 'orangepi_armbian.found == 1' - name: Try to detect Rock Pi ansible.builtin.lineinfile: path: /etc/armbian-release regex: 'rockpi' state: absent changed_when: false register: rockpi_armbian - name: Set fact about Rock Pi ansible.builtin.set_fact: is_rockpi: true when: 'rockpi_armbian.found == 1' - name: Add custom /etc/motd for Orange Pi ansible.builtin.copy: src: motd.orangepi dest: /etc/motd owner: root group: root mode: 0755 when: is_orangepi == True - name: Add custom /etc/motd for Rock Pi ansible.builtin.copy: src: motd.radxa dest: /etc/motd owner: root group: root mode: 0755 when: is_rockpi == True - name: Add common custom /etc/motd ansible.builtin.copy: src: motd.cube dest: /etc/motd owner: root group: root mode: 0755 when: 'is_orangepi == False and is_rockpi == False'