Hello devs,
First time posting here, apologies if not the done thing or the wrong place to post.
I’m not looking for a fix to an issue I’ve run into, rather I’m interested to know whether a strategy I’m thinking about sounds feasible or not, and whether there’s any recommendations on better approaches… let’s say I’m on a fact finding mission.
Current state
I run some drift detection/correction & smoke tests from a scheduled ansible play, this play might include up to 20 tasks which get invoked by a main.yml. The schedule is run every hour against a few k8s clusters/endpoints/nodes by awx which posts a message via a slack webhook to tell me if the job ran or failed and posts some output too. The trouble is, I often have to look in awx or read some output, to tell me what happened when something went wrong.
That can take the form of stdout_lines, ansible output etc but always results in me having to look at some output.
Project Layout
.
├── CHANGELOG.md
├── README.md
├── ansible.cfg
├── inventory
│ ├── dev.all.aws_ec2.yaml
│ ├── staging.all.aws_ec2.yaml
│ └── prod.all.aws_ec2.yaml
├── playbooks
| ├── drift.yaml
│ └── smoke_tests.yaml
└── tasks
├── main.yaml
├── check_cluster_health_api.yaml
├── check_active_passive_cluster.yaml
├── check_dns.yaml
├── check_http_statuses.yaml
├── check_internet_connectivity.yaml
├── check_tcp_ports.yaml
├── check_kube_system_pods.yaml
├── check_etcd_cluster_health.yaml
…
Desired state
These tests already assert success or failure and if the job fails, I know some task failed. I’d like to capture the result of each task (say, 0 for success, 1 for fail), template something like an html table or ASCII table and then send that to slack instead.
What main looks like