From 2abc38f696890812b2ea39a8d741540920024e6a 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 --- UnixCLI.yaml | 1 + Windows.yaml | 3 ++- roles/gh/tasks/Darwin.yaml | 5 +++++ roles/gh/tasks/Debian.yaml | 31 +++++++++++++++++++++++++++++++ roles/gh/tasks/Windows.yaml | 5 +++++ roles/gh/tasks/main.yaml | 2 ++ 6 files changed, 46 insertions(+), 1 deletion(-) 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/UnixCLI.yaml b/UnixCLI.yaml index 212f202..76cdfd3 100644 --- a/UnixCLI.yaml +++ b/UnixCLI.yaml @@ -14,6 +14,7 @@ - role: bat - role: curl - role: fzf + - role: gh - role: git - role: htop - role: jp diff --git a/Windows.yaml b/Windows.yaml index 5856afe..5995833 100644 --- a/Windows.yaml +++ b/Windows.yaml @@ -14,8 +14,9 @@ - role: bat - role: curl - role: fzf - - role: tree + - role: gh - role: jq + - role: tree - role: yq - role: llvm 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'