2 ms·
I think your ansible example could be improved by removing all the names. - name: Ensure https support for apt is installed apt: pkg=apt-transport-ht
by bryanlarsen 13y ago
I think your ansible example could be improved by removing all the names.
- name: Ensure https support for apt is installed
apt: pkg=apt-transport-https state=present
smells a little bit like:
// add one to x
x += 1;
Additionally, I would far rather see "apt: pkg=apt-transport-https state=present" in my logs than "Ensure https support for apt is installed"
- mattjaynes 13y agoThat's a great point. I initially didn't have comments for any of those code sections. However, most of my reviewers encouraged me to add the comments so it would be clearer what each step was doing for beginners.
- bryanlarsen 13y agoIn that case, you can use YAML comments rather than ansible names. It makes it much more clear that it's optional, and you get the actual code in the log rather than the name/comment.
- mpdehaan2 13y agoAnsible actually encourages the use of the names because they show up as task headers. These are especially valuable when managing a large number of hosts.
- bryanlarsen 13y agoThat's exactly why I actively discourage the use of names. I'd much rather see "apt: pkg=foo" than "Ensure foo is installed" in my logs. Especially when I have a large number of hosts.