diff --git a/gh_install.yaml b/gh_install.yaml new file mode 100644 index 0000000..7ca5439 --- /dev/null +++ b/gh_install.yaml @@ -0,0 +1,37 @@ +--- +- name: Install wget if not present + apt: + name: wget + state: present + when: ansible_facts.packages.wget is not defined + +- name: Create /etc/apt/keyrings directory + file: + path: /etc/apt/keyrings + state: directory + mode: '0755' + +- name: Download GitHub CLI archive keyring + get_url: + url: https://cli.github.com/packages/githubcli-archive-keyring.gpg + dest: /tmp/githubcli-archive-keyring.gpg + +- name: Copy GitHub CLI archive keyring to /etc/apt/keyrings + copy: + src: /tmp/githubcli-archive-keyring.gpg + dest: /etc/apt/keyrings/githubcli-archive-keyring.gpg + mode: '0644' + +- name: Add GitHub CLI repository + apt_repository: + repo: "deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" + state: present + +- name: Update apt cache + apt: + update_cache: yes + +- name: Install GitHub CLI + apt: + name: gh + state: present diff --git a/github_runner.yaml b/github_runner.yaml index 182b598..fca2ec6 100644 --- a/github_runner.yaml +++ b/github_runner.yaml @@ -263,6 +263,15 @@ - terraform tags: - always + + - name: Include gh_install.yaml tasks + ansible.builtin.include_tasks: gh_install.yaml + args: + apply: + tags: + - gh-install + tags: + - always handlers: - name: Set correct permissions for sudoers file