- hosts: localhost connection: local become: false tasks: - name: configure sudoers lineinfile: path: /etc/sudoers line: hannes ALL=(ALL) NOPASSWD:ALL regexp: '^hannes\s+' become: true - name: set shell user: name: hannes shell: /usr/bin/zsh become: true - name: load package list include_vars: file: packages.yml - set_fact: distro: "{{ ansible_distribution|lower }}" - set_fact: defined_packages: "{{ packages|json_query('keys(list)') }}" - set_fact: distro_packages: "{{ packages|json_query('list.*.%s'|format(distro)) }}" - name: check list assert: that: "defined_packages|length == distro_packages|length" - name: install packages package: name: "{{ packages|json_query(query) }}" state: installed become: true vars: query: "{{ 'list.*.%s[]'|format(distro) }}" - name: run dotbot command: ./dotbot