Following code may be helpful if you are looking for ansible code to install wget - * For Debian-based distributions like Ubuntu, Kubuntu, Lubuntu and Linux mint - - name: Install wget package (Debian based) action: apt pkg='wget' state=installed only_if: "'$ansible_pkg_mgr' == 'apt'" * For RedHat-based Operating system - name: Install wget package (RedHat based) action: yum name='wget' state=installed only_if: "'$ansible_pkg_mgr' == 'yum'"