У меня есть конфигурация Vagrant с провайдером докеров и предоставлением шеф-повара, и после команды vagrant up --provider=docker происходит сбой Vagrant на этапе предоставления chef_solo:
Сбой CentOS
==> node1: Machine booted and ready!
==> node1: Running provisioner: chef_solo...
==> node1: Detected Chef (latest) is already installed
The chef binary (either `chef-solo` or `chef-client`) was not found on
the VM and is required for chef provisioning. Please verify that chef
is installed and that the binary is available on the PATH.
и Suse не работает
==> node2: Machine booted and ready!
==> node2: Running provisioner: chef_solo...
node2: Installing Chef (latest)...
Vagrant attempted to execute the capability 'chef_install'
on the detect guest OS 'suse', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
Бродячий файл
Vagrant.configure("2") do |config|
config.vm.synced_folder "cnf/", "/home/vagrant/cnf_templates"
config.vm.network "private_network", type: "dhcp"
# node1 - CentOS 6.7
config.vm.define "node1" do |node1|
node1.vm.provider "docker" do |d|
d.build_dir = "centos/"
d.has_ssh = true
#d.ports = ["3306:3306"]
d.privileged = true
#d.remains_running = false
end
node1.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = "../../../../recipes/cookbooks"
chef.roles_path = "."
chef.add_role "docker1"
end
end
# node2 - OpenSuSE 13
config.vm.define "node0" do |node2|
node2.vm.provider "docker" do |d|
d.build_dir = "sles/"
d.has_ssh = true
#d.ports = ["3306:3306"]
d.privileged = true
end
node2.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = "../../../../recipes/cookbooks"
chef.roles_path = "."
chef.add_role "docker2"
end
end
end
Файл Docker для CentOS
FROM centos:6.7
#ENV SHELL /bin/bash
RUN yum update -y && \
yum clean all && \
yum --assumeyes install openssh-server openssh-clients sudo curl wget iptables
yum clean all
RUN /etc/init.d/sshd start
RUN sed -i 's/.*requiretty$/Defaults !requiretty/' /etc/sudoers
# Create and configure vagrant user
RUN groupadd vagrant && \
useradd -c "Vagrant" -g vagrant -d /home/vagrant -m -s /bin/bash vagrant &&
echo 'vagrant:vagrant' | chpasswd && \
mkdir -p /etc/sudoers.d && \
echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
# Configure SSH access
RUN mkdir -pm 700 /home/vagrant/.ssh && \
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YV
chmod 0600 /home/vagrant/.ssh/authorized_keys && \
chown -R vagrant:vagrant /home/vagrant/.ssh
# Clean up when done.
#RUN yum clean all
# daemonize sshd
CMD ["/usr/sbin/sshd", "-D", "-e"]
EXPOSE 22
Файл Docker для Suse
FROM opensuse:latest
RUN zypper -n --gpg-auto-import-keys ar http://download.opensuse.org/factory/repo/oss/ OSS
RUN zypper -n ref && \
zypper -n up --skip-interactive && \
zypper --non-interactive --gpg-auto-import-keys install -y openSSH sudo wget iptables SuSefirewall2
ENV SHELL /bin/bash
RUN sed -i 's/UsePAM no/UsePAM yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config
#RUN sed -i 's/#ChallengeResponseAuthentication no/ChallengeREsponseAuthentication ...
RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
#RUN echo 'root:13579Rh' | chpasswd
CMD ["/bin/bash", "-c", "rcsshd restart"]
RUN sed -i 's/.*requiretty$/Defaults !requiretty/' /etc/sudoers
# Create and configure vagrant user
RUN groupadd vagrant && \
useradd -m -g vagrant -d /home/vagrant -s /bin/bash vagrant && \
echo 'vagrant:vagrant' && \
echo 'vagrant ALL=(ALL) ALL' >> /etc/sudoers.d/vagrant && \
chmod 0440 /etc/sudoers.d/vagrant
# create ssh host keys for sshd
RUN ssh-keygen -A
# Configure SSH access
RUN mkdir -p /home/vagrant/.ssh && \
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YV$
chmod 0600 /home/vagrant/.ssh/authorized_keys && \
chown -R vagrant:vagrant /home/vagrant/.ssh && \
chmod 0700 /home/vagrant/.ssh
# Install chef
#RUN wget -O - https://www.opscode.com/chef/install.sh | /bin/bash
# Clean up APT when done.
#zypper clean
#RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD ["/usr/sbin/sshd", "-D"]
EXPOSE 22
Что не так с моей конфигурацией? Я пробовал установить почти все версии шеф-повара: плагин omnibus, ручную установку шеф-повара с помощью скрипта bash (wget chef.sh | bash) и базовое обеспечение шеф-повара.
P.S. Chef-solo отлично работает только на Ubuntu 14.04 с провайдером бродячих докеров.
Спасибо, Кирилл
chef-soloилиchef-clientв CentOS? Есть ли он, если вы ищете его вручную? Что содержит$PATH? - person Etan Reisner   schedule 17.11.2015$PATH? Похоже, это проблема с подготовкой и исправлением, которое должно работать. В качестве альтернативы, если вы можете проинструктировать vagrant, каков полный путь кchef-solo, возможно, стоит попробовать. - person Etan Reisner   schedule 17.11.2015