All checks were successful
Code Quality & Security Scan / TFLint (push) Successful in 24s
Code Quality & Security Scan / Tfsec Security Scan (push) Successful in 30s
Code Quality & Security Scan / Checkov Security Scan (push) Successful in 44s
Code Quality & Security Scan / Terraform Validate (push) Successful in 43s
Code Quality & Security Scan / SonarQube Trigger (push) Successful in 47s
- Remove ansible/ from .gitignore - Add vault_agent role (copied from terraform-vsphere-infra) - Add vault_agent-playbook.yml for deployment - Include ansible collections (cloud.terraform, ansible.posix, etc.) - Archive consul_template role as consul_template-legacy The ansible directory contains the vault-agent deployment automation that replaces the legacy consul-template approach.
52 lines
1.3 KiB
Markdown
52 lines
1.3 KiB
Markdown
# Upgrade Ubuntu server
|
|
- name: Upgrade Apt Packages
|
|
become: true
|
|
ansible.builtin.apt:
|
|
upgrade: yes
|
|
update_cache: yes
|
|
|
|
# Check if reboot is required
|
|
- name: Check if reboot is required
|
|
become: true
|
|
stat:
|
|
path: /var/run/reboot_required
|
|
register: reboot_required
|
|
|
|
# Send Discord message when reboot is required
|
|
- name: Send Discord message
|
|
ansible.builtin.uri:
|
|
url: "https://discord.com/api/webhooks/webhook"
|
|
method: POST
|
|
body_format: json
|
|
body: '{"content": "Reboot reuired on {{ inventory_hostname }}"}'
|
|
headers:
|
|
Content-Type: application/json
|
|
status_code: 204
|
|
when: reboot_required,stat.exists
|
|
|
|
|
|
|
|
# Check Disk Space
|
|
tasks:
|
|
- name: Get disk usage
|
|
ansible.builtin.command: df -h
|
|
register: disk_usage
|
|
|
|
- name: Check disk space available
|
|
ansible.builtin.shell: df -h / |awk 'NR==2 {print $5}'
|
|
register: disk_usage
|
|
|
|
# Send Discord message
|
|
- name: Send Discord message
|
|
uri:
|
|
url: "https://discord.com/api/webhooks/otherstuff"
|
|
method: POST
|
|
body_format: json
|
|
body: '{"content": "Disk space on {{ inventory_hostname }} is above 80%!"}'
|
|
headers:
|
|
Content-Type: application/json
|
|
status_code: 204
|
|
when: disk_usage.stdout[:-1]| int > 80
|
|
|
|
|