Add centos7 docker support

* Separate OSTYPE specific tasks/files.
* Keep only common tasks and files in the
playbooks dir.

TODO pxe case to be working for centos as well
note, the cmtools.sh installs ansible 2.0.1.0
  in centos7, while we have 2.0.0.2 for ubuntu trusty
note, the base.yaml installs python-keystoneclient
  1:1.3.0-1.el7 from kilo-2 (no juno for centos7),
  while for ubuntu we have one from juno
note, there is no pygraphviz for centos7, see also
  https://bugs.launchpad.net/fuel/+bug/1510884

Closes-bug: #1548851

Change-Id: Icec5637f9242104322d1104725f9f132d1ca16f0
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2016-02-23 16:02:09 +01:00
parent e1e304c4f9
commit 467d84c620
43 changed files with 698 additions and 40 deletions

23
Vagrantfile vendored
View File

@ -71,8 +71,8 @@ def ansible_playbook_command(filename, args=[])
ansible_script_crafted
end
def shell_script(filename, args=[])
shell_script_crafted = "/bin/bash #{filename} #{args.join ' '} 2>/dev/null"
def shell_script(filename, env=[], args=[])
shell_script_crafted = "/bin/bash -c \"#{env.join ' '} #{filename} #{args.join ' '} 2>/dev/null\""
@logger.info("Crafted shell-script: #{shell_script_crafted})")
shell_script_crafted
end
@ -88,15 +88,16 @@ end
solar_script = ansible_playbook_command("solar.yaml")
solar_agent_script = ansible_playbook_command("solar-agent.yaml")
master_pxe = ansible_playbook_command("pxe.yaml")
fix_six = shell_script("/vagrant/bootstrap/playbooks/fix_centos7_six.sh")
solar_exec = shell_script("#{solar_script}", ["SOLAR_DB_BACKEND=#{SOLAR_DB_BACKEND}"])
if provider == :docker
# TODO(bogdando) use https://github.com/jpetazzo/pipework for multi net.
# Hereafter, we will use only the 1st IP address and a single interface.
# Also prepare docker volumes and workaround missing machines' ssh_keys
# Prepare docker volumes and workaround missing machines' ssh_keys
# and virtualbox hardcoded paths in Solar
key=get_machine_key
docker_volumes = ["-v", "#{INSECURE_KEY}:#{KEY_PATH1}:ro"]
docker_volumes << ["-v", "#{INSECURE_KEY}:#{key}:ro",
"-v", "/var/tmp/vagrant:/var/tmp/vagrant",
"-v", "/sys/fs/cgroup:/sys/fs/cgroup",
"-v", "/var/run/docker.sock:/var/run/docker.sock" ]
SLAVES_COUNT.times do |i|
@ -104,7 +105,7 @@ if provider == :docker
key = get_machine_key index.to_s
docker_volumes << ["-v", "#{INSECURE_KEY}:#{key}:ro"]
end
docker_volumes.flatten
docker_volumes.flatten!
@logger.info("Crafted docker volumes: #{docker_volumes}")
end
@ -113,6 +114,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# W/a unimplemented docker networking, see
# https://github.com/mitchellh/vagrant/issues/6667.
# Create or delete the solar net (depends on the vagrant action)
# TODO(bogdando) use https://github.com/jpetazzo/pipework for multi net.
# Hereafter, we will use only the 1st IP address and a single interface.
config.trigger.before :up do
system <<-SCRIPT
if ! docker network inspect solar >/dev/null 2>&1 ; then
@ -154,8 +157,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.trigger.after :up, :option => { :vm => 'solar-dev'} do
docker_exec("solar-dev","/usr/sbin/rsyslogd >/dev/null 2>&1")
docker_exec("solar-dev","/usr/sbin/sshd >/dev/null 2>&1")
docker_exec("solar-dev","#{solar_script} >/dev/null 2>&1")
docker_exec("solar-dev","SOLAR_DB_BACKEND=#{SOLAR_DB_BACKEND} #{master_pxe} >/dev/null 2>&1") unless PREPROVISIONED
docker_exec("solar-dev","#{fix_six} >/dev/null 2>&1")
docker_exec("solar-dev","#{solar_exec}")
docker_exec("solar-dev","#{master_pxe} >/dev/null 2>&1") unless PREPROVISIONED
end
else
# not the docker provider
@ -219,7 +223,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.trigger.after :up, :option => { :vm => "solar-dev#{index}" } do
docker_exec("solar-dev#{index}","/usr/sbin/rsyslogd >/dev/null 2>&1")
docker_exec("solar-dev#{index}","/usr/sbin/sshd >/dev/null 2>&1")
docker_exec("solar-dev#{index}","#{solar_agent_script} >/dev/null 2>&1") if PREPROVISIONED
docker_exec("solar-dev#{index}","#{fix_six} >/dev/null 2>&1")
docker_exec("solar-dev#{index}","#{solar_agent_script}") if PREPROVISIONED
end
else
# not the docker provider

View File

@ -30,10 +30,15 @@ $ vagrant up --provider libvirt
```
Note, this requires a vagrant-libvirt plugin.
To build for a docker, use:
To build for a docker (Ubuntu based), use:
```
# docker pull ubuntu:trusty
$ packer build -only=docker solar-master-docker.json
```
And for the Centos based:
```
# docker pull centos:centos7
$ packer build -only=docker solar-master-centos-docker.json
$ cd ..
$ vagrant up --provider docker
```

View File

@ -6,9 +6,20 @@
vars:
ssh_ip_mask: "10.*.*.*"
tasks:
- include: tasks/base.yaml
- include: tasks/puppet.yaml
- include: tasks/docker.yaml
- include: tasks/cloud_archive.yaml
- include: tasks/ssh_conf.yaml
- include: centos/tasks/{{ item }}.yaml
when: lookup('env', 'OSTYPE') == "centos"
with_items:
- cloud_archive
- base
- puppet
- docker
- ssh_conf
- include: ubuntu/tasks/{{ item }}.yaml
when: lookup('env', 'OSTYPE') == "ubuntu"
with_items:
- base
- puppet
- docker
- cloud_archive
- ssh_conf

View File

@ -0,0 +1,73 @@
#!/bin/bash -eux
# TODO(bogdando) add centos7 support
exit 0
CLEANUP_PAUSE=${CLEANUP_PAUSE:-0}
echo "==> Pausing for ${CLEANUP_PAUSE} seconds..."
sleep ${CLEANUP_PAUSE}
# Make sure udev does not block our network - http://6.ptmc.org/?p=164
echo "==> Cleaning up udev rules"
rm -rf /dev/.udev/
rm /lib/udev/rules.d/75-persistent-net-generator.rules
rm /etc/udev/rules.d/70-persistent-net.rules
mkdir /etc/udev/rules.d/70-persistent-net.rules
echo "==> Cleaning up leftover dhcp leases"
# Ubuntu 10.04
if [ -d "/var/lib/dhcp3" ]; then
rm /var/lib/dhcp3/*
fi
# Ubuntu 12.04 & 14.04
if [ -d "/var/lib/dhcp" ]; then
rm /var/lib/dhcp/*
fi
# Add delay to prevent "vagrant reload" from failing
echo "pre-up sleep 2" >> /etc/network/interfaces
echo "==> Cleaning up tmp"
rm -rf /tmp/*
# Cleanup apt cache
apt-get -y autoremove --purge
apt-get -y clean
apt-get -y autoclean
echo "==> Installed packages"
dpkg --get-selections | grep -v deinstall
# Remove Bash history
unset HISTFILE
rm -f /root/.bash_history
rm -f /home/vagrant/.bash_history
# Clean up log files
find /var/log -type f | while read f; do echo -ne '' > $f; done;
echo "==> Clearing last login information"
>/var/log/lastlog
>/var/log/wtmp
>/var/log/btmp
if [ "${cleanup}" = "true" ] ; then
# Whiteout root
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}')
let count--
dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count
rm /tmp/whitespace
# Whiteout /boot
count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}')
let count--
dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count
rm /boot/whitespace
# Zero out the free space to save space in the final image
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
fi
# Make sure we wait until all the data is written to disk, otherwise
# Packer might quite too early before the large files are deleted
sync

View File

@ -0,0 +1,121 @@
#!/bin/bash -eux
# CM and CM_VERSION variables should be set inside of the Packer template:
#
# Values for CM can be:
# 'nocm' -- build a box without a configuration management tool
# 'chef' -- build a box with Chef
# 'chefdk' -- build a box with Chef Development Kit
# 'salt' -- build a box with Salt
# 'puppet' -- build a box with Puppet
#
# Values for CM_VERSION can be (when CM is chef|chefdk|salt|puppet):
# 'x.y.z' -- build a box with version x.y.z of Chef
# 'x.y' -- build a box with version x.y of Salt
# 'x.y.z-apuppetlabsb' -- build a box with package version of Puppet
# 'latest' -- build a box with the latest version
#
# Set CM_VERSION to 'latest' if unset because it can be problematic
# to set variables in pairs with Packer (and Packer does not support
# multi-value variables).
CM_VERSION=${CM_VERSION:-latest}
#
# Provisioner installs.
#
install_chef()
{
echo "==> Installing Chef"
if [[ ${CM_VERSION} == 'latest' ]]; then
echo "Installing latest Chef version"
curl -Lk https://www.getchef.com/chef/install.sh | bash
else
echo "Installing Chef version ${CM_VERSION}"
curl -Lk https://www.getchef.com/chef/install.sh | bash -s -- -v $CM_VERSION
fi
}
install_chef_dk()
{
echo "==> Installing Chef Development Kit"
if [[ ${CM_VERSION:-} == 'latest' ]]; then
echo "==> Installing latest Chef Development Kit version"
curl -Lk https://www.getchef.com/chef/install.sh | sh -s -- -P chefdk
else
echo "==> Installing Chef Development Kit ${CM_VERSION}"
curl -Lk https://www.getchef.com/chef/install.sh | sh -s -- -P chefdk -v ${CM_VERSION}
fi
echo "==> Adding Chef Development Kit and Ruby to PATH"
echo 'eval "$(chef shell-init bash)"' >> /home/vagrant/.bash_profile
chown vagrant /home/vagrant/.bash_profile
}
install_salt()
{
echo "==> Installing Salt"
if [[ ${CM_VERSION:-} == 'latest' ]]; then
echo "Installing latest Salt version"
wget -O - http://bootstrap.saltstack.org | sudo sh
else
echo "Installing Salt version $CM_VERSION"
curl -L http://bootstrap.saltstack.org | sudo sh -s -- git $CM_VERSION
fi
}
# FIXME(bogdando) install a given version of puppet
install_puppet()
{
echo "==> Installing Puppet"
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
if [[ ${CM_VERSION:-} == 'latest' ]]; then
echo "Installing latest Puppet version"
yum -y install puppet
else
echo "Installing Puppet version $CM_VERSION"
echo "Not implemented"
exit 1
fi
}
install_ansible()
{
echo "==> Installing Ansible python egg"
# TODO(bogdando): maybe this is better:
# http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu
yum -y install python-setuptools
easy_install pip
pip install -U pip
pip install ansible
}
#
# Main script
#
case "${CM}" in
'chef')
install_chef
;;
'chefdk')
install_chef_dk
;;
'salt')
install_salt
;;
'puppet')
install_puppet
;;
'ansible')
install_ansible
;;
*)
echo "==> Building box without baking in a configuration management tool"
;;
esac

View File

@ -0,0 +1,35 @@
#!/bin/bash -eux
# TODO(bogdando) add centos7 support
exit 0
echo "==> Installed packages before cleanup"
dpkg --get-selections | grep -v deinstall
# Remove some packages to get a minimal install
echo "==> Removing all linux kernels except the currrent one"
dpkg --list | awk '{ print $2 }' | grep 'linux-image-3.*-generic' | grep -v $(uname -r) | xargs apt-get -y purge
echo "==> Removing linux source"
dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge
echo "==> Removing documentation"
dpkg --list | awk '{ print $2 }' | grep -- '-doc$' | xargs apt-get -y purge
echo "==> Removing obsolete networking components"
apt-get -y purge ppp pppconfig pppoeconf
echo "==> Removing other oddities"
apt-get -y purge popularity-contest installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
# Clean up the apt cache
apt-get -y autoremove --purge
apt-get -y autoclean
apt-get -y clean
echo "==> Removing man pages"
rm -rf /usr/share/man/*
echo "==> Removing anything in /usr/src but this kernel src"
p2=$(uname -r | cut -d- -f1-2)
mv "/usr/src/linux-headers-${p2}" /tmp
mv /usr/src/linux-headers-$(uname -r) /tmp
rm -rf /usr/src/*
mv "/tmp/linux-headers-${p2}" /usr/src/
mv /tmp/linux-headers-$(uname -r) /usr/src/
echo "==> Removing any docs"
rm -rf /usr/share/doc/*

View File

@ -0,0 +1,2 @@
#!/bin/bash -eux
echo "UseDNS no" >> /etc/ssh/sshd_config

View File

@ -0,0 +1,4 @@
#!/bin/sh -eux
yum -y install sudo
sed -i -e "s/Defaults requiretty.*/ #Defaults requiretty/g" /etc/sudoers
exit 0

View File

@ -0,0 +1,30 @@
#!/bin/bash -eux
# Install basic packages and build requirements for ansible/librarian-puppet
PACKAGES="
epel-release
git
make
which
ruby-devel
python-devel
autoconf
gcc-c++
openssh-server
iputils-ping
rsyslog
psmisc
iputils
iptables
less
curl
wget
rsync
vim
screen
tcpdump
strace
"
#yum -y groupinstall "Development tools"
yum -y install $PACKAGES
exit 0

View File

@ -0,0 +1,11 @@
#!/bin/bash -eux
if [[ $UPDATE =~ true || $UPDATE =~ 1 || $UPDATE =~ yes ]]; then
echo "==> Updating non kernel packages"
yum --exclude=kernel* update
echo "==> Upgrading all"
yum upgrade yum kernel
yum -y upgrade
reboot
sleep 160
fi

View File

@ -0,0 +1,33 @@
#!/bin/bash
date > /etc/vagrant_box_build_time
SSH_USER=${SSH_USER:-vagrant}
SSH_USER_HOME=${SSH_USER_HOME:-/home/${SSH_USER}}
VAGRANT_INSECURE_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
# Packer passes boolean user variables through as '1', but this might change in
# the future, so also check for 'true'.
if [ "$INSTALL_VAGRANT_KEY" = "true" ] || [ "$INSTALL_VAGRANT_KEY" = "1" ]; then
# Create Vagrant user (if not already present)
if ! id -u $SSH_USER >/dev/null 2>&1; then
echo "==> Creating $SSH_USER user"
/usr/sbin/groupadd $SSH_USER
/usr/sbin/useradd $SSH_USER -g $SSH_USER -G wheel -d $SSH_USER_HOME --create-home
echo "${SSH_USER}:${SSH_USER}" | chpasswd
fi
# Set up sudo
echo "==> Giving ${SSH_USER} sudo powers"
echo "${SSH_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "==> Installing vagrant key"
mkdir $SSH_USER_HOME/.ssh
chmod 700 $SSH_USER_HOME/.ssh
cd $SSH_USER_HOME/.ssh
# https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
echo "${VAGRANT_INSECURE_KEY}" > $SSH_USER_HOME/.ssh/authorized_keys
chmod 600 $SSH_USER_HOME/.ssh/authorized_keys
chown -R $SSH_USER:$SSH_USER $SSH_USER_HOME/.ssh
fi

View File

@ -0,0 +1,54 @@
#!/bin/bash -eux
# TODO(bogdando) add centos7 support
exit 0
if [[ $PACKER_BUILDER_TYPE =~ vmware ]]; then
echo "==> Installing VMware Tools"
# Assuming the following packages are installed
# apt-get install -y linux-headers-$(uname -r) build-essential perl
cd /tmp
mkdir -p /mnt/cdrom
mount -o loop /home/vagrant/linux.iso /mnt/cdrom
tar zxf /mnt/cdrom/VMwareTools-*.tar.gz -C /tmp/
/tmp/vmware-tools-distrib/vmware-install.pl -d
rm /home/vagrant/linux.iso
umount /mnt/cdrom
rmdir /mnt/cdrom
rm -rf /tmp/VMwareTools-*
fi
if [[ $PACKER_BUILDER_TYPE =~ virtualbox ]]; then
echo "==> Installing VirtualBox guest additions"
# Assuming the following packages are installed
# apt-get install -y linux-headers-$(uname -r) build-essential perl
# apt-get install -y dkms
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
mount -o loop /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
rm /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso
rm /home/vagrant/.vbox_version
if [[ $VBOX_VERSION = "4.3.10" ]]; then
ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
fi
/etc/init.d/vboxadd setup
fi
if [[ $PACKER_BUILDER_TYPE =~ parallels ]]; then
echo "==> Installing Parallels tools"
mount -o loop /home/vagrant/prl-tools-lin.iso /mnt
/mnt/install --install-unattended-with-deps
umount /mnt
rm -rf /home/vagrant/prl-tools-lin.iso
rm -f /home/vagrant/.prlctl_version
fi
if [[ $PACKER_BUILDER_TYPE =~ libvirt ]]; then
echo "==> Doing nothing special"
fi

View File

@ -0,0 +1,57 @@
---
- name: Base packages
yum: name={{ item }} state=present
with_items:
- git
- subversion
- python-keystoneclient
- MySQL-python
- python-setuptools
- ruby-devel
- unzip
# Graph drawing
#- python-pygraphviz
# Other tools
- htop
- jq
- tmux
#- vim-nox
- mc
# Dev
- python-ipython-console
- python-devel
- python-virtualenv
# for torrent transport
- rb_libtorrent-python
# for riak python package
- libffi-devel
- openssl-devel
# computable inputs lua
- luajit-devel
# for tests on jenkins
- sshpass
# for pg backend
- python-psycopg2
- name: Uninstall packages
yum: name={{ item }} state=absent
with_items:
- python-pbr
# PIP
- pip: name={{item}} state=present
with_items:
- httpie
- docker-py==1.1.0
- ujson
- tox
- riak
- pbr
# pre install solare requirements
- shell: pip install pudb
- shell: pip install -r https://raw.githubusercontent.com/openstack/solar/master/requirements.txt
- shell: pip install -r https://raw.githubusercontent.com/Mirantis/solar-agent/master/requirements.txt

View File

@ -0,0 +1,8 @@
---
# NOTE(bogdando) no Juno support for the Centos7! Openstack example may not be working!
# The CentOS 7 Kilo repository may be found at http://mirror.centos.org/centos/7/cloud/x86_64/
# The Juno CentOS 6 repository may be found at http://mirror.centos.org/centos/6/cloud/x86_64/
# you can yum install centos-release-openstack-kilo for Kilo and yum install centos-release-openstack-juno
- shell: rpm -ivh http://mirror.centos.org/centos/7/cloud/x86_64/openstack-kilo/centos-release-openstack-kilo-2.el7.noarch.rpm
- yum: name=centos-release-openstack-kilo state=present

View File

@ -0,0 +1,17 @@
---
- shell: docker --version
ignore_errors: true
register: docker_version
- shell: curl -sSL https://get.docker.com/ | sudo sh
when: docker_version | failed
# pre download riak image
- shell: docker pull solarproject/riak
# prebuild pg container
- git: repo=https://github.com/kiasaki/docker-alpine-postgres.git dest=/tmp/docker-alpine-postgres update=yes
- shell: make build
args:
chdir: /tmp/docker-alpine-postgres
- shell: rm -fr /tmp/docker-alpine-postgres

View File

@ -0,0 +1,4 @@
---
# TODO(bogdando) for centos7, http://fuel-repository.mirantis.com/fwm/6.1/centos/
- shell: /bin/true

View File

@ -0,0 +1,8 @@
---
# Puppet related
- template: src=files/hiera.yaml dest=/etc/puppet/hiera.yaml
- file: path=/etc/puppet/hieradata state=directory
# Make paths puppet 4 compatible
- file: path=/etc/puppetlabs/code/ state=directory
- file: src=/etc/puppet/hiera.yaml dest=/etc/puppetlabs/code/hiera.yaml state=link

View File

@ -0,0 +1,6 @@
---
- file: path=/root/.ssh state=directory mode=0700
- template: src=files/ssh_conf dest=/root/.ssh/config
- file: path=/home/vagrant/.ssh state=directory mode=0700
- template: src=files/ssh_conf dest=/home/vagrant/.ssh/config

View File

@ -0,0 +1,9 @@
---
# TODO(bogdando) for centos7, systemd
#- copy: src=/vagrant/utils/solar-worker-defaults dest=/etc/default/solar-worker
#- copy: src=/vagrant/utils/solar-worker.conf dest=/etc/init/solar-worker.conf
#- shell: stop solar-worker
# ignore_errors: yes
#- shell: start solar-worker
- shell: /bin/true

View File

@ -2,7 +2,7 @@ default vesamenu.c32
menu title Live CD Choices
prompt 0
timeout 3
menu autoboot
menu autoboot
label ubuntu
menu label Ubuntu

View File

@ -0,0 +1,4 @@
#!/bin/sh
# fix 'module' object has no attribute 'add_metaclass'
pip uninstall -y six
pip install six

View File

@ -1,5 +1,6 @@
---
# TODO(bogdando) centos/ubuntu split
- name: Setup dhcp server with bootstrap image
hosts: all
become: yes

View File

@ -10,7 +10,10 @@
# Setup development env for solar
- shell: pip install -e . chdir=/vagrant
- shell: pip install git+git://github.com/Mirantis/solar-agent.git
- include: tasks/ssh_conf.yaml
- include: centos/tasks/ssh_conf.yaml
when: lookup('env', 'OSTYPE') == "centos"
- include: ubuntu/tasks/ssh_conf.yaml
when: lookup('env', 'OSTYPE') == "ubuntu"
- hosts: localhost
tasks:
@ -65,4 +68,7 @@
# shared stuff for all databases
- include: databases.yaml
- include: tasks/worker_upstart.yaml
- include: centos/tasks/worker_upstart.yaml
when: lookup('env', 'OSTYPE') == "centos"
- include: ubuntu/tasks/worker_upstart.yaml
when: lookup('env', 'OSTYPE') == "ubuntu"

View File

@ -0,0 +1,8 @@
---
# Puppet related
- template: src=files/hiera.yaml dest=/etc/puppet/hiera.yaml
- file: path=/etc/puppet/hieradata state=directory
# Make paths puppet 4 compatible
- file: path=/etc/puppetlabs/code/ state=directory
- file: src=/etc/puppet/hiera.yaml dest=/etc/puppetlabs/code/hiera.yaml state=link

View File

@ -0,0 +1,6 @@
---
- file: path=/root/.ssh state=directory mode=0700
- template: src=files/ssh_conf dest=/root/.ssh/config
- file: path=/home/vagrant/.ssh state=directory mode=0700
- template: src=files/ssh_conf dest=/home/vagrant/.ssh/config

View File

@ -0,0 +1,121 @@
{
"variables": {
"cm": "puppet",
"cm_version": "latest",
"cleanup_pause": "",
"headless": "{{env `headless`}}",
"update": "true",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"install_vagrant_key": "true",
"http_proxy": "{{env `http_proxy`}}",
"https_proxy": "{{env `https_proxy`}}",
"ftp_proxy": "{{env `ftp_proxy`}}",
"rsync_proxy": "{{env `rsync_proxy`}}",
"no_proxy": "{{env `no_proxy`}}",
"cleanup": "false",
"ansible_config_path": "/etc/ansible",
"ansible_config_file": "ansible.cfg",
"ansible_log_file": "/var/tmp/ansible.log"
},
"builders": [{
"type": "docker",
"image": "centos:centos7",
"commit": true,
"run_command": [
"-ti",
"--privileged",
"-v",
"/sys/fs/cgroup:/sys/fs/cgroup",
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
"-d",
"{{.Image}}",
"/bin/bash"
]
}],
"provisioners": [{
"type": "shell",
"execute_command": "echo 'vagrant' | sh '{{.Path}}'",
"scripts": [
"playbooks/centos/files/sudo.sh"
]}, {
"type": "shell",
"execute_command": "echo '{{user `ssh_password`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"
]}, {
"type": "shell",
"inline": ["sudo mkdir -p {{ user `ansible_config_path` }}"]
}, {
"type": "shell",
"inline": [
"touch /tmp/ansible.cfg",
"sudo mv /tmp/ansible.cfg {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}",
"sudo echo '[defaults]' >> {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}",
"sudo echo 'log_path = {{ user `ansible_log_file` }}' >> {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}",
"sudo touch {{ user `ansible_log_file` }}",
"sudo chmod 666 {{ user `ansible_log_file` }}"
]}, {
"type": "shell",
"environment_vars": [
"OSTYPE=centos",
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
"UPDATE={{user `update`}}",
"INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}",
"SSH_USERNAME={{user `ssh_username`}}",
"SSH_PASSWORD={{user `ssh_password`}}",
"http_proxy={{user `http_proxy`}}",
"https_proxy={{user `https_proxy`}}",
"ftp_proxy={{user `ftp_proxy`}}",
"rsync_proxy={{user `rsync_proxy`}}",
"no_proxy={{user `no_proxy`}}"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"playbooks/centos/files/update.sh",
"playbooks/centos/files/tools.sh",
"playbooks/centos/files/cmtool.sh",
"playbooks/centos/files/vagrant.sh",
"playbooks/centos/files/sshd.sh"
]
}, {
"type": "shell",
"environment_vars": [
"OSTYPE=centos",
"CM=ansible",
"CM_VERSION=latest"
],
"script": "playbooks/centos/files/cmtool.sh",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
}, {
"type": "ansible-local",
"playbook_dir": "playbooks",
"playbook_file": "playbooks/build-main.yaml",
"extra_arguments": ["--verbose"],
"command": "OSTYPE=centos ansible-playbook"
}, {
"type": "shell",
"environment_vars": [
"OSTYPE=centos",
"cleanup={{user `cleanup`}}"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"playbooks/centos/files/minimize.sh",
"playbooks/centos/files/cleanup.sh"
]
}],
"post-processors": [
[
{
"type": "docker-tag",
"repository": "bogdando/solar-master-centos",
"tag": "latest",
"keep_input_artifact": false
}
]
]
}

View File

@ -38,7 +38,7 @@
"type": "shell",
"execute_command": "echo 'vagrant' | sh '{{.Path}}'",
"scripts": [
"playbooks/files/sudo.sh"
"playbooks/ubuntu/files/sudo.sh"
]}, {
"type": "shell",
"execute_command": "echo '{{user `ssh_password`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
@ -59,6 +59,7 @@
]}, {
"type": "shell",
"environment_vars": [
"OSTYPE=ubuntu",
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
@ -74,35 +75,38 @@
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"playbooks/files/update.sh",
"playbooks/files/tools.sh",
"playbooks/files/cmtool.sh",
"playbooks/files/vagrant.sh",
"playbooks/files/sshd.sh"
"playbooks/ubuntu/files/update.sh",
"playbooks/ubuntu/files/tools.sh",
"playbooks/ubuntu/files/cmtool.sh",
"playbooks/ubuntu/files/vagrant.sh",
"playbooks/ubuntu/files/sshd.sh"
]
}, {
"type": "shell",
"environment_vars": [
"OSTYPE=ubuntu",
"CM=ansible",
"CM_VERSION=latest"
],
"script": "playbooks/files/cmtool.sh",
"script": "playbooks/ubuntu/files/cmtool.sh",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
}, {
"type": "ansible-local",
"playbook_dir": "playbooks",
"playbook_file": "playbooks/build-main.yaml",
"extra_arguments": ["--verbose"]
"extra_arguments": ["--verbose"],
"command": "OSTYPE=ubuntu ansible-playbook"
}, {
"type": "shell",
"environment_vars": [
"OSTYPE=ubuntu",
"cleanup={{user `cleanup`}}"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"playbooks/files/vmtool.sh",
"playbooks/files/minimize.sh",
"playbooks/files/cleanup.sh"
"playbooks/ubuntu/files/vmtool.sh",
"playbooks/ubuntu/files/minimize.sh",
"playbooks/ubuntu/files/cleanup.sh"
]
}],
"post-processors": [

View File

@ -127,6 +127,7 @@
]}, {
"type": "shell",
"environment_vars": [
"OSTYPE=ubuntu",
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
"CLEANUP_PAUSE={{user `cleanup_pause`}}",
@ -142,35 +143,38 @@
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"playbooks/files/update.sh",
"playbooks/files/tools.sh",
"playbooks/files/cmtool.sh",
"playbooks/files/vagrant.sh",
"playbooks/files/sshd.sh"
"playbooks/ubuntu/files/update.sh",
"playbooks/ubuntu/files/tools.sh",
"playbooks/ubuntu/files/cmtool.sh",
"playbooks/ubuntu/files/vagrant.sh",
"playbooks/ubuntu/files/sshd.sh"
]
}, {
"type": "shell",
"environment_vars": [
"OSTYPE=ubuntu",
"CM=ansible",
"CM_VERSION=latest"
],
"script": "playbooks/files/cmtool.sh",
"script": "playbooks/ubuntu/files/cmtool.sh",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
}, {
"type": "ansible-local",
"playbook_dir": "playbooks",
"playbook_file": "playbooks/build-main.yaml",
"extra_arguments": ["--verbose"]
"extra_arguments": ["--verbose"],
"command": "OSTYPE=ubuntu ansible-playbook"
}, {
"type": "shell",
"environment_vars": [
"OSTYPE=ubuntu",
"cleanup={{user `cleanup`}}"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"playbooks/files/vmtool.sh",
"playbooks/files/minimize.sh",
"playbooks/files/cleanup.sh"
"playbooks/ubuntu/files/vmtool.sh",
"playbooks/ubuntu/files/minimize.sh",
"playbooks/ubuntu/files/cleanup.sh"
]
}],
"post-processors": [

View File

@ -81,11 +81,16 @@ done at the host system:
.. code-block:: bash
# docker pull solarproject/riak
or, depending on the configured DB backend:
.. code-block:: bash
# git clone https://github.com/kiasaki/docker-alpine-postgres.git
# cd docker-alpine-postgres
# make build && cd -
This will allow the solar nodes to run required nested docker containers.
This will allow the solar nodes to run required nested DB containers.
.. note ::
The command ``vagrant ssh`` will not be working for the docker case.
@ -95,3 +100,9 @@ This will allow the solar nodes to run required nested docker containers.
# ssh vagrant@10.0.0.2
# docker exec -it solar-dev bash
.. note ::
The command ``vagrant destroy`` only cleans up containers for solar nodes
and does not clean up other containers launched, like riak, postgres,
kolla or the like. You should stop and remove them from the host system
manually!