Hello,
Do you recommend Migrating playbook from ubuntu to amazon Linux 2 (as it uses yum instead of apt). If so, how can I check if missing add a package to a new instance to make sure it installs python-apt**?**
Ansible-Playbook
Hello,
Do you recommend Migrating playbook from ubuntu to amazon Linux 2 (as it uses *yum instead of apt*). If so, how can I
check if missing add a package to a new instance to make sure it installs python-apt*?*
*Ansible-Playbook*
If Amazon Linux2 is a RedHat based distribution (as the usage of yum suggests) it makes no sense to
use python-apt as it caters to Debian based distributions.
Regards
Racke
Also, the package management isn't the only difference between Debian
and Redhat based distros.
So if you have any other playbooks that have implicitly Debianisms you
will need to rewrite those as well.
Things that come to mind are the ways packages themselves are
configured - config file location and inclusion structure, the init
system etc.
Why are you using the command module?
Use the package module. Then it will not matter what package manager the distro is running.
If you have ansible module available for what you want to do, never use command. I would rewrite the entire play.
Why are you using the command module?
Use the package module. Then it will not matter what package manager the distro is running.
If you have ansible module available for what you want to do, never use command. I would rewrite the entire play.
You can use the package module, but it will not be able to list packages and the names of packages might
differ between different distros etc.
Regards
Racke
So, I am breaking it down in the playbook - it doesn’t like spaces in name of the package?
playbook:
Correct.
There is no package called "yum update".
Thanks for the update. I was able to figure it out!
You can use package facts for that:
https://docs.ansible.com/ansible/latest/modules/package_facts_module.html