TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ansible Techniques I Wish I’d Known Earlier

346 pointsby oedmarapover 3 years ago

12 comments

gizdanover 3 years ago
Ansible is abysmal. I don&#x27;t know why anyone still chooses it. It&#x27;s a mess of yaml and what feels like a million yaml files that is always extremely hard to follow. Honestly writing some python, or bash is a lot easier to follow, read, and understand. The only thing it has going for it is the inventory system. I wish ansible would die already.<p>The tips mentioned in the article are helpful, but still beyond the initial development of roles, maintaining roles is a pain no one can alleviate. It is the perl of automation. I wish people would stop using it. I&#x27;ve yet to start a job where people haven&#x27;t regretted going towards ansible.
评论 #28338856 未加载
评论 #28332841 未加载
评论 #28334157 未加载
评论 #28333604 未加载
评论 #28342011 未加载
评论 #28334584 未加载
评论 #28340349 未加载
评论 #28339431 未加载
评论 #28376808 未加载
avaikaover 3 years ago
I&#x27;m using ansible for some years already. The biggest game changer for me was ansible molecule [0].<p>I integrated it to the repo, where I store my code and it just runs all the test cases for my code. It saved me a bunch of hours of investigation in test environments before I even released the code. Highly recommend to try it even for a small project.<p>Apart of that play with ansible strategies if you have more than one server to apply the role. It really might save you some minutes of a runtime.<p>[0]: <a href="https:&#x2F;&#x2F;molecule.readthedocs.io&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;molecule.readthedocs.io&#x2F;en&#x2F;latest&#x2F;</a>
评论 #28333333 未加载
评论 #28335226 未加载
评论 #28334108 未加载
usrmeover 3 years ago
It&#x27;s a damn shame it took until this article for me (and it appears some others) to learn about the console and the debugger; those seem like massive time savers! My own biggest helper has been to use &quot;ANSIBLE_STDOUT_CALLBACK=yaml&quot; wherever &quot;ansible-playbook&quot; is called (<a href="https:&#x2F;&#x2F;jpmens.net&#x2F;2021&#x2F;03&#x2F;12&#x2F;alter-ansible-s-output-on-debugging&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jpmens.net&#x2F;2021&#x2F;03&#x2F;12&#x2F;alter-ansible-s-output-on-debu...</a>). It makes the verbose output much more readable and is especially handy for tasks that can spew thousands of lines at ones (e.g. &quot;apt update&#x2F;upgrade&quot;).
评论 #28337689 未加载
评论 #28339628 未加载
mccoycover 3 years ago
Another one for the list is `--start-at-task` and `--list-tasks`, for those tasks that are statically imported. If you have a task bomb out, you can take over from where you left off. Doesn&#x27;t work in all playbooks, if facts need to be set earlier, but it&#x27;s still very useful and saves tons of time. Obvious, but I wish I knew that one earlier too.
cedwsover 3 years ago
At work we use Puppet and I have to say that although the DSL is much more expressive and nicer to use than YAML, Puppet&#x27;s tooling sucks in comparison. There isn&#x27;t really any way to test your Puppet code that I know of, you just have to apply it and check if it all looks good. Puppet doesn&#x27;t have a set of good practices established either. Different companies use completely different repository structures, compiler settings, linter settings. Modules for managing common software like Docker are low quality and riddled with issues.<p>Ansible and Puppet claim to be declarative but it&#x27;s a lie. Configuration management really needs a rethink. I know Nix exists but that has a huge barrier to entry and companies don&#x27;t want to use something that isn&#x27;t battle tested. In my view, the ideal config management tool would be fast, testable, and provably idempotent. It would also be as far away as possible from the Python&#x2F;Ruby swamp that Ansible and Puppet are stuck in.
评论 #28333603 未加载
评论 #28332849 未加载
amanziover 3 years ago
The `--step` flag will definitely be useful for me, didn&#x27;t know about that.<p>My one tip I&#x27;ll add is to use the `--diff` argument when running a playbook to print out the specific changes made for each step. For debugging, use `--diff --check` to see all the changes that will be made - useful if it&#x27;s been a while since you last run your playbook over a host.
评论 #28337929 未加载
评论 #28337938 未加载
whirlwinover 3 years ago
I have used Ansible for some years. I recently switched jobs to a company having no automation on VMs. And we are migrating our workload to managed services in the cloud (managed Kubernetes), I have to say I&#x27;m relieved I don&#x27;t have to deal with Ansible again. It&#x27;s probably very efficient in many ways, but just copying a file&#x2F;directory with the correct options is a bit of pain in Ansible. Having not to worry about VMs anymore is a huge win for me at least. &#x2F;OffTopicEnd
评论 #28333498 未加载
moreatiover 3 years ago
Over the years I&#x27;ve tweeted Ansible tips, and Ansible Gotchas for my own memory and others<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;search?q=from%3Amoreati%20ansible%20tip&amp;f=live" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;search?q=from%3Amoreati%20ansible%20tip&amp;...</a> <a href="https:&#x2F;&#x2F;twitter.com&#x2F;search?q=from%3Amoreati%20ansible%20gotcha&amp;src=typed_query&amp;f=live" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;search?q=from%3Amoreati%20ansible%20gotc...</a>
linsomniacover 3 years ago
Gotta try that console and debugger, those weren&#x27;t even on my radar!
评论 #28329168 未加载
评论 #28332991 未加载
评论 #28329718 未加载
reilly3000over 3 years ago
I wish I had read this a couple of weeks ago. I am new to Ansible but needed to use it to migrate a legacy system. I’m not really accustomed to long build times and kept running out of things to do in the interim while I was waiting for it to break.
cortyover 3 years ago
Maybe a stupid redundant slightly offtopic question, but I&#x27;ll ask anyways:<p>What is the best way to couple Ansible with some git repository to automatically apply changes while still being able to trace and debug?
评论 #28332295 未加载
评论 #28332489 未加载
评论 #28331885 未加载
评论 #28332284 未加载
评论 #28334471 未加载
rakshaziover 3 years ago
ansible-console is a treasure! I wish I saw that article years ago...