pets icon indicating copy to clipboard operation
pets copied to clipboard

A bit more examples

Open rogierlommers opened this issue 2 years ago • 1 comments

Is it possible to add more examples? For example, I would like to see if PETS can replace my Ansible stuff on my home server. I have runbooks for this:

  • Install packages, set config
  • Install docker, put docker-compose files in place
  • Add stuff to crontab
  • Create symlinks to my dotfiles
  • Add samba mounts
  • Install and config ssmtp
  • etc

rogierlommers avatar Nov 08 '22 06:11 rogierlommers

Hi!

Thanks for your interest in the project.

* Install packages, set config

That is what all examples under https://github.com/ema/pets/tree/master/sample_pet do. :-)

* Install docker, put docker-compose files in place

I'm not familiar with docker-compose, but I imagine something like this is what you're looking for:

# pets: destfile=/etc/docker-compose/whatever, owner=root, group=root, mode=0644
# pets: package=docker.io

[docker compose config here]
* Add stuff to crontab

See c92d49e58ea48.

* Create symlinks to my dotfiles

Symlinks are not supported yet.

* Install and config ssmtp

See fd749109.

At the end of the day, pets focuses on the following:

  • installing configuration files where you want them to be installed
  • fixing permissions
  • installing packages
  • running commands before/after files are updated

The first two things are done with the destfile directive, while packages are installed with the package directive. pre and post can be used for running commands, see https://github.com/ema/pets/blob/master/sample_pet/ssh/sshd_config as an example.

Please feel free to contribute any additional example that you think may be of interest.

ema avatar Nov 16 '22 15:11 ema