From e214f7e4e46e885155e488f2ba67fe60520f7ce1 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 8 Dec 2022 11:40:28 +0000 Subject: [PATCH] Add gh role for macOS, Windows, and Debian --- roles/gh/tasks/Darwin.yaml | 5 +++++ roles/gh/tasks/Debian.yaml | 31 +++++++++++++++++++++++++++++++ roles/gh/tasks/Windows.yaml | 5 +++++ roles/gh/tasks/main.yaml | 2 ++ 4 files changed, 43 insertions(+) create mode 100644 roles/gh/tasks/Darwin.yaml create mode 100644 roles/gh/tasks/Debian.yaml create mode 100644 roles/gh/tasks/Windows.yaml create mode 100644 roles/gh/tasks/main.yaml diff --git a/roles/gh/tasks/Darwin.yaml b/roles/gh/tasks/Darwin.yaml new file mode 100644 index 0000000..9b46ff3 --- /dev/null +++ b/roles/gh/tasks/Darwin.yaml @@ -0,0 +1,5 @@ +--- +- name: install homebrew package + homebrew: + name: gh + state: latest diff --git a/roles/gh/tasks/Debian.yaml b/roles/gh/tasks/Debian.yaml new file mode 100644 index 0000000..e7841b3 --- /dev/null +++ b/roles/gh/tasks/Debian.yaml @@ -0,0 +1,31 @@ +--- +- 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 diff --git a/roles/gh/tasks/Windows.yaml b/roles/gh/tasks/Windows.yaml new file mode 100644 index 0000000..8568ef8 --- /dev/null +++ b/roles/gh/tasks/Windows.yaml @@ -0,0 +1,5 @@ +--- +- name: install chocolatey package + win_chocolatey: + name: gh + state: latest diff --git a/roles/gh/tasks/main.yaml b/roles/gh/tasks/main.yaml new file mode 100644 index 0000000..6853678 --- /dev/null +++ b/roles/gh/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include_tasks: '{{ansible_os_family}}.yaml'