Python Scripts vs Infrastructure as Code, (Ansible and Terraform)
ฝัง
- เผยแพร่เมื่อ 5 มิ.ย. 2024
- You can use BASH shell scripts or you can create Python Scripts, or even Perl scripts but you have to do the work. Using Ansible and other IaC ,Infrastructure as Code, products much of that work is done for you. We take a look at installing software to different Linux distributions using Python and then Ansible, before looking at Terraform to deploy containers
Additionally you can find my video courses on Pluralsight: pluralsight.com/training/Autho... and take time to see my own site www.theurbanpenguin.com
I follow your content for couple years, and lately I saw the increase of Devops oriented content, I am very glad, thank you.
Excellent, thank you
The animation for the audio volume on the bottom left is not desired as it blocked some commands.
👍!
You're better off checking the OS by the /etc/os-release file, you can pythons csv library to split it up into a key->value dict by using the "=" as the csv deliminator. The debian_version and redhat_version files are deprecated, and are slated for future removal -- how long until they remove them, no idea, but they shouldn't be relied upon. In any case, the ID field should give you a short name of fedora,rhel,centos,etc - if there is an ID_LIKE field, which you'll find in debian and RHEL derivitaves, you'll have things like ID_LIKE="debian" or ID_LIKE="fedora rhel" or even ID_LIKE="rhel" that will give you other hints.
example of reading the os-release file:
```
import csv
path = '/etc/os-release'
with open(path, 'r') as f:
os_info = dict(csv.reader(f, deliminator='='))
```
You can then match against the os_info['ID'] field to determine what package management method to use.
I disagree with using the variables in os-release. The separate files indicate the os family and save having the load variables into memory. I do agree that more information is available in the file but that information was not required in this case. The is family being indicated just by the file name. It is always possible to create a more complex solution and u appreciate your efforts
The BSDs get no ❤️ 😢
Your urban penguin animation is blocking your content
Animation is too distracting 😮
Appreciate your comment. Which animation or do you dislike animation full stop in this video