Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

YAML Magic

6 076 vues

Publié le

Ignite about yaml tips and tricks you might not want to use in your config files

Publié dans : Technologie
  • Soyez le premier à commenter

YAML Magic

  1. 1. CfgMgmtCamp Ghent Julien Pivotto @roidelapluie --- yaml magic February 03 2020
  2. 2. --- yaml enables you to have multiple documents --- in the same file Multiple documents @roidelapluie
  3. 3. # Those keys have the same value implicit: explicit: null # Those keys have the different values nothing: null string: "null" Values @roidelapluie
  4. 4. maybe_countries: - be - fr - nl - no # Those mean true and false [on,off,ON,OFF,yes,Yes,No,no,YES,NO] Values @roidelapluie
  5. 5. # Version numbers version: 1.3.0 # NOT a version number version: 1.3 # that's a float! Values @roidelapluie
  6. 6. did you know: spaces are allowed in keys Keys @roidelapluie
  7. 7. did you know: you can have duplicate keys did you know: this is valid yaml Keys @roidelapluie
  8. 8. .50: keys can be something else than strings Keys @roidelapluie
  9. 9. ? | keys can have multiple lines : yes yes Keys @roidelapluie
  10. 10. didyouknow: another thing about keys : EMPTY keys are also a thing Keys @roidelapluie
  11. 11. long: | You can easily write multi line text in yaml by using this syntax You can easily write multi line text in yaml by using this syntax Multiline @roidelapluie
  12. 12. long: > You can easily write multi line text in yaml by using this syntax You can easily write multi line text in yaml by using Multiline @roidelapluie
  13. 13. long: |- You can easily write multi line text in yaml by using this syntax No newline at the end @roidelapluie
  14. 14. long: |+ You can easily write multi line text in yaml by using this syntax You can easily write multi line text in yaml by using this syntax All newlines at the end @roidelapluie
  15. 15. set: ? item1 ? item2 ? item2 set: {item1, item2, item2} set: item1: item2: Sets @roidelapluie
  16. 16. ghent: &belgian_city country: be mainland: europe antwerp: *belgian_city ghent: country: be mainland: europe antwerp: country: be mainland: europe Anchors @roidelapluie
  17. 17. ghent: &belgian_city country: be has tld: yes antwerp: <<*: belgian_city has tld: no ghent: country: be has tld: true antwerp: country: be has tld: false Inheritance @roidelapluie
  18. 18. {"note": "maybe at the end we just want json"} oh yeah @roidelapluie
  19. 19. those tips are fun but I'd recommend you keep the magic far from your prod because the magician on call might not like reading the yaml spec at 3am :) use jsonnet @roidelapluie
  20. 20. Julien Pivotto @roidelapluie roidelapluie@inuits.eu Essensteenweg 31 2930 Brasschaat Belgium Contact: info@inuits.eu +32-3-8082105

×