Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible module for aws extras analgous to the yum_repository

AWS' Linux 2 has a facility "Amazon Linux Extras" which provides additional repos for assorted things (nginx, php, mariadb, etc. etc.).

I'm surprised that I can't find an Ansible module(s) for this feature. I found an repo in github for this, but it's empty.

I can work around this by hand crafting yum_repository module tasks. That demands reverse engineering what AWS's CLI command (aka amazon-linux-extras install ...) is doing. Or I could run that command directly, but that of course will trigger a change every time I run the playbook.

Any suggestions?

like image 718
Ben Hyde Avatar asked Jan 02 '23 00:01

Ben Hyde


1 Answers

A reasonable work around, until a module shows up for amazon-linux-extras.

- command: amazon-linux-extras install nginx1.12=latest -y
  args:
    creates: /sbin/nginx

The creates arg. is the hack to make commands the task reasonably idempotent.

like image 143
Ben Hyde Avatar answered Mar 02 '23 17:03

Ben Hyde