Hand Crafted Artisinal Chef Resources

Ea72b50eef37ebe730c37d96c5b5dd51?s=47 someara
February 02, 2016

Hand Crafted Artisinal Chef Resources

Configuration Management Camp
Ghent Belgium
February 2016

Ea72b50eef37ebe730c37d96c5b5dd51?s=128

someara

February 02, 2016
Tweet

Transcript

  1. 4.
  2. 5.
  3. 7.

    Step 1 - Disregard dogma “Unit tests first” is a

    dirty lie https://flic.kr/p/aTSiXF
  4. 10.
  5. 12.

    Step 3 - Create a cookbook By hand. Be a

    wizard. https://flic.kr/p/3mMW6e
  6. 14.
  7. 15.

    Step 4 - Embed a test cookbook. By hand. Be

    a wizard. Again. https://flic.kr/p/ai36NG
  8. 17.
  9. 20.
  10. 23.
  11. 27.

    rubocop -a git init git add . git commit -a

    -m 'v0.0.1 - cookbook skeleton' git tag v0.0.1
  12. 30.
  13. 34.
  14. 38.
  15. 42.
  16. 44.
  17. 45.

    rubocop -a rspec ; echo $? git add . git

    commit -a -m “v0.1.0 - my_file resource” git tag v0.1.0
  18. 50.
  19. 51.
  20. 52.
  21. 55.
  22. 56.
  23. 57.
  24. 58.
  25. 60.
  26. 61.
  27. 63.
  28. 64.
  29. 65.
  30. 67.

    Pure Ruby resources utilize - The Ruby Standard Library -

    Chef helper libs (mixlib-shellout) - Ruby gems
  31. 68.
  32. 70.

    load_current_value - Runs at converge time - Just before the

    action body - Loads desired state values
  33. 71.
  34. 72.

    converge_if_changed - Runs if any desired_state: true property differs from

    user input - desired_state: false avoids comparison
  35. 73.
  36. 74.

    coerce transforms values - Called when property is set -

    Called when property is read - Use this to raise errors on bad input
  37. 77.
  38. 79.

    Composite resources - Reuse Chef resources - Actions look like

    recipes - Do not use load_current_value
  39. 85.
  40. 93.

  41. 94.

  42. 96.
  43. 97.
  44. 98.