Ansible K3S #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ansible K3S | |
| on: | |
| workflow_run: | |
| workflows: ["Ansible Setup"] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - ".github/workflows/ansible-k3s.yaml" | |
| branches: | |
| - main | |
| concurrency: | |
| group: deployment-${{ github.ref }} | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| environment: server | |
| env: | |
| UV_LINK_MODE: copy | |
| OCI_CLI_USER: ${{ secrets.TF_VAR_USER_OCID }} | |
| OCI_CLI_TENANCY: ${{ secrets.TF_VAR_TENANCY_OCID }} | |
| OCI_CLI_FINGERPRINT: ${{ secrets.TF_VAR_FINGERPRINT }} | |
| OCI_CLI_KEY_CONTENT: ${{ secrets.TF_VAR_PRIVATE_KEY }} | |
| OCI_CLI_REGION: ${{ secrets.TF_VAR_REGION }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache Ansible Collections | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.ansible/collections | |
| key: ${{ runner.os }}-ansible-collections-${{ hashFiles('./Ansible/requirements.yml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ansible-collections- | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| activate-environment: true | |
| enable-cache: true | |
| cache-local-path: .venv | |
| - name: Install Project Dependencies | |
| run: uv sync --locked | |
| - name: Get Ansible configuration files | |
| run: oci os object bulk-download -bn "${{ vars.ANSIBLE_BUCKET_NAME }}" -ns "${{ secrets.TF_NAMESPACE }}" --dest-dir .private/ && chmod 600 .private/deployment_key.pem | |
| - name: Setup Ansible Environment | |
| working-directory: Ansible | |
| run: ansible-galaxy install -r requirements.yml | |
| - name: Setup Tailscale | |
| uses: tailscale/github-action@v3 | |
| with: | |
| oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
| tags: tag:ci | |
| use-cache: "true" | |
| version: latest | |
| - name: Apply K3S Playbook | |
| run: ansible-playbook k3s.orchestration.site | |
| working-directory: Ansible |