ungleich-learning-circle/sami/my-org-files/cdist.org/cdist#3-requirements.org
2020-05-22 16:35:56 +02:00

1.4 KiB

cdist #3: type parameters

Lecture content
Create a new type named __colourful_file
  • The objective is to create a type that creates colourful file
  • The content of the file should be "colour=…", where "…" is a colour specified by a parameter
  • Add an optional parameter named colour
  • Use the __file type inside your type to create a file
  • Use the $__object_id variable inside your type
Extend your type to be more colourful
  • Modify the optional parameter to be able to be specified multiple times
  • For each time it is specified, add a line "colour=…" to the file
Create a new type __my_dotfiles
  • Objective is to manage the dotfiles in your home directory
  • Make it a singleton type
  • Create a sub directory files in the type
  • Add your .emacs config to the files folder
  • Add a for loop to your type to deploy .[A-z]* to your home directory
  • Add a .bashrc or .zshrc to the files folder (depending on your shell)
  • In the initial manifest, add __my_dotfiles when the target host is localhost
As usual commit all changes to your ungleich-learning-circle repo

Defining parameters

Every type consists of required, optional and boolean parameters, which

must each be declared in a newline separated file in parameter/required,