r/devops • u/aloofhoneybee68 • Sep 09 '26
Tools Beginner DevOps question: Do experienced engineers actually write YAML like this?
I’m still learning CI/CD and I recently tried writing a simple CI/CD pipeline using GitHub Actions.
Honestly, writing the YAML felt more difficult than I expected . The indentation, nesting etc felt pretty hard/ painful.
For those of you who work with DevOps professionally: is this actually how you write your pipelines, or are there shortcuts/tools/templates that make it easier?
Just trying to understand what the normal workflow is in the real world.
122
Upvotes
625
u/Longjumping_Fuel_192 Sep 09 '26 •
I don’t even see yaml anymore. All I see is blonde, brunette, red head…
47
u/Due-Consequence9579 Sep 09 '26
Suffering. And 50 commits that get progressively more desperate for it to just fucking work.
18
u/Lavrick Sep 09 '26
You kinda get used to it. And basically, you write it only once, and then just reuse it via includes (haven't used actions, it was always gitlab for me).
17
u/AbbreviationsFar4wh Sep 09 '26
Claude writes my yaml dude.
Also this feels like marketing for some yaml alternative thats going to pop up as suggestion in comments under some rando user
2
u/derprondo Sep 09 '26
Your IDE should handle this in a pain-free manner. That said, I haven't manually written any GHA workflows in over year, Claude does it really well. Then again you don't know what mistakes to keep an eye out for or how to know when it's doing something dumb.
Pro-tip: Use 4 space indents (don't use tabs), it makes it easier to see.
78
u/PerpetuallySticky Sep 09 '26
Typically YAML you want to be as similar as possible across an org.
So yes, the first couple times is annoying, but you learn the patterns/what it should look like and research what you need to.
Then after you get the base cases figured out you should just be able to pull from what you’ve already done and tweak it a bit.
At least that’s how it used to be, with AI I haven’t written more than a few lines of YAML in lord knows how long
136
u/aenae Sep 09 '26
You use an ide that handles indentation and some syntax checks. Personally i like intellij for it
22
u/WonderfulTill4504 Sep 09 '26
So use an proper editor (vim, neovim, notepad++) that has proper syntax highlight.
Then use yamllint to check your files.
And then use Claude with a simple skill to check your files.
Also if your YAML is complicated then write code to generate it, using jinja2 templates.
And stop being lazy. You could have figured this out by yourself with 5 minutes of effort…
11
u/burlyginger Sep 10 '26
People talk about yaml like it's a complex programming language.
Yaml is markup language that at its core allows very simple data structures (arrays and objects) and simple data types (strong, number, bool, etc). There are some rough edges but most won't encounter them.
Ok, so that's yaml. Structured data.
Applications (GH action, ansible) often use yaml as the configuration format because it's simple and well standardized.
IDEs will have yaml formatters but they'll also have linters/schemas specifically for application configs like ansible and GH actions.
Those linter and helpee extensions are very much worth getting accustomed to because you could be writing valid yaml that is completely invalid action syntax.
Side note, I started building a lot of our interfaces with yaml and jsonschema because of how helpful it is for engineers working in IDEs.
This also makes for easy CI validation and allows AI agents to immediately understand what a file does and how to interact with it.
Some of our description fields get very in depth as it's what we provide to help users make decisions and set important values.
7
u/neekz0r Sep 09 '26
Yes. Once you understand it, it becomes second nature.
YAML Anchors and an IDE that understands YAML. In order to do Jinja/Gomplete, you absolutely need to understand YAML like the back of your hand otherwise you won't have any hair left and will likely need to go addiction counseling after self-medicating.
Here are my tips:
7
u/rvm1975 Sep 09 '26
VS code + extension
18
u/wedgelordantilles Sep 09 '26
You just tell Claude what you want
8
u/Normal_Red_Sky Sep 09 '26
If you have any programming knowledge, which you should, basic things like indentation shouldn't be an issue.
4
u/-lousyd DevOps Sep 09 '26
You don't have to grok all the yaml all at once. Write your top level object with its immediate child elements, then fill in the children on their own. That's how I approached it when I was learning. And keep the indents straight!
4
u/HTDutchy_NL System Engineer Sep 10 '26
So... yaml is actually one of the more simple elements to the point that developers can self service configs through yaml files.
The more interesting parts are python, terraform and kubernetes related shenanigans.
3
u/neilmillard Sep 09 '26
You get python (or something) to write the yaml, and have it verified with a schema.
3
u/davemac1005 Sep 09 '26
I was surprised to know that nobody in my team (only team in my company to do infra) knew about yaml schemas and some people didn’t even have proper editor support (auto indent, formatting etc.)
Honestly I would not be able to do any kubernetes or gitlab CI without those, it’s just so much simpler to have editor autocomplete and descriptions of each yaml key, instead of having to constantly go back and forward from the docs
3
u/Reasonable-Ad4770 Sep 09 '26
Ide handle it pretty good most of the cases. Hell, even in vi with some configuration it's tolerable(not the pasting,fuck the pasting)
But with llms I barely even touch it anymore, it's configuration and it's boring.
3
u/snarkhunter Lead DevOps Engineer Sep 09 '26
I was already doing Python so Yaml making indentation matter wasn't a big deal
3
u/cyberkni Sep 10 '26
Yaml sucks and inescapable in this space. I generally don’t write yaml from scratch. I’ll borrow some of another file just to give me some reference material.
You can use yq for some yaml modifications too.
3
u/ItsRendezookinTime Sep 10 '26
Vscode with a yaml linter and tab size settings in place, as well as amphetamines and ADHD induced willpower will come in handy for this.
1
u/Low-Opening25 Sep 09 '26
I mean, how green are you? it doesn’t take a rocket scientist to learn how many tabs to press, or just set up IDE to colour-code yaml syntax for you and control spacing or run linting plugin. It really shouldn’t an issue to a professional.
2
u/pen15_club_admin Sep 09 '26
Use something that will mark up yaml indention for you. Makes it easier but you get used to it
2
u/No_Focus5737 Sep 09 '26
It’s not so bad, you get used to it after a while. Just like with everything, it’ll become second nature the more you use it everyday
2
u/riggiddyrektson Sep 09 '26
I can recommend using a proper IDE and try to get the specific yaml formats downloaded for it so you can use autocomplete/IntelliSense.
If it gets too complicated or repetitive use a templating language like Helm template.
Also I try to get the "every feature used" example if it exists from the docs where you can just copy-paste and then delete everything you don't need, that's always faster than writing yourself.
2
u/pydood Sep 09 '26
YamlOps
2
u/ferriematthew Sep 09 '26
I personally like to set up my text editors to use tab characters instead of spaces so that each indentation block is consistent and predictable.
One thing that still throws me for a loop is this pattern:
vs
2
u/Ninja-Sneaky Sep 10 '26
Yaml is supposed to make it as easy as it get for readability. Yes once you get past the hundreds lines it turns back to a convoluted mess like anything else.
Anyway apply shift left concepts: use editors that let you collapse/expand blocks, autoindent, have yaml plugins for syntax errors highlighting, use settings to auto remove trailing whitespaces, add empty line at end of file, use linters
2
u/marx2k Sep 10 '26
If YAML is confounding you, I've got some bad news my friend
2
u/jawad_aziz_ Sep 10 '26
YAML definitely feels painful at first. In real projects, though, most engineers don’t write every pipeline from scratch but now I reuse templates, reusable workflows, snippets, and linting tools. Once the structure becomes familiar, it gets much easier.
2
u/Preisschild Editable Placeholder Flair Sep 10 '26
redhat's yaml LSP + json schema (store) + yamlfix makes it pretty painless
2
u/sf1tzp Sep 10 '26
If you use vscode, check out the indent rainbow extension. It has an option to highlight indentation errors... especially useful in yaml
2
u/adept2051 Sep 11 '26
at this point an IDE, pre-commit ( look it up on github ), and an agent. make the agent explain any fix to you ( and take the time to read it if you're new to the language/practcie)
2
u/ididtheneedful Sep 11 '26
A lot of tools accept yml as config. Some accept other formats like json. Don’t worry so much about knowing yaml per se, maybe just understand your pipeline and why it’s better than using sftp to upload your code manually.
2
u/SeaworthinessHour233 DevOps Engineer & Educator Sep 11 '26
Before AI - Take existing YAML and use it as a template.
With AI - Instruct AI to write YAML.
2
u/deadbeef_enc0de Sep 11 '26
I do a bunch of Minecraft stuff that uses yaml for configs. Use a text editor or ide that has good support for showing indentation, mapping, and other visual signifiers to read it easier.
Also use/build tools that let you generate/combine config snippets to make a larger config (I don't have suggestions, I have custom rolled tools for this)
2
u/amarao_san Sep 09 '26
Crazy times are happening. I still know how to do it and rarely write few lines (mostly when I'm checking edge cases of ansible or fix trivial typos), but I stop doing it large scale for pretty long time. I still need to read it (even more than before), so my demands for clarity goes up. But writing...
Indentation is trivial. Crazy jinja/github expressions are not, avoid them.
2
u/vacri Sep 09 '26
This isn't a yaml problem, this is a data problem. There's no layout format that is going to make this easier for you - yaml is one of the easier-but-still-flexible ones, which is why it's so popular.
If you want horror, go look at XML
2
u/extra_specticles Sep 09 '26
Every single editor I've used for code in the past 5-8 years has support for this built in. I'm really not seeing the problem. But perhaps because I'm used to python being tab/space sensitive, it makes sense to me.
2
u/Tricky_Ordinary_4799 Sep 13 '26
I don't write YAML anymore, Claude does.
3
u/bossasupernova Sep 09 '26
JSON is superior
4
u/crashorbit Creating the legacy systems of tomorrow Sep 09 '26
I don't write yaml. I write code that writes yaml.
2
u/rmslashusr Sep 09 '26
If there was ever a good use for AI it’s to stop spending time dealing with indentation errors and multiline string formatting in yaml
1
u/achilles298 Sep 09 '26
I use vscode with few extensions that handles the beautification
1
u/iscons Sep 09 '26
Just wait until you have to deal with templated yaml.
Yaml will become second nature over time.
1
u/alconaft43 Sep 09 '26
use your AI agent, they are perfect for IaC
1
u/centech Sep 09 '26
These days, if I'm directly writing YAML, it's almost always just a small change where the formatting is basically there for you already. Any decent IDE will have yaml formatting and make it pretty dificult to actually screw up an edit.
A net new file is almost always being generated by something else, whether that's cdk8s, pulumi, claude code, whatever.
If for some reason I absolutealy have to write a full yaml file by hand, the IDE still makes it fairly straightforward.
1
u/phxees Sep 09 '26
I often use intelli-sense to finish what I start to write. I also make edits from time to time. Where there’s something to fix I often forget that AI is an option for trivial changes.
1
u/aktentasche Sep 09 '26
You will realise the business doesn't gove a f about yaml or any of that stuff. Make your life easier, that's all.
1
u/Many_Ad7628 Sep 09 '26
YAML-ing is not a big deal. There are quite a few rules you need to keep in mind, and in contrary to JSON, in YAML you can write a comments (you'll find them very useful). Try not to take it too seriouselly, but instead do practice. Find some JSON files and write a YAML versions of them, then use one of online tools to convert your YAMLs to JSONs and compare with originals. Just like a exercise...
1
u/elctSubstantial8158 Sep 09 '26
I want to know if I'm bigginer then how instart it? Like in kubernetes we write cpu and mem throttling, like who even first wrote that or created it? Anything in mi you add only it consume that much spec .. it's relly amezing and from date injooned as devops 3 year ago I haven't myself wrote yaml or any other file..just ai does it for me..I want to know like how many hour I sit to completely use or know yaml and which website will help me..
1
u/nautitrader Sep 09 '26
Cursor is working on my GitHub actions now while I watch tv.
1
u/somewhatprodeveloper Sep 10 '26
If I look at helm that's toooo much yaml. Github actions b just the right amount IMO
1
u/Legitimate_Kazi_0991 Sep 10 '26
What kind of question is that?
1
u/SDplinker Sep 10 '26
No Claude does it
1
u/AfricanAgent47 Sep 10 '26
Yamlcheckers online!
1
u/Few_Pop6933 Sep 10 '26
Im so use to it from years of ansible.
1
u/BunnyPaw88 Sep 10 '26
I really appreciate those CI providers who offer a quality visual editor that generates the yaml, so you only need to review and commit.
For everything else I use Claude to generate yaml.
1
u/luenix System Engineer Sep 10 '26
Yep, I tell people since like 2018 that I'm a glorified text wrangler. I love YAML andd Python 3.6+ (PEP 482/484 wassup). The community of systems engineering has made so much of tech complicated, but YAML has been my unchanging rock. Learn the weirdness, embrace the structure, and (probably always) avoid abusing variables.
1
u/widowhanzo Sep 10 '26
I've written a ton of yaml (ansible, k8s, github ci ...) and never really had major issues with indentation or nesting. But I started to learn programming with Python, so indentation was something pretty obvious to me.
Ok sure sometimes I missed a space or two, but any half decent IDE will fix that for you. The first few actions are a bit more difficult, then you can just start reusing them and it gets easier.
Although these days Claude writes most pipelines ...
1
u/mighty-mo Sep 10 '26
VS code + the coloured tabs indentation extension
1
u/Wandelation Sep 10 '26
Are you writing your YAML in a text editor?
1
u/GreenLanyard Sep 13 '26
I've found that
# yaml-language-server: $schema=<schema-url-or-path>as the first line of your yaml file, plus a yaml language server extension in your IDE, is extremely helpful for pointing out errors.It's possible there are more efficient ways to do it than file-by-file, as I'm seeing in the yaml-language-server readme, but I haven't tested those patterns personally.
0
u/ipreferanothername Sep 09 '26
windows guy here - when i started to look at ansible i knew that YAML was one of the first things that i wanted to never be bothered with. yaml and jinja replacement looked like hell. im not afraid of looking at, deciphering, or interpreting large scripts and configs. i do it often, actually. i automate the bejesus out of my work and create whole processes. i even tested ansible on some test servers. YAML annoyed me so much just for the most basic of work. this was like, early covid, pre-ai, wasnt any claude option or anything to get help with.
so one of the linux guys was like, oh, i already use it want to see some playbooks? yeah man!
yeah, fuck yaml, that was enough to keep me out of ansible and away from yaml. idk why nerds keep making so many weird, shitty tools, but my god, do they churn them out.
then i came across this about that time https://noyaml.com/
im sure yaml is easier to manage now based on all the comments here but....also its a lot of comments saying you need several tools or AI to manage it well. yeah, i want people to stop creating such garbage.
-2
u/Aidvi93 Sep 10 '26
Nobody codes anymore bro. it's all AI. DevOps is now an architect role, and the same goes for other tech roles. AI is the developer now, and it's as stupid or as pro as the guidance you give it.
0
u/[deleted] Sep 09 '26
[deleted] — view deleted comment