--- - name: gather package facts package_facts: manager: auto - set_fact: ansible_home_dir: "{{ lookup('env', 'HOME') }}" yay_installed: "{{ 'yay' in ansible_facts.packages }}" - when: "not yay_installed" block: - name: get AUR helper git repo git: repo: 'https://aur.archlinux.org/yay.git' dest: "{{ ansible_home_dir }}/ansible/yay" - name: install AUR helper package command: 'makepkg -rsi --noconfirm' args: chdir: "{{ ansible_home_dir }}/ansible/yay" - name: install our AUR packages when: "item not in ansible_facts.packages" command: 'yay -a -S --noconfirm --answerclean All --answerdiff None --answeredit None {{ item }}' with_items: "{{ packages_aur }}"