From 839d4049d1a761c5b5d154f9e4daf986559f16b4 Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 10:49:24 +0100 Subject: [PATCH 1/8] Install kubectl --- .../ansible_install_dependencies.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml index 8af03bc2..44c15c13 100644 --- a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml +++ b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml @@ -29,6 +29,49 @@ groups: docker append: yes + - name: Install Kubectl pre requisite packages + become: true + ansible.builtin.apt: + name: + - apt-transport-https + - ca-certificates + - curl + - gnupg + + - name: Check keyrings dir + ansible.builtin.file: + path: /etc/apt/keyrings + state: directory + mode: "0755" + + - name: Download repo signing key + ansible.builtin.get_url: + url: "https://pkgs.k8s.io/core:/stable:/{{ kubectl_minor }}/deb/Release.key" + dest: /tmp/kubernetes-release.key + mode: "0644" + + - name: De armour key into keyring + ansible.builtin.command: + cmd: "gpg --dearmor -o {{ keyring_path }} /tmp/kubernetes-release.key" + creates: "{{ keyring_path }}" + + - name: Ensure keyring is world-readable + ansible.builtin.file: + path: "{{ keyring_path }}" + mode: "0644" + + - name: Add the Kubernetes apt repository + ansible.builtin.apt_repository: + repo: "deb [signed-by={{ keyring_path }}] https://pkgs.k8s.io/core:/stable:/{{ kubectl_minor }}/deb/ /" + filename: kubernetes + state: present + + - name: Install kubectl + ansible.builtin.apt: + name: kubectl + state: present + update_cache: true + - name: Extract Runner ansible.builtin.unarchive: src: https://github.com/actions/runner/releases/download/v{{RUNNER_VERSION}}/actions-runner-linux-x64-{{RUNNER_VERSION}}.tar.gz From 108cf6255ff65584607bfacd478e172dae9e90b9 Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 12:48:25 +0100 Subject: [PATCH 2/8] Adjust kubectl install --- .../playbooks/ansible_install_dependencies.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml index 44c15c13..46429160 100644 --- a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml +++ b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml @@ -46,23 +46,22 @@ - name: Download repo signing key ansible.builtin.get_url: - url: "https://pkgs.k8s.io/core:/stable:/{{ kubectl_minor }}/deb/Release.key" - dest: /tmp/kubernetes-release.key + url: "https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key" + dest: /etc/apt/keyringskubernetes-release.key mode: "0644" - name: De armour key into keyring ansible.builtin.command: - cmd: "gpg --dearmor -o {{ keyring_path }} /tmp/kubernetes-release.key" - creates: "{{ keyring_path }}" + cmd: "gpg --dearmor -o /etc/apt/keyringskubernetes-release.key" - name: Ensure keyring is world-readable ansible.builtin.file: - path: "{{ keyring_path }}" + path: "/etc/apt/keyringskubernetes-release.key" mode: "0644" - name: Add the Kubernetes apt repository ansible.builtin.apt_repository: - repo: "deb [signed-by={{ keyring_path }}] https://pkgs.k8s.io/core:/stable:/{{ kubectl_minor }}/deb/ /" + repo: "deb [signed-by=/etc/apt/keyringskubernetes-release.key] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /" filename: kubernetes state: present From 56ac2f600c084e5f017065ec340bca59fb5fda4e Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 13:18:53 +0100 Subject: [PATCH 3/8] Add 'sudo' --- .../playbooks/ansible_install_dependencies.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml index 46429160..4c8dd327 100644 --- a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml +++ b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml @@ -45,16 +45,19 @@ mode: "0755" - name: Download repo signing key + become: true ansible.builtin.get_url: url: "https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key" dest: /etc/apt/keyringskubernetes-release.key mode: "0644" - name: De armour key into keyring + become: true ansible.builtin.command: cmd: "gpg --dearmor -o /etc/apt/keyringskubernetes-release.key" - name: Ensure keyring is world-readable + become: true ansible.builtin.file: path: "/etc/apt/keyringskubernetes-release.key" mode: "0644" From 93d6a3333fcef9ab58bcdd44a28b7c356b2dcaea Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 13:42:47 +0100 Subject: [PATCH 4/8] Move from ansible playbook --- .../ansible_install_dependencies.yaml | 45 ------------------- .../packer-scripts/setup_gh_runner_vm.sh | 9 ++++ 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml index 4c8dd327..db17681f 100644 --- a/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml +++ b/self-hosted-gh-runners/playbooks/ansible_install_dependencies.yaml @@ -28,51 +28,6 @@ name: ubuntu groups: docker append: yes - - - name: Install Kubectl pre requisite packages - become: true - ansible.builtin.apt: - name: - - apt-transport-https - - ca-certificates - - curl - - gnupg - - - name: Check keyrings dir - ansible.builtin.file: - path: /etc/apt/keyrings - state: directory - mode: "0755" - - - name: Download repo signing key - become: true - ansible.builtin.get_url: - url: "https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key" - dest: /etc/apt/keyringskubernetes-release.key - mode: "0644" - - - name: De armour key into keyring - become: true - ansible.builtin.command: - cmd: "gpg --dearmor -o /etc/apt/keyringskubernetes-release.key" - - - name: Ensure keyring is world-readable - become: true - ansible.builtin.file: - path: "/etc/apt/keyringskubernetes-release.key" - mode: "0644" - - - name: Add the Kubernetes apt repository - ansible.builtin.apt_repository: - repo: "deb [signed-by=/etc/apt/keyringskubernetes-release.key] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /" - filename: kubernetes - state: present - - - name: Install kubectl - ansible.builtin.apt: - name: kubectl - state: present - update_cache: true - name: Extract Runner ansible.builtin.unarchive: diff --git a/self-hosted-gh-runners/scripts/packer-scripts/setup_gh_runner_vm.sh b/self-hosted-gh-runners/scripts/packer-scripts/setup_gh_runner_vm.sh index 91e6c2e3..2e835984 100644 --- a/self-hosted-gh-runners/scripts/packer-scripts/setup_gh_runner_vm.sh +++ b/self-hosted-gh-runners/scripts/packer-scripts/setup_gh_runner_vm.sh @@ -7,6 +7,15 @@ sudo apt-get install -y ansible ansible --version +sudo apt-get install -y apt-transport-https ca-certificates curl gnupg +curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg +sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg +echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list +sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list + +sudo apt-get update +sudo apt-get install -y kubectl + sudo chmod +x ~/runner-scripts/job_started.sh sudo chmod +x ~/runner-scripts/job_completed.sh sudo chown ubuntu:ubuntu ~/runner-scripts/job_started.sh From b812fd00cc015bf5c298d02beff985ad1ab6f104 Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 14:13:04 +0100 Subject: [PATCH 5/8] Number of vms must be a number --- .github/workflows/create-gh-action-runners.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-gh-action-runners.yaml b/.github/workflows/create-gh-action-runners.yaml index 21f1fc8d..0cb02460 100644 --- a/.github/workflows/create-gh-action-runners.yaml +++ b/.github/workflows/create-gh-action-runners.yaml @@ -6,6 +6,7 @@ on: description: "Number of Runners to Deploy" required: true default: 5 + type: number runner_flavor: description: "The Flavor of VM to create. l3.nano (More Runners, Less Power) | l3.micro (Middle Ground) | l3.tiny (Less Runners, More Power)" From cae835383a3c4fbee6e5ea1396b8a6e0c658fde9 Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 14:22:19 +0100 Subject: [PATCH 6/8] Echo TF_VAR --- .github/workflows/create-gh-action-runners.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-gh-action-runners.yaml b/.github/workflows/create-gh-action-runners.yaml index 0cb02460..1a2c8968 100644 --- a/.github/workflows/create-gh-action-runners.yaml +++ b/.github/workflows/create-gh-action-runners.yaml @@ -50,7 +50,9 @@ jobs: run: terraform init - name: Terraform plan - run: terraform plan -out=tfplan 1> /dev/null + run: | + echo $TF_VAR_runner_count + terraform plan -out=tfplan 1> /dev/null - name: Terraform apply run: terraform apply -auto-approve tfplan 1> /dev/null From 8bfb5cec21683a441e5377dbb7fca708ee3fc844 Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 14:26:36 +0100 Subject: [PATCH 7/8] Echo TF_VAR --- .github/workflows/create-gh-action-runners.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-gh-action-runners.yaml b/.github/workflows/create-gh-action-runners.yaml index 1a2c8968..cdd29e11 100644 --- a/.github/workflows/create-gh-action-runners.yaml +++ b/.github/workflows/create-gh-action-runners.yaml @@ -51,7 +51,7 @@ jobs: - name: Terraform plan run: | - echo $TF_VAR_runner_count + echo "$TF_VAR_runner_count" terraform plan -out=tfplan 1> /dev/null - name: Terraform apply From 2fd7d364812bee28cc644380886566d532236008 Mon Sep 17 00:00:00 2001 From: David Symons Date: Wed, 10 Jun 2026 14:28:29 +0100 Subject: [PATCH 8/8] Change inputs assignment --- .github/workflows/create-gh-action-runners.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-gh-action-runners.yaml b/.github/workflows/create-gh-action-runners.yaml index cdd29e11..2a96525c 100644 --- a/.github/workflows/create-gh-action-runners.yaml +++ b/.github/workflows/create-gh-action-runners.yaml @@ -24,8 +24,8 @@ jobs: env: OS_CLIENT_CONFIG_FILE: ${{ github.workspace }}/clouds.yaml FLAVOR_NAME: l3.nano - TF_VAR_runner_count: ${{ github.events.inputs.runner_count }} - TF_VAR_flavor_name: ${{ github.events.inputs.runner_flavor }} + TF_VAR_runner_count: ${{ inputs.runner_count }} + TF_VAR_flavor_name: ${{ inputs.runner_flavor }} TF_VAR_floating_ip: ${{ secrets.UA_FLOATING_IP }} steps: - name: Checkout repo