--- - set_fact: arch_map: aarch64: arm64 armv6l: armhf armv7l: armhf i386: i386 x86_64: amd64 - set_fact: arch: '{{ [ansible_architecture] | map("extract", arch_map) | first }}' - name: download apt repository key become: true get_url: url: https://cli.github.com/packages/githubcli-archive-keyring.gpg dest: /usr/share/keyrings/githubcli-archive-keyring.gpg mode: 0644 - name: add apt repository list become: true apt_repository: filename: github-cli repo: 'deb [arch={{arch}} signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main' state: present - name: install apt package become: true apt: name: gh state: latest update_cache: true register: gh_apt - name: install zsh completions when: gh_apt.changed become: true shell: gh completion -s zsh > /usr/local/share/zsh/site-functions/_gh