mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-07 09:02:29 +00:00
Enhance gitea workflow example
This commit is contained in:
@@ -155,7 +155,7 @@ After this, I wanted to make sure that some of my existing workflows could be mi
|
|||||||
The following workflow uses a matrix to run a job for several of my hosts using ansible playbooks that will do various tasks such as patching os updates and updating container images.
|
The following workflow uses a matrix to run a job for several of my hosts using ansible playbooks that will do various tasks such as patching os updates and updating container images.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Run ansible playbooks
|
name: Run ansible
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
schedule:
|
schedule:
|
||||||
@@ -168,8 +168,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
host:
|
host:
|
||||||
- changedetection
|
- changedetection
|
||||||
- grafana
|
- homelab
|
||||||
- homer
|
|
||||||
- invidious
|
- invidious
|
||||||
- jackett
|
- jackett
|
||||||
- ladder
|
- ladder
|
||||||
@@ -180,7 +179,7 @@ jobs:
|
|||||||
- uptime-kuma
|
- uptime-kuma
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install ansible
|
- name: Install ansible
|
||||||
run: |
|
run: |
|
||||||
apt update && apt install ansible -y
|
apt update && apt install ansible -y
|
||||||
@@ -192,7 +191,26 @@ jobs:
|
|||||||
key: ${{ secrets.SSH_PRIVATE_KEY}}
|
key: ${{ secrets.SSH_PRIVATE_KEY}}
|
||||||
options: |
|
options: |
|
||||||
--inventory inventory
|
--inventory inventory
|
||||||
|
--ssh-extra-args "-o StrictHostKeyChecking=no"
|
||||||
--limit ${{ matrix.host }}
|
--limit ${{ matrix.host }}
|
||||||
|
send-failure-notification:
|
||||||
|
needs: run-ansible-playbook
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: always() && failure()
|
||||||
|
steps:
|
||||||
|
- name: Send failure notification
|
||||||
|
uses: dawidd6/action-send-mail@v3
|
||||||
|
with:
|
||||||
|
server_address: smtp.gmail.com
|
||||||
|
server_port: 465
|
||||||
|
secure: true
|
||||||
|
username: myuser
|
||||||
|
password: ${{ secrets.MAIL_PASSWORD }}
|
||||||
|
subject: gitea job ${{github.repository}} failed!
|
||||||
|
to: me@davegallant.ca
|
||||||
|
from: Gitea
|
||||||
|
body: |
|
||||||
|
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}
|
||||||
```
|
```
|
||||||
|
|
||||||
And voilà:
|
And voilà:
|
||||||
|
@@ -193,7 +193,7 @@ log:
|
|||||||
<p>Now it’s time start running some automation. I used the <a href="https://docs.gitea.com/usage/actions/quickstart#use-actions">demo workflow</a> as a starting point to verify that the runner is executing workflows.</p>
|
<p>Now it’s time start running some automation. I used the <a href="https://docs.gitea.com/usage/actions/quickstart#use-actions">demo workflow</a> as a starting point to verify that the runner is executing workflows.</p>
|
||||||
<p>After this, I wanted to make sure that some of my existing workflows could be migrated over.</p>
|
<p>After this, I wanted to make sure that some of my existing workflows could be migrated over.</p>
|
||||||
<p>The following workflow uses a matrix to run a job for several of my hosts using ansible playbooks that will do various tasks such as patching os updates and updating container images.</p>
|
<p>The following workflow uses a matrix to run a job for several of my hosts using ansible playbooks that will do various tasks such as patching os updates and updating container images.</p>
|
||||||
<pre><code class="language-yaml">name: Run ansible playbooks
|
<pre><code class="language-yaml">name: Run ansible
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
schedule:
|
schedule:
|
||||||
@@ -206,8 +206,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
host:
|
host:
|
||||||
- changedetection
|
- changedetection
|
||||||
- grafana
|
- homelab
|
||||||
- homer
|
|
||||||
- invidious
|
- invidious
|
||||||
- jackett
|
- jackett
|
||||||
- ladder
|
- ladder
|
||||||
@@ -218,7 +217,7 @@ jobs:
|
|||||||
- uptime-kuma
|
- uptime-kuma
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install ansible
|
- name: Install ansible
|
||||||
run: |
|
run: |
|
||||||
apt update && apt install ansible -y
|
apt update && apt install ansible -y
|
||||||
@@ -230,7 +229,26 @@ jobs:
|
|||||||
key: ${{ secrets.SSH_PRIVATE_KEY}}
|
key: ${{ secrets.SSH_PRIVATE_KEY}}
|
||||||
options: |
|
options: |
|
||||||
--inventory inventory
|
--inventory inventory
|
||||||
|
--ssh-extra-args "-o StrictHostKeyChecking=no"
|
||||||
--limit ${{ matrix.host }}
|
--limit ${{ matrix.host }}
|
||||||
|
send-failure-notification:
|
||||||
|
needs: run-ansible-playbook
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: always() && failure()
|
||||||
|
steps:
|
||||||
|
- name: Send failure notification
|
||||||
|
uses: dawidd6/action-send-mail@v3
|
||||||
|
with:
|
||||||
|
server_address: smtp.gmail.com
|
||||||
|
server_port: 465
|
||||||
|
secure: true
|
||||||
|
username: myuser
|
||||||
|
password: ${{ secrets.MAIL_PASSWORD }}
|
||||||
|
subject: gitea job ${{github.repository}} failed!
|
||||||
|
to: me@davegallant.ca
|
||||||
|
from: Gitea
|
||||||
|
body: |
|
||||||
|
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>And voilà:</p>
|
<p>And voilà:</p>
|
||||||
<video controls preload="auto" width="100%" playsinline class="html-video">
|
<video controls preload="auto" width="100%" playsinline class="html-video">
|
||||||
|
Reference in New Issue
Block a user