--- - name: Existing install ansible.builtin.stat: path: /usr/bin/gh register: install - name: Keyring ansible.builtin.get_url: dest: /usr/share/keyrings/githubcli-archive-keyring.gpg mode: 644 url: https://cli.github.com/packages/githubcli-archive-keyring.gpg when: not install.stat.exists become: true - name: Repository ansible.builtin.apt_repository: repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" when: not install.stat.exists become: true - name: Install ansible.builtin.package: name: - gh state: latest become: true