Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
ARG PYTHON_VERSION=3.13
FROM mcr.microsoft.com/devcontainers/python:1-${PYTHON_VERSION}

RUN apt-get update \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libssh-dev


COPY requirements.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ansible-playbooks",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"customizations": {
Expand Down
8 changes: 5 additions & 3 deletions .devcontainer/post-create-command.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env sh

set -eu

pip3 install --no-cache-dir -r requirements.txt
set -e

ansible-galaxy collection install --upgrade -r requirements.yml
ansible-galaxy role install --force-with-deps -p external_roles -r requirements.yml

if [ -z "${CI}" ]; then
ansible-playbook plays/kairos/get_kubeconfig.yml
fi
21 changes: 18 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Lint checks
run: |
./earthly.sh +lint

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build image and run lint in dev container
uses: devcontainers/ci@v0.3.1900000349
with:
cacheFrom: ghcr.io/${{ github.repository }}-devcontainer
env: |
CI=1
imageName: ghcr.io/${{ github.repository }}-devcontainer
push: filter
refFilterForPush: refs/heads/main
runCmd: earthly +lint
23 changes: 23 additions & 0 deletions plays/kairos/get_kubeconfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- hosts: kairos_controlplane
gather_facts: false
order: sorted
tasks:
- name: Grab k3s config
ansible.builtin.slurp:
src: /etc/rancher/k3s/k3s.yaml
become: true
register: remote_config
- name: Ensure .kube exists
ansible.builtin.file:
mode: u+rwx,go+rx
path: ~/.kube
state: directory
delegate_to: localhost
- name: Generate local config
ansible.builtin.copy:
content: "{{ remote_config['content'] | b64decode | replace('127.0.0.1', vip )}}"
dest: ~/.kube/config
delegate_to: localhost
vars:
vip: "{{ hostvars[inventory_hostname].k3s_controlplane_san | first }}"