Closed romainrbr closed 6 years ago
Hey @romainrbr, thanks for the PR!
I currently don't have an Amazon Linux instance to fully test this on. Let me see if I can deploy this in a local container or something. I feel like there's a version of Amazon Linux that wants EPEL 6 packages but, I could be completely wrong there.
Hi @jaredledvina , testing might be possible with something like that : https://hub.docker.com/_/amazonlinux/.
Agreed that hardcoding this value is definitely not the best, but the current playbook wouldn't work either on an Amazon Linux requiring EPEL 6 packages.
Yep, was able to get that spun up and working, was really hoping these facts might make this more flexible:
"ansible_distribution": "Amazon",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/system-release",
"ansible_distribution_file_variety": "Amazon",
"ansible_distribution_major_version": "NA",
"ansible_distribution_release": "NA",
"ansible_distribution_version": "2017.09",
@romainrbr - are you using Amazon Linux 1 or 2?
From my testing, it appears that 1 doesn't use SystemD, so we'd want the 6
version for those to get the /etc/init.d/sensu*
init scripts.
I'm going to see if there's a good way to key off of something such that this works cleanly.
And the diff between the facts on Amazon Linux 1 versus 2:
"ansible_distribution": "Amazon", "ansible_distribution": "Amazon",
"ansible_distribution_file_parsed": true, "ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/system-releas "ansible_distribution_file_path": "/etc/system-releas
"ansible_distribution_file_variety": "Amazon", "ansible_distribution_file_variety": "Amazon",
"ansible_distribution_major_version": "NA", "ansible_distribution_major_version": "NA",
"ansible_distribution_release": "NA", "ansible_distribution_release": "NA",
"ansible_distribution_version": "2017.09", | "ansible_distribution_version": "Candidate",
Ugh, so that's also not ideal here.
We could maybe check if ansible_distribution==Amazon & if ansible_distribution_version is < '2017.12'.
If its anything earlier or equal to '2017.12' we could go with 6 (hopefully nobody is running Amazon Linux AMI from ~2013), else we default it to 7 ?
Hey @romainrbr, Yeah, I like that idea and think doing that will work.
Should be good for now as we don't get any date value for AmazonLinux v2 yet.
Once it get released, we can have a check on that value and act on it : {{(ansible_distribution_version|to_datetime('%Y.%m'))}}
Oh nice, yeah, I like this!
When installing the Sensu repo on Amazon Linux, this repo gets added to yum : https://sensu.global.ssl.fastly.net/yum/$releasever/$basearch/. However, $releasever is defined as something like '2017.09' or 'latest', instead of 5, 6 or 7 on CentOS.
How to reproduce : Add the cmacrae.sensu to an Amazon Linux server, it will fail at the "Ensure Sensu is installed" task. I'm not sure if hardcoding $releasever at '7' is the best solution, but I don't really see any other option as of now.