- hosts: localhost connection: local become: yes vars: discord_url: https://discordapp.com/api/download?format=deb&platform=linux discord_tmp: /tmp/discord tasks: - name: DISCORD - Creates temporary directory file: path: "{{ discord_tmp }}" state: directory - name: DISCORD - Download discord get_url: url: "{{ discord_url }}" dest: "{{ discord_tmp }}/discord.deb" force: yes - name: DISCORD - Install my_package apt: deb: "{{ discord_tmp }}/discord.deb" - name: DISCORD - Remove temporary directory file: path: "{{ discord_tmp }}" state: absent