- name: do prepare work hosts: all remote_user: fedora become: yes gather_facts: no tasks: - name: install ftp package raw: dnf install -y ftp - name: get the dnf list result raw: dnf list ftp > /tmp/check_file - name: get rpm result raw: "rpm -q ftp >> /tmp/check_file" - name: install mc package raw: dnf install -y mc - name: get the dnf list result raw: "dnf list mc >> /tmp/check_file" - name: get rpm result raw: "rpm -q mc >> /tmp/check_file" - name: fetch output file from remote server to the local machine fetch: src: /tmp/check_file dest: /tmp/ flat: yes - name: remove ftp and mc package raw: dnf remove -y ftp mc - name: get the dnf list result raw: "dnf list ftp > /tmp/remove_file" - name: get rpm result raw: "rpm -q ftp >> /tmp/remove_file" - name: get the dnf list result raw: "dnf list mc >> /tmp/remove_file" - name: get rpm result raw: "rpm -q mc >> /tmp/remove_file" - name: fetch output file from remote server to the local machine fetch: src: /tmp/remove_file dest: /tmp/ flat: yes