Renew SSL certificate #16
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: Renew SSL certificate | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 1 15 * *' | |
jobs: | |
renew_ssl: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- uses: actions/checkout@v3 | |
- name: dig +short myip.opendns.com @resolver1.opendns.com | |
run: dig +short myip.opendns.com @resolver1.opendns.com | |
- name: Add NSG Rule | |
uses: venura9/manage-nsg@master | |
id: rule | |
with: | |
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | |
rule-nsg-resource-group-name: threes-game | |
rule-nsg-name: threes-server-nsg | |
rule-inbound-port: '22' | |
- name: Print Created NSG Rule Name | |
run: echo "Rule Name ${{ steps.rule.outputs.rule_name }}" | |
- name: Sleep for 30s | |
uses: juliangruber/[email protected] | |
with: | |
time: 30s | |
- name: Run playbook on server to renew SSL certificate | |
uses: dawidd6/action-ansible-playbook@v2 | |
with: | |
playbook: certbot_renew.yml | |
directory: ./infra/ansible | |
key: ${{ secrets.APP_SERVER_SSH_PRIVATE_KEY }} | |
inventory: | | |
[all] | |
${{ vars.APP_SERVER_HOSTNAME }} ansible_connection=ssh ansible_user=app_server_user | |
requirements: galaxy-requirements.yml | |
- name: Remove NSG Rule | |
uses: venura9/manage-nsg@master | |
if: always() | |
with: | |
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | |
rule-id-for-removal: ${{ steps.rule.outputs.rule_name }} | |
rule-nsg-resource-group-name: threes-game | |
rule-nsg-name: threes-server-nsg |