Upgrade nodes #10
This file contains 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: "Upgrade nodes" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * 6" | |
env: | |
ansible_version: "2.9.6" | |
python_version: "3.8.18" | |
jobs: | |
upgrade_nodes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.2 | |
- name: "Configure SSH access to nodes" | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" >> ~/.ssh/id_rsa | |
sudo chmod 600 ~/.ssh/id_rsa | |
cat <<-EOF > /home/runner/.ssh/config | |
Host k3s-master | |
HostName sylvan.ovh | |
User osadmin | |
Port 2220 | |
Host k3s-worker1 | |
HostName sylvan.ovh | |
User osadmin | |
Port 2221 | |
Host k3s-worker2 | |
HostName sylvan.ovh | |
User osadmin | |
Port 2222 | |
EOF | |
- name: "Install Python" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "${{ env.python_version }}" | |
- name: "Cache python packages" | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: "${{ runner.os }}-python${{ env.python_version }}-ansible${{ env.ansible_version }}" | |
- name: "Install packages" | |
shell: bash | |
run: | | |
python -m pip install ansible==${{ env.ansible_version }} | |
- name: "Run ansible playbook" | |
run: "make upgrade-nodes" |