G
G
gera72021-12-23 11:31:48
IT education
gera7, 2021-12-23 11:31:48

How to dot the i's on using Bash and Python for DevOps?

I work as a network engineer, started development in the direction of DevOps and immersed myself in learning Linux.
I want to clarify, for myself, the issue of writing Bash scripts and using Python.

I found a tutorial on programming in the Bash language (326 pages) and a number of questions arose, please tell me:
1. Real cases of writing and using Bash scripts, what tasks do they solve?
2. How many hours, approximately, will it take to learn and practice writing scripts in Bash, how to dive deep?
3. What should be able to write Bash junior/middle/senior DevOps?
4. Is it worth it to spend a day or two for Bash scripting, be able to write basic scripts and move on to learning Python?

Python:
1. Where and why is Python used in DevOps practice, real, everyday use cases?
2. What level of Python knowledge should junior/middle/senior DevOps have? (Familiar middle DevOps and Python does not know the word at all).
3. How many hours, approximately, will it take to study and practice for each level, how to dive deep?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
F
FanatPHP, 2021-12-23
@FanatPHP

You are not good for devops.
This is a very common answer to this very common question.
Devops is a person who doesn't ask questions. He answers them. Self-reliance is one of the key skills for a Devops. You are missing it.
And this is definitely a person who is NOT afraid of reading 326 pages of the manual.
Devops has to read about a hundred times more documentation. In year. Think carefully, do you need it, if the prospect of learning even the most primitive basics scares you so much that you came to the toaster to bargain?
In devops, as in infosec, it is very rare to enter from scratch.
You need to start either as a system administrator (not an enikey manager) or a programmer (not wordpress).
And then, having already developed as a programmer / system administrator, you can think about moving towards devops.

S
Saboteur, 2021-12-23
@saboteur_kiev

1. Real cases of writing and using Bash scripts, what tasks do they solve?

Yes, almost everything is possible on bash scripts.
Routine automation
Gluing different processes into a single pipeline
System things (copying, backups, synchronization, launching other processes, even simple monitoring)
bash is, among other things, a good universal scripting language, and the lack of libraries is made up for by a ready-made set of console utilities for all occasions.
2. How many hours, approximately, will it take to learn and practice writing scripts in Bash, how to dive deep?

You can spend your whole life learning any programming language and still learn new things. bash is no exception, especially since the best things about bash are deeply rooted in understanding the Linux architecture.
In addition, if you can do something in bash, and then find some kind of declarative orchestrator, you will have a good understanding of what is happening under the hood and intuitively understand where something can go wrong and how to fix it.
3. What should be able to write Bash junior/middle/senior DevOps?

The word "everything" fits here.
4. Is it worth it to spend a day or two for Bash scripting, be able to write basic scripts and move on to learning Python?

Perhaps they should be taught in parallel. Solving the same tasks in python and bash, you will quickly understand which tasks it is more convenient for you to solve one way or another. Again, there is a different infrastructure, different access, somewhere you can install python3, and somewhere there are no access rights to install anything at all.
Python:
1. Where and why is Python used in DevOps practice, real, everyday use cases?

Automation, monitoring, universal scripts. Python is very good at automating web requests. Everything can be done through curl, but a lot of things through python can be more convenient. Plus exception handling.
2. What level of Python knowledge should junior/middle/senior DevOps have? (Familiar middle DevOps and Python does not know the word at all).

If you know Python at the senior level, then it’s not a fact that you will be interested in working as a devops. You can work as a python developer.
Therefore, knowledge of python at the junior level is usually sufficient. But you need to understand that a junior is not someone who knows two teams. This is a full-fledged developer who knows both data structures and standard libraries and all constructions. The junior level in a programming language should allow you to get a job as a junior developer.
A devops engineer who knows a programming language at the level of a junior developer is a useful person who himself decided to delve into python. And in the IT field, people often like something and they do it and deepen it, regardless of the work tasks.
Therefore, the majority of devops engineers have little knowledge of programming languages, but they are enough to write universal scripts and small utilities.
I used to write simple and not so simple things in ANSI C/C++/java/python/perl/actionscript. Now I do almost everything in bash and sometimes python, and all previous knowledge helps me choose what to use - write something of my own, find a ready-made implementation in another language, ask the project to write a task (this is also quite a way to agree on working needs with developers about writing the necessary functionality for automation / testing). But the main thing is that I myself can evaluate the approximate output from what to do.
3. How many hours, approximately, will it take to study and practice for each level, how deep to dive?

How many hours does it take a footballer to become like Messi?
How many hours does a musician need to become like Freddie Mercury?
This is the dumbest question. All people are different. No one knows how fast you learn, what your current base is.
With the same amount of time for the whole school, some come out as excellent students, others as losers.
With the same amount of effort, some do the work, others release masterpieces.
If the goal of becoming a good specialist is to dive as deep as possible, spend as much time and effort as possible.
And if the goal is just to get a junior position, carefully read the requirements for the vacancy and fulfill them.
Another important factor.
The position of a devops engineer implies a rather complex project architecture. Simple architecture and tasks are usually handled on their own, and when a whole separate position is allocated, it is understood that it will be filled by an experienced engineer.
Therefore, the phrase "junior devops" in my concept bad manners.
A junior devops is usually a person who already has experience at least at the level of a middle specialist in the field of system administration (preferably) or as an automation tester or developer.
Going into devops from scratch - is it to pick up theoretical knowledge, pick up practice only in courses and try to orchestrate something? There is no understanding of the architecture, no understanding of why tools are needed and whether they are needed in this particular case.
Such an engineer can only perform tasks at the behest if there is another specialist on the project.
Therefore, junior devops can exist either in projects where there is a devops team that is ready to take a person to growth and load him with small things, or even bureaucracy in general. Or if in the project one of the developers is engaged in this whole task and wants to download it to another person, whom, again, he will fully control.
If you need a person on whom at least something depends, it is unlikely to be someone who went into devops from scratch. And questions like yours (bash, python, and so on) are an indicator that you are just learning the tools and not even delving into the understanding of infrastructure issues.
The choice of instrument is particular. Understanding what the result should be is important.
The same things can be done with bash and python and ansible and chef and perl, and it doesn't matter what was chosen, except that there is a question of expansion and support. But what exactly to do and how to link it all ...
read, for example, git flow, and it’s not the git itself that matters - it should be basic in general, but why is git flow needed and figure out which option is suitable for the desired project. This is just the task that the devops engineer and the architect / team leader are solving together.

U
uvelichitel, 2021-12-23
@uvelichitel

It’s hard to say, because they haven’t decided exactly what DevOps is yet)) Docker and Kubernetes are generally written in Go.
My equipment, home and hobby, runs on *nix. I administer it clearly myself. I completely get around the shell. And this is a must have, you simply cannot do without knowledge of sh, including with virtualization and in the clouds. Python was never needed. Probably complex administration tasks are better solved in Python, but apparently I have not encountered such ...

D
Dimonchik, 2021-12-23
@dimonchik2013

Hello,
Bash decides this: once you realize that you’ve stopped writing bicycles (especially if someone already knows how to write them better) and you go looking for something ready-made, and it’s not rare - HOP! - written in Bash python
example
the answer is simple - Ansible

What time is it

10,000
well, or until you solve the current problem

A
AlexVWill, 2021-12-23
@AlexVWill

In python, you can write, for example, a simple image hosting. I doubt it on the head, although the devil knows, maybe there are craftsmen.

I
iddqda, 2021-12-23
@iddqda

And it depends on what kind of devops
if a netdevops background is needed, then you can say there is no bash at all,
if only in cumuluses and sonics what
bash is an applied topic to the Linux console in the first place. well, where you need to deploy services on all sorts of different Linuxes.
and even then the developers of Linux distributions have been solving these problems for a long time and tightly on the python
and doing it right. because the tasks are getting harder, and bash is retrograde squalor, pain and suffering. Its place has long been in the museum.
But this is all poetry, and the main thing I wanted to say is - do not mix the study of one and the other,
study them as separately as possible so that the ugly bash practices (well, I can’t call it PL) do not interfere with learning normal programming.
at the same time, it’s enough to read the manual at the bash level and learn how to read (not write) start scripts
, but python, like other normal PLs, is a completely different story
, you need to dive deep and for a long time there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question