Contenu connexe
Similaire à Automating Docker Containers with Puppet 2014 10-13 (20)
Automating Docker Containers with Puppet 2014 10-13
- 3. So you can write:
package { ‘ntp’:!
ensure => installed,!
}!
file { ‘/etc/ntp.conf’:!
ensure => file,!
source => ‘/root/example/ntp.conf’,!
mode => ‘0444’,!
}!
service { ‘ntp’:!
ensure => running,!
}
- 5. Instead write
include ‘::ntp'
or customize:
class { '::ntp':!
servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ],!
}
- 8. Docker and Puppet
1. Building containers!
2. Running containers!
3. Running inside containers
- 9. Building: puppet apply
FROM ubuntu:14.04
!
RUN apt-get -y update
RUN apt-get -y install ruby
RUN gem install puppet
RUN puppet module install puppetlabs/ntp
RUN puppet apply -e 'include "::ntp"'
- 10. Building: puppet agent
FROM ubuntu:14.04
!
RUN apt-get -y update
RUN apt-get -y install ruby
RUN gem install puppet
RUN puppet agent -t —server my_host
- 11. Building: puppet apply
FROM jamtur01/puppetbase
MAINTAINER James Turnbull "james@lovedthanlost.net"
!
RUN apt-get -y -q install wget git-core
ADD Puppetfile /
RUN librarian-puppet install
RUN puppet apply --modulepath=/modules -e "class
{ 'nginx': }"
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx"]
- 13. Running docker with puppet
docker::run { 'helloworld':
image => 'ubuntu:precise',
command => '/bin/sh -c "while true; do echo hello
world; sleep 1; done"',
}