Run `apt-get update` before installing other packages with Puppet

后端 未结 8 1217
青春惊慌失措
青春惊慌失措 2020-12-07 11:21

I\'m trying to create puppet module which automates installation of zend server CE, this is not important here, but steps are as following

  1. update /etc/apt/sour
8条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 11:57

    I prefer to put apt-upgrade into a separate stage running before the main stage, so I don't have to hard-wire any dependencies. Check here: http://docs.puppetlabs.com/puppet/2.7/reference/lang_run_stages.html.

    A simple example would look like below. It implies you have a separate class for doing the actual apt-update:

    stage { "init": before  => Stage["main"] }
    
    class {"apt-update": 
      stage => init, 
      apt_mirror => $apt_mirror 
    }
    

    Check my sample LAMPP-box on github to see how the pieces fit together: https://github.com/joerx/vagrant-lampp

    Note: be careful with apt-upgrade, as some base boxes break by things like kernel upgrades.

提交回复
热议问题