Provision e2e #57
Workflow file for this run
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: Provision Environment | |
| run-name: Provision ${{ inputs.environment }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to provision' | |
| required: true | |
| default: 'e2e' | |
| type: choice | |
| options: | |
| - e2e | |
| - staging | |
| - production | |
| - development | |
| - qa | |
| tags: | |
| description: 'Tags to apply to the provisioned resources' | |
| required: true | |
| default: all | |
| type: choice | |
| options: | |
| - all | |
| - updates | |
| - users | |
| - application | |
| - tools | |
| - fail2ban | |
| - decrypt-on-boot | |
| - metrics-server | |
| - checks | |
| - containerd-setup | |
| - kubernetes-installation | |
| - control-plane-init | |
| - cni-plugin-installation | |
| - join-workers | |
| - system-preparation | |
| - self-hosted-runner | |
| - kubeconfig | |
| jobs: | |
| provision: | |
| runs-on: ubuntu-24.04 | |
| environment: ${{ inputs.environment }} | |
| steps: | |
| - name: Collect ssh key from secrets | |
| run: | | |
| echo "${{ secrets.SSH_KEY }}" > /tmp/id_rsa | |
| chmod 600 /tmp/id_rsa | |
| env: | |
| SSH_KEY: ${{ secrets.SSH_KEY }} | |
| - name: Set variables for ansible | |
| id: ansible-variables | |
| run: | | |
| JSON_WITH_NEWLINES=$(cat<<EOF | |
| ${{ toJSON(env) }} | |
| EOF) | |
| JSON_WITHOUT_NEWLINES=$(echo $JSON_WITH_NEWLINES | jq -R -c .) | |
| echo "EXTRA_VARS=$JSON_WITHOUT_NEWLINES" >> $GITHUB_OUTPUT | |
| env: | |
| encrypted_disk_size: ${{ vars.DISK_SPACE }} | |
| disk_encryption_key: ${{ secrets.ENCRYPTION_KEY }} | |
| k8s_runner_token: ${{ secrets.K8S_RUNNER_TOKEN }} | |
| repository: ${{ github.repository }} | |
| - name: checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Run Ansible Playbook | |
| uses: dawidd6/action-ansible-playbook@v4 | |
| env: | |
| ANSIBLE_PERSISTENT_COMMAND_TIMEOUT: 10 | |
| ANSIBLE_SSH_TIMEOUT: 10 | |
| ANSIBLE_SSH_RETRIES: 5 | |
| with: | |
| requirements: galaxy-requirements.yml | |
| playbook: playbook-k8s.yml | |
| directory: ./infrastructure/server-setup | |
| options: | | |
| --verbose | |
| --inventory inventory/${{ inputs.environment }}.yml | |
| --private-key /tmp/id_rsa | |
| ${{ inputs.tags != 'all' && format('--tags={0}', inputs.tags) || '' }} | |
| --extra-vars ""${{ steps.ansible-variables.outputs.EXTRA_VARS }}"" |