Merge branch 'master' into jnowak/events_riak1

This commit is contained in:
Jedrzej Nowak 2015-09-02 10:41:34 +02:00
commit b53c833f20
40 changed files with 848 additions and 263 deletions

5
.gitignore vendored
View File

@ -26,3 +26,8 @@ celery*.log
*.dot
*.png
resources_compiled.py
# bootstrap
bootstrap/trusty64
bootstrap/solar-master.box
vagrant-settings.yml

72
Vagrantfile vendored
View File

@ -1,42 +1,45 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
SLAVES_COUNT = 3
init_script = <<SCRIPT
apt-get update
apt-get -y install python-pip python-dev
pip install ansible
ansible-playbook -i "localhost," -c local /vagrant/main.yml /vagrant/docker.yml
SCRIPT
# configs, custom updates _defaults
defaults_cfg = YAML.load_file('vagrant-settings.yml_defaults')
if File.exist?('vagrant-settings.yml')
custom_cfg = YAML.load_file('vagrant-settings.yml')
cfg = defaults_cfg.merge(custom_cfg)
else
cfg = defaults_cfg
end
slave_script = <<SCRIPT
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get -y install python-pip python-dev
pip install ansible
ansible-playbook -i "localhost," -c local /vagrant/main.yml /vagrant/docker.yml /vagrant/slave.yml /vagrant/slave_cinder.yml
SCRIPT
SLAVES_COUNT = cfg["slaves_count"]
SLAVES_RAM = cfg["slaves_ram"]
MASTER_RAM = cfg["master_ram"]
master_celery = <<SCRIPT
ansible-playbook -i "localhost," -c local /vagrant/celery.yml --skip-tags slave
SCRIPT
def ansible_playbook_command(filename, args=[])
"ansible-playbook -v -i \"localhost,\" -c local /vagrant/bootstrap/playbooks/#{filename} #{args.join ' '}"
end
slave_celery = <<SCRIPT
ansible-playbook -i "localhost," -c local /vagrant/celery.yml --skip-tags master
SCRIPT
solar_script = ansible_playbook_command("solar.yml")
slave_script = ansible_playbook_command("custom-configs.yml", ["-e", "master_ip=10.0.0.2"])
master_celery = ansible_playbook_command("celery.yml", ["--skip-tags", "slave"])
slave_celery = ansible_playbook_command("celery.yml", ["--skip-tags", "master"])
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#config.vm.box = "deb/jessie-amd64"
#config.vm.box = "rustyrobot/deb-jessie-amd64"
config.vm.box = "ubuntu/trusty64"
config.vm.define "solar-dev", primary: true do |config|
config.vm.provision "shell", inline: init_script, privileged: true
#config.vm.box = "deb/jessie-amd64"
#config.vm.box = "rustyrobot/deb-jessie-amd64"
#config.vm.box = "ubuntu/trusty64"
config.vm.box = "cgenie/solar-master"
config.vm.provision "shell", inline: solar_script, privileged: true
config.vm.provision "shell", inline: master_celery, privileged: true
config.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "/vagrant/tmp/keys/ssh_private"
config.vm.provision "file", source: "ansible.cfg", destination: "/home/vagrant/.ansible.cfg"
@ -44,7 +47,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.host_name = "solar-dev"
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize [
"modifyvm", :id,
"--memory", MASTER_RAM,
"--paravirtprovider", "kvm" # for linux guest
]
v.name = "solar-dev"
end
end
@ -53,14 +60,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
index = i + 1
ip_index = i + 3
config.vm.define "solar-dev#{index}" do |config|
config.vm.provision "shell", inline: init_script, privileged: true
# standard box with all stuff preinstalled
config.vm.box = "cgenie/solar-master"
config.vm.provision "shell", inline: slave_script, privileged: true
config.vm.provision "shell", inline: solar_script, privileged: true
config.vm.provision "shell", inline: slave_celery, privileged: true
config.vm.network "private_network", ip: "10.0.0.#{ip_index}"
config.vm.host_name = "solar-dev#{index}"
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize [
"modifyvm", :id,
"--memory", SLAVES_RAM,
"--paravirtprovider", "kvm" # for linux guest
]
v.name = "solar-dev#{index}"
end
end

25
bootstrap/README.md Normal file
View File

@ -0,0 +1,25 @@
# Solar image building
In `bootstrap/trusty64` directory there are `box.ovf` and `box-disk1.vmdk`
files from the `trusty64` Vagrant box (normally found in
`~/.vagrant.d/boxes/trusty64/0/virtualbox`).
To build, install Packer (https://www.packer.io/):
```
cd bootstrap
packer build solar-master.json
cp solar-master.box ../
cd ..
vagrant up
```
If Vagrant throws error about `vboxsf` try this:
```
vagrant plugin install vagrant-vbguest
```
(see https://github.com/shiguredo/packer-templates/issues/16).
If you're rebuilding the same box, make sure Vagrant reimports it:
```
vagrant box remove solar-master
```

2
bootstrap/ansible.cfg Normal file
View File

@ -0,0 +1,2 @@
[defaults]
host_key_checking = False

View File

@ -0,0 +1,8 @@
---
- hosts: all
sudo: yes
tasks:
#- shell: vagrant init ubuntu/trusty64
- shell: /usr/local/bin/packer build solar.json -var 'is_master=true'

12
bootstrap/packer.yml Normal file
View File

@ -0,0 +1,12 @@
---
- hosts: all
sudo: yes
tasks:
- shell: wget 'https://dl.bintray.com/mitchellh/packer/packer_0.8.2_linux_amd64.zip' -O /tmp/packer-0.8.2.zip
args:
creates: /tmp/packer-0.8.2.zip
- unarchive:
src: /tmp/packer-0.8.2.zip
dest: /usr/local/bin
copy: no

View File

@ -0,0 +1,12 @@
---
- name: Main build script
hosts: all
sudo: yes
tasks:
- include: tasks/base.yml
- include: tasks/puppet.yml
- include: tasks/docker.yml
#- include: celery.yml tags=['master'] celery_dir=/var/run/celery
- include: tasks/cinder.yml
- include: tasks/cloud_archive.yml

View File

@ -0,0 +1,21 @@
---
- name: Solar Celery config
hosts: all
sudo: yes
vars:
celery_dir: /var/run/celery
tasks:
- shell: mkdir -p {{ celery_dir }}
- shell: pip install celery
- shell: hostname
register: hostname
- shell: celery multi kill 2
chdir={{ celery_dir }}
tags: [stop]
- shell: celery multi start 2 -A solar.orchestration.runner -Q:1 scheduler,system_log -Q:2 celery,{{ hostname.stdout }}
chdir={{ celery_dir }}
tags: [master]
- shell: celery multi start 1 -A solar.orchestration.runner -Q:1 {{ hostname.stdout }}
chdir={{ celery_dir }}
tags: [slave]

View File

@ -0,0 +1,8 @@
---
- name: Custom Solar configs
hosts: all
sudo: yes
tasks:
- lineinfile: line='slaveof {{ master_ip }} 6379' dest=/etc/redis/redis.conf
- service: name=redis-server state=restarted

View File

@ -0,0 +1,15 @@
:backends:
- redis
#- yaml
#- json
:yaml:
:datadir: /etc/puppet/hieradata
:json:
:datadir: /etc/puppet/hieradata
:redis:
:port: 6379
:db: 0
:host: localhost
:deserialize: :json
:hierarchy:
- resource

View File

@ -0,0 +1,10 @@
#!/bin/sh
# TODO: maybe this is better:
# http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu
apt-get remove -f python-pip
sudo apt-get install -y python-setuptools
sudo easy_install pip
sudo pip install -U pip
sudo pip install ansible

View File

@ -0,0 +1,7 @@
---
- hosts: all
sudo: yes
tasks:
# Setup development env for solar
- shell: python setup.py develop chdir=/vagrant/solar

View File

@ -0,0 +1,56 @@
---
- shell: apt-get update
- name: Base packages
apt: name={{ item }} state=present
with_items:
- git
- python-mock
- python-keystoneclient
- python-mysqldb
- python-setuptools
- ruby-dev
- unzip
# Redis
- redis-server
# Graph drawing
- python-pygraphviz
# Other tools
- htop
- jq
- tmux
- vim
# Dev
- ipython
- python-pudb
# Required by packer
- build-essential
# PIP
#- apt: name=python-pip state=absent
#- shell: easy_install pip
#- shell: pip install -U pip
#- shell: pip install -U setuptools
- shell: pip install httpie
- shell: pip install docker-py==1.1.0
# Redis
- shell: pip install redis
- lineinfile: dest=/etc/redis/redis.conf regexp='^bind ' line='bind 0.0.0.0'
- service: name=redis-server state=restarted
# Ubuntu OpenStack packages
#- apt: name=ubuntu-cloud-keyring state=present
#- shell: echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/kilo main" > /etc/apt/sources.list.d/cloudarchive-kilo.list
#- shell: echo "deb http://osci-mirror-poz.infra.mirantis.net/pkgs/ubuntu-2015-06-25-194717 trusty-updates main" > /etc/apt/sources.list.d/fuel-kilo.list
#- shell: echo "deb http://osci-mirror-poz.infra.mirantis.net/pkgs/ubuntu-latest trusty main" > /etc/apt/sources.list.d/fuel-kilo.list
# cloudarchive key
#- shell: apt-key adv --recv-key --keyserver keyserver.ubuntu.com 5EDB1B62EC4926EA
# some other keys
#- shell: apt-key adv --recv-key --keyserver keyserver.ubuntu.com 9D6D8F6BC857C906
#- shell: apt-key adv --recv-key --keyserver keyserver.ubuntu.com 7638D0442B90D010
# mirantis poznan
#- shell: apt-key adv --recv-key --keyserver keyserver.ubuntu.com 40976EAF437D05B5
#- shell: apt-key adv --recv-key --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
#- shell: apt-get update

View File

@ -0,0 +1,15 @@
---
- apt: name=lvm2 state=present
- command: sudo truncate -s 10G /root/cinder.img creates=/root/cinder.img
- shell: sudo losetup -a|grep cinder
register: loop_created
ignore_errors: True
- command: sudo losetup /dev/loop0 /root/cinder.img
when: loop_created|failed
# retries: 5
# delay: 1
- lvg: vg=cinder-volumes pvs=/dev/loop0
when: loop_created|failed
# retries: 5
# delay: 1

View File

@ -0,0 +1,7 @@
---
- shell: apt-get update
- shell: apt-get -y upgrade
- shell: add-apt-repository -y cloud-archive:juno
- shell: apt-get update
- shell: apt-get update --fix-missing

View File

@ -0,0 +1,17 @@
---
- shell: docker --version
ignore_errors: true
register: docker_version
# This script is completely broken, it has so many sleeps...
- shell: curl -sSL https://get.docker.com/ | sudo sh
when: docker_version | failed
# Here's a raw paste of what the above script really does for Ubuntu
#- shell: apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
#- shell: mkdir -p /etc/apt/sources.list.d
#- shell: echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list
# args:
# creates: /etc/apt/sources.list.d/docker.list
#- shell: apt-get update
#- shell: apt-get install -y -q docker-engine

View File

@ -0,0 +1,24 @@
---
# Puppet
- shell: wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb -O /root/puppetlabs-release-trusty.deb
- shell: dpkg -i /root/puppetlabs-release-trusty.deb
- shell: apt-get update
- apt: name=puppet state=present
- git: repo=https://github.com/CGenie/hiera-redis dest=/root/hiera-redis
- shell: gem build hiera-redis.gemspec && gem install hiera-redis-3.0.0.gem chdir=/root/hiera-redis
- 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
- file: path=/var/tmp/puppet/modules state=directory owner=puppet
- file: path=/var/tmp/puppet/Puppetfile state=touch owner=puppet
- file: path=/etc/puppet/modules state=absent
- file: path=/etc/puppetlabs/code/modules state=absent
- file: path=/etc/puppetlabs/code/hieradata state=absent
- file: src=/var/tmp/puppet/modules dest=/etc/puppet/modules state=link
- file: src=/var/tmp/puppet/modules dest=/etc/puppetlabs/code/modules state=link
- file: src=/etc/puppet/hieradata dest=/etc/puppetlabs/code/hieradata state=link
- shell: gem install librarian-puppet --no-ri --no-rdoc

View File

@ -0,0 +1,47 @@
{
"variables": {
"ansible_config_path": "/etc/ansible",
"ansible_config_file": "ansible.cfg",
"ansible_log_file": "/tmp/ansible.log"
},
"builders": [{
"type": "virtualbox-ovf",
"source_path": "trusty64/box.ovf",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now"
}],
"provisioners": [
{
"type": "shell",
"inline": ["sudo mkdir -p {{ user `ansible_config_path` }}"]
},
{
"type": "file",
"source": "ansible.cfg",
"destination": "/tmp/ansible.cfg"
},
{
"type": "shell",
"inline": ["sudo mv /tmp/ansible.cfg {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}"]
},
{
"type": "shell",
"inline": [
"sudo echo 'log_path = {{ user `ansible_log_file` }}' >> {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}"
]
},
{
"type": "shell",
"script": "playbooks/files/ubuntu-ansible.sh"
}, {
"type": "ansible-local",
"playbook_dir": "playbooks",
"playbook_file": "playbooks/build-main.yml",
"extra_arguments": ["--verbose"]
}],
"post-processors": [{
"type": "vagrant",
"output": "solar-master.box"
}]
}

109
example-bootstrap.py Normal file
View File

@ -0,0 +1,109 @@
import click
import sys
import time
from solar.core import actions
from solar.core import resource
from solar.core import signals
from solar.core import validation
from solar.core.resource import virtual_resource as vr
from solar import errors
from solar.interfaces.db import get_db
GIT_PUPPET_LIBS_URL = 'https://github.com/CGenie/puppet-libs-resource'
# TODO
# Resource for repository OR puppet apt-module in run.pp
# add-apt-repository cloud-archive:juno
# To discuss: install stuff in Docker container
# NOTE
# No copy of manifests, pull from upstream (implemented in the puppet handler)
# Official puppet manifests, not fuel-library
db = get_db()
@click.group()
def main():
pass
def setup_resources():
db.clear()
signals.Connections.clear()
node3 = vr.create('node3', 'resources/ro_node/', {
'ip': '10.0.0.5',
'ssh_key': '/vagrant/.vagrant/machines/solar-dev3/virtualbox/private_key',
'ssh_user': 'vagrant'
})[0]
solar_bootstrap3 = vr.create('solar_bootstrap3', 'resources/solar_bootstrap', {'master_ip': '10.0.0.2'})[0]
signals.connect(node3, solar_bootstrap3)
has_errors = False
for r in locals().values():
if not isinstance(r, resource.Resource):
continue
print 'Validating {}'.format(r.name)
errors = validation.validate_resource(r)
if errors:
has_errors = True
print 'ERROR: %s: %s' % (r.name, errors)
if has_errors:
sys.exit(1)
resources_to_run = [
'solar_bootstrap3',
]
@click.command()
def deploy():
setup_resources()
# run
resources = map(resource.wrap_resource, db.get_list(collection=db.COLLECTIONS.resource))
resources = {r.name: r for r in resources}
for name in resources_to_run:
try:
actions.resource_action(resources[name], 'run')
except errors.SolarError as e:
print 'WARNING: %s' % str(e)
raise
time.sleep(10)
@click.command()
def undeploy():
resources = map(resource.wrap_resource, db.get_list(collection=db.COLLECTIONS.resource))
resources = {r.name: r for r in resources}
for name in reversed(resources_to_run):
try:
actions.resource_action(resources[name], 'remove')
except errors.SolarError as e:
print 'WARNING: %s' % str(e)
db.clear()
signals.Connections.clear()
main.add_command(deploy)
main.add_command(undeploy)
if __name__ == '__main__':
main()

44
example-puppet.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
import click
import sys
import time
@ -162,7 +164,7 @@ def setup_resources():
# NEUTRON
# Deploy chain neutron -> (plugins) -> neutron_server -> ( agents )
neutron_puppet = vr.create('neutron_puppet', 'resources/neutron_puppet', {
'core_plugin': 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2'
'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin'
})[0]
signals.connect(node1, neutron_puppet)
signals.connect(rabbitmq_service1, neutron_puppet, {
@ -237,23 +239,16 @@ def setup_resources():
'bind_port': ['admin_port', 'internal_port', 'public_port'],
})
# NEUTRON OVS PLUGIN & AGENT WITH GRE
neutron_plugins_ovs = vr.create('neutron_plugins_ovs', 'resources/neutron_plugins_ovs_puppet', {
'tenant_network_type': 'gre',
})[0]
signals.connect(node1, neutron_plugins_ovs)
signals.connect(neutron_db_user, neutron_plugins_ovs, {
'user_name':'db_user',
'db_name':'db_name',
'user_password':'db_password',
'db_host' : 'db_host'
})
neutron_agents_ovs = vr.create('neutron_agents_ovs', 'resources/neutron_agents_ovs_puppet', {
# NEUTRON ML2 PLUGIN & ML2-OVS AGENT WITH GRE
neutron_plugins_ml2 = vr.create('neutron_plugins_ml2', 'resources/neutron_plugins_ml2_puppet', {})[0]
signals.connect(node1, neutron_plugins_ml2)
neutron_agents_ml2 = vr.create('neutron_agents_ml2', 'resources/neutron_agents_ml2_ovs_puppet', {
# TODO(bogdando) these should come from the node network resource
'enable_tunneling': True,
'tunnel_types': ['gre'],
'local_ip': '10.1.0.13' # should be the IP addr of the br-mesh int.
})[0]
signals.connect(node1, neutron_agents_ovs)
signals.connect(node1, neutron_agents_ml2)
# NEUTRON DHCP, L3, metadata agents
neutron_agents_dhcp = vr.create('neutron_agents_dhcp', 'resources/neutron_agents_dhcp_puppet', {})[0]
@ -285,17 +280,15 @@ def setup_resources():
})
# NEUTRON OVS PLUGIN & AGENT WITH GRE FOR COMPUTE (node2)
neutron_plugins_ovs2 = vr.create('neutron_plugins_ovs2', 'resources/neutron_plugins_ovs_puppet', {})[0]
signals.connect(node2, neutron_plugins_ovs2)
signals.connect(neutron_plugins_ovs, neutron_plugins_ovs2, {
'db_host', 'db_name', 'db_password', 'db_user', 'tenant_network_type'
})
neutron_agents_ovs2 = vr.create('neutron_agents_ovs2', 'resources/neutron_agents_ovs_puppet', {
neutron_plugins_ml22 = vr.create('neutron_plugins_ml22', 'resources/neutron_plugins_ml2_puppet', {})[0]
signals.connect(node2, neutron_plugins_ml22)
neutron_agents_ml22 = vr.create('neutron_agents_ml22', 'resources/neutron_agents_ml2_ovs_puppet', {
# TODO(bogdando) these should come from the node network resource
'enable_tunneling': True,
'tunnel_types': ['gre'],
'local_ip': '10.1.0.14' # Should be the IP addr of the br-mesh int.
})[0]
signals.connect(node2, neutron_agents_ovs2)
signals.connect(node2, neutron_agents_ml22)
# CINDER
cinder_puppet = vr.create('cinder_puppet', 'resources/cinder_puppet', {})[0]
@ -615,9 +608,9 @@ resources_to_run = [
'neutron_keystone_role',
'neutron_puppet',
'neutron_keystone_service_endpoint',
'neutron_plugins_ovs',
'neutron_plugins_ml2',
'neutron_server_puppet',
'neutron_agents_ovs',
'neutron_agents_ml2',
'neutron_agents_dhcp',
'neutron_agents_l3',
'neutron_agents_metadata',
@ -656,11 +649,10 @@ resources_to_run = [
'nova_compute_puppet',
'neutron_puppet2',
'neutron_plugins_ovs2',
'neutron_agents_ovs2',
'neutron_plugins_ml22',
'neutron_agents_ml22',
]
@click.command()
def deploy():
setup_resources()

View File

@ -3,29 +3,26 @@
- hosts: all
sudo: yes
tasks:
- apt: name=git state=present
- apt: name=python-mock state=present
- apt: name=python-keystoneclient state=present
# PIP
- apt: name=python-pip state=absent
- apt: name=python-six state=absent
- shell: easy_install pip
- shell: pip install -U pip
- shell: pip install -U setuptools
- shell: pip install httpie
#- apt: name=python-virtualenv state=present
#- apt: name=virtualenvwrapper state=present
- apt: name=python-mock state=present
- apt: name=ipython state=present
- apt: name=python-pudb state=present
#- apt: name=python-pip state=present
- shell: pip install docker-py==1.1.0
- apt: name=python-keystoneclient state=present
# Redis
- apt: name=redis-server state=present
#- apt: name=python-redis state=present
- shell: pip install redis
- lineinfile: dest=/etc/redis/redis.conf regexp='^bind ' line='bind 0.0.0.0'
- service: name=redis-server state=restarted
- apt: name=git state=present
# Puppet
- shell: wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb -O /root/puppetlabs-release-trusty.deb
- shell: dpkg -i /root/puppetlabs-release-trusty.deb
- shell: apt-get update
@ -50,11 +47,16 @@
- shell: gem install librarian-puppet --no-ri --no-rdoc
# Setup additional development tools
- apt: name=vim state=present
- apt: name=tmux state=present
- apt: name=htop state=present
- apt: name=python-mysqldb state=present
- apt: name=jq state=present
- name: Additional development tools
apt: name={{ item }} state=present
with_items:
- vim
- tmux
- htop
- python-mysqldb
- jq
- ipython
- python-pudb
# Graph drawing
#- apt: name=python-matplotlib state=present
@ -64,6 +66,7 @@
# Setup development env for solar
- shell: python setup.py develop chdir=/vagrant/solar
# Ubuntu OpenStack packages
#- apt: name=ubuntu-cloud-keyring state=present
#- shell: echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/kilo main" > /etc/apt/sources.list.d/cloudarchive-kilo.list
#- shell: echo "deb http://osci-mirror-poz.infra.mirantis.net/pkgs/ubuntu-2015-06-25-194717 trusty-updates main" > /etc/apt/sources.list.d/fuel-kilo.list

View File

@ -0,0 +1,74 @@
# Neutron OVS agent with ML2 plugin puppet resource
Setups OVS neutron agent when using ML2 plugin
# === Parameters
source https://github.com/openstack/puppet-neutron/blob/5.1.0/manifests/agents/ml2/ovs.pp
``package_ensure``
(optional) The state of the package
Defaults to 'present'
``enabled``
(required) Whether or not to enable the OVS Agent
Defaults to true
``bridge_uplinks``
(optional) List of interfaces to connect to the bridge when doing
bridge mapping.
Defaults to empty list
``bridge_mapping``
(optional) List of <physical_network>:<bridge>
Defaults to empty list
``integration_bridge``
(optional) Integration bridge in OVS
Defaults to 'br-int'
``enable_tunneling``
(optional) Enable or not tunneling
Defaults to false
``tunnel_types``
(optional) List of types of tunnels to use when utilizing tunnels,
either 'gre' or 'vxlan'.
Defaults to false
``local_ip``
(optional) Local IP address of GRE tunnel endpoints.
Required when enabling tunneling
Defaults to false
``tunnel_bridge``
(optional) Bridge used to transport tunnels
Defaults to 'br-tun'
``vxlan_udp_port``
(optional) The UDP port to use for VXLAN tunnels.
Defaults to '4789'
``polling_interval``
(optional) The number of seconds the agent will wait between
polling for local device changes.
Defaults to '2"
``l2_population``
(optional) Extension to use alongside ml2 plugin's l2population
mechanism driver.
Defaults to false
``arp_responder``
(optional) Enable or not the ARP responder.
Recommanded when using l2 population mechanism driver.
Defaults to false
``firewall_driver``
(optional) Firewall driver for realizing neutron security group function.
Defaults to 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'.
``enable_distributed_routing``
(optional) Set to True on L2 agents to enable support
for distributed virtual routing.
Defaults to false

View File

@ -1,4 +1,4 @@
class { 'neutron::agents::ovs':
class { 'neutron::agents::ml2::ovs':
package_ensure => 'absent',
enabled => false,
}

View File

@ -0,0 +1,45 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$package_ensure = $resource['input']['package_ensure']['value']
$enabled = $resource['input']['enabled']['value']
$bridge_uplinks = $resource['input']['bridge_uplinks']['value']
$bridge_mappings = $resource['input']['bridge_mappings']['value']
$integration_bridge = $resource['input']['integration_bridge']['value']
$enable_tunneling = $resource['input']['enable_tunneling']['value']
$tunnel_types = $resource['input']['tunnel_types']['value']
$local_ip = $resource['input']['local_ip']['value']
$tunnel_bridge = $resource['input']['tunnel_bridge']['value']
$vxlan_udp_port = $resource['input']['vxlan_udp_port']['value']
$polling_interval = $resource['input']['polling_interval']['value']
$l2_population = $resource['input']['l2_population']['value']
$arp_responder = $resource['input']['arp_responder']['value']
$firewall_driver = $resource['input']['firewall_driver']['value']
$enable_distributed_routing = $resource['input']['enable_distributed_routing']['value']
class { 'neutron::agents::ml2::ovs':
enabled => true,
package_ensure => $package_ensure,
bridge_uplinks => $bridge_uplinks,
bridge_mappings => $bridge_mappings,
integration_bridge => $integration_bridge,
enable_tunneling => $enable_tunneling,
tunnel_types => $tunnel_types,
local_ip => $local_ip,
tunnel_bridge => $tunnel_bridge,
vxlan_udp_port => $vxlan_udp_port,
polling_interval => $polling_interval,
l2_population => $l2_population,
arp_responder => $arp_responder,
firewall_driver => $firewall_driver,
enable_distributed_routing => $enable_distributed_routing,
}
# Remove external class dependency and restore required ones
Service <| title == 'neutron-ovs-agent-service' |> {
require => undef
}
Neutron_plugin_ml2<||> ~> Service['neutron-ovs-agent-service']
File <| title == '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini' |> ~>
Service<| title == 'neutron-ovs-agent-service' |>

View File

@ -1,5 +1,5 @@
handler: puppet
id: 'neutron_agents_ovs_puppet'
id: 'neutron_agents_ml2_ovs_puppet'
input:
ip:
schema: str!
@ -14,6 +14,9 @@ input:
package_ensure:
schema: str
value: 'present'
enabled:
schema: bool
value: true
bridge_uplinks:
schema: [str]
value: []
@ -31,7 +34,7 @@ input:
value: []
local_ip:
schema: str
value:
value: ''
tunnel_bridge:
schema: str
value: 'br-tun'
@ -41,17 +44,23 @@ input:
polling_interval:
schema: int
value: 2
l2_population:
schema: bool
value: false
arp_responder:
schema: bool
value: false
firewall_driver:
schema: str
value: 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'
veth_mtu:
schema: str
value:
enable_distributed_routing:
schema: bool
value: false
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-neutron', branch: '5.1.0'}
puppet_module: 'neutron'
tags: [resource/neutron, resource/neutron_agents_ovs]
tags: [resource/neutron, resource/neutron_agents_ml2_ovs]
version: 1.0.0

View File

@ -1,5 +0,0 @@
# Neutron OVS agent puppet resource
Setups OVS neutron agent
source https://github.com/openstack/puppet-neutron/blob/5.1.0/manifests/agents/ovs.pp

View File

@ -1,38 +0,0 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$package_ensure = $resource['input']['package_ensure']['value']
$bridge_uplinks = $resource['input']['bridge_uplinks']['value']
$bridge_mappings = $resource['input']['bridge_mappings']['value']
$integration_bridge = $resource['input']['integration_bridge']['value']
$enable_tunneling = $resource['input']['enable_tunneling']['value']
$tunnel_types = $resource['input']['tunnel_types']['value']
$local_ip = $resource['input']['local_ip']['value']
$tunnel_bridge = $resource['input']['tunnel_bridge']['value']
$vxlan_udp_port = $resource['input']['vxlan_udp_port']['value']
$polling_interval = $resource['input']['polling_interval']['value']
$firewall_driver = $resource['input']['firewall_driver']['value']
$veth_mtu = $resource['input']['veth_mtu']['value']
class { 'neutron::agents::ovs':
enabled => true,
manage_service => true,
package_ensure => $package_ensure,
bridge_uplinks => $bridge_uplinks,
bridge_mappings => $bridge_mappings,
integration_bridge => $integration_bridge,
enable_tunneling => $enable_tunneling,
tunnel_types => $tunnel_types,
local_ip => $local_ip,
tunnel_bridge => $tunnel_bridge,
vxlan_udp_port => $vxlan_udp_port,
polling_interval => $polling_interval,
firewall_driver => $firewall_driver,
veth_mtu => $veth_mtu,
}
# Remove external class dependency
Service <| title == 'neutron-plugin-ovs-service' |> {
require => undef
}

View File

@ -0,0 +1,83 @@
# Neutron ML2 plugin puppet resource
# === Parameters
source https://github.com/openstack/puppet-neutron/blob/5.1.0/manifests/plugins/ml2.pp
``type_drivers``
(optional) List of network type driver entrypoints to be loaded
from the neutron.ml2.type_drivers namespace.
Could be an array that can have these elements:
local, flat, vlan, gre, vxlan
Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan'].
``tenant_network_types``
(optional) Ordered list of network_types to allocate as tenant networks.
The value 'local' is only useful for single-box testing
but provides no connectivity between hosts.
Should be an array that can have these elements:
local, flat, vlan, gre, vxlan
Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan'].
``mechanism_drivers``
(optional) An ordered list of networking mechanism driver
entrypoints to be loaded from the neutron.ml2.mechanism_drivers namespace.
Should be an array that can have these elements:
logger, test, linuxbridge, openvswitch, hyperv, ncs, arista, cisco_nexus,
l2population, sriovnicswitch
Default to ['openvswitch', 'linuxbridge'].
``flat_networks``
(optional) List of physical_network names with which flat networks
can be created. Use * to allow flat networks with arbitrary
physical_network names.
Should be an array.
Default to *.
``network_vlan_ranges``
(optional) List of <physical_network>:<vlan_min>:<vlan_max> or
<physical_network> specifying physical_network names
usable for VLAN provider and tenant networks, as
well as ranges of VLAN tags on each available for
allocation to tenant networks.
Should be an array with vlan_min = 1 & vlan_max = 4094 (IEEE 802.1Q)
Default to empty.
``tunnel_id_ranges``
(optional) Comma-separated list of <tun_min>:<tun_max> tuples
enumerating ranges of GRE tunnel IDs that are
available for tenant network allocation
Should be an array with tun_max +1 - tun_min > 1000000
Default to empty.
``vxlan_group``
(optional) Multicast group for VXLAN.
Multicast group for VXLAN. If unset, disables VXLAN enable sending allocate
broadcast traffic to this multicast group. When left unconfigured, will
disable multicast VXLAN mode
Should be an Multicast IP (v4 or v6) address.
Default to 'None'.
``vni_ranges``
(optional) Comma-separated list of <vni_min>:<vni_max> tuples
enumerating ranges of VXLAN VNI IDs that are
available for tenant network allocation.
Min value is 0 and Max value is 16777215.
Default to empty.
``enable_security_group``
(optional) Controls if neutron security group is enabled or not.
It should be false when you use nova security group.
Defaults to true.
``supported_pci_vendor_devs``
(optional) Supported PCI vendor devices, defined by
vendor_id:product_id according to the PCI ID
Repository. Should be an array of devices.
Defaults to ['15b3:1004', '8086:10ca'] (Intel & Mellanox SR-IOV capable NICs)
``sriov_agent_required``
(optional) SRIOV neutron agent is required for port binding.
Only set to true if SRIOV network adapters support VF link state setting
and if admin state management is desired.
Defaults to false.

View File

@ -0,0 +1,3 @@
class { 'neutron::plugins::ml2':
package_ensure => 'absent',
}

View File

@ -0,0 +1,54 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$type_drivers = $resource['input']['type_drivers']['value']
$tenant_network_types = $resource['input']['tenant_network_types']['value']
$mechanism_drivers = $resource['input']['mechanism_drivers']['value']
$flat_networks = $resource['input']['flat_networks']['value']
$network_vlan_ranges = $resource['input']['network_vlan_ranges']['value']
$tunnel_id_ranges = $resource['input']['tunnel_id_ranges']['value']
$vxlan_group = $resource['input']['vxlan_group']['value']
$vni_ranges = $resource['input']['vni_ranges']['value']
$enable_security_group = $resource['input']['enable_security_group']['value']
$package_ensure = $resource['input']['package_ensure']['value']
$supported_pci_vendor_devs = $resource['input']['supported_pci_vendor_devs']['value']
$sriov_agent_required = $resource['input']['sriov_agent_required']['value']
# LP1490438
file {'/etc/default/neutron-server':
ensure => present,
owner => 'root',
group => 'root',
mode => 644
} ->
class { 'neutron::plugins::ml2':
type_drivers => $type_drivers,
tenant_network_types => $tenant_network_types,
mechanism_drivers => $mechanism_drivers,
flat_networks => $flat_networks,
network_vlan_ranges => $network_vlan_ranges,
tunnel_id_ranges => $tunnel_id_ranges,
vxlan_group => $vxlan_group,
vni_ranges => $vni_ranges,
enable_security_group => $enable_security_group,
package_ensure => $package_ensure,
supported_pci_vendor_devs => $supported_pci_vendor_devs,
sriov_agent_required => $sriov_agent_required,
} ->
exec { 'neutron-db-sync':
provider => 'shell',
command => "${command} stamp head",
path => [ '/usr/bin', '/bin' ],
onlyif => "${command} current | grep -qE '^Current revision.*None$' "
}
include neutron::params
package { 'neutron':
ensure => $package_ensure,
name => $::neutron::params::package_name,
before => Exec['neutron-db-sync']
}

View File

@ -0,0 +1,57 @@
handler: puppet
id: 'neutron_plugins_ml2_puppet'
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
type_drivers:
schema: [str]
value: ['local', 'flat', 'vlan', 'gre', 'vxlan']
tenant_network_types:
schema: [str]
value: ['local', 'flat', 'vlan', 'gre', 'vxlan']
mechanism_drivers:
schema: [str]
value: ['openvswitch', 'linuxbridge']
flat_networks:
schema: [str]
value: ['*']
network_vlan_ranges:
schema: [str]
value: ['physnet1:1000:2999']
tunnel_id_ranges:
schema: [str]
value: ['20:100']
vxlan_group:
schema: str
value: '224.0.0.1'
vni_ranges:
schema: [str]
value: ['10:100']
enable_security_group:
schema: bool
value: true
package_ensure:
schema: str
value: 'present'
supported_pci_vendor_devs:
schema: [str]
value: ['15b3:1004', '8086:10ca']
sriov_agent_required:
schema: bool
value: false
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-neutron', branch: '5.1.0'}
puppet_module: 'neutron'
tags: [resource/neutron, resource/neutron_plugins_ml2]
version: 1.0.0

View File

@ -1,17 +0,0 @@
# Neutron OVS plugin puppet resource
Configure the neutron server to use the OVS plugin.
This configures the plugin for the API server, but does nothing
about configuring the agents that must also run and share a config
file with the OVS plugin if both are on the same machine.
Note, this plugin was deprecated, you may want to use the ML2 plugin instead.
NB: don't need tunnel ID range when using VLANs,
*but* you do need the network vlan range regardless of type,
because the list of networks there is still important
even if the ranges aren't specified
if type is vlan or flat, a default of physnet1:1000:2000 is used
otherwise this will not be set by default.
source https://github.com/openstack/puppet-neutron/blob/5.1.0/manifests/plugins/ovs.pp

View File

@ -1,15 +0,0 @@
class { 'neutron::plugins::ovs':
package_ensure => 'absent',
}
include neutron::params
package { 'neutron':
ensure => 'absent',
name => $::neutron::params::package_name,
}
# Remove external class dependency
Service <| title == 'neutron-plugin-ovs-service' |> {
require => undef
}

View File

@ -1,51 +0,0 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$db_user = $resource['input']['db_user']['value']
$db_host = $resource['input']['db_host']['value']
$db_password = $resource['input']['db_password']['value']
$db_name = $resource['input']['db_name']['value']
$package_ensure = $resource['input']['package_ensure']['value']
$sql_max_retries = $resource['input']['sql_max_retries']['value']
$sql_idle_timeout = $resource['input']['sql_idle_timeout']['value']
$reconnect_interval = $resource['input']['reconnect_interval']['value']
$tenant_network_type = $resource['input']['tenant_network_type']['value']
$network_vlan_ranges = $resource['input']['network_vlan_ranges']['value']
$tunnel_id_ranges = $resource['input']['tunnel_id_ranges']['value']
$vxlan_udp_port = $resource['input']['vxlan_udp_port']['value']
# Stamp neutron head, if current version is None, or upgrade head would fail later
$command = '/usr/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini'
class { 'neutron::plugins::ovs':
package_ensure => $package_ensure,
sql_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}",
sql_max_retries => $sql_max_retries,
sql_idle_timeout => $sql_idle_timeout,
reconnect_interval => $reconnect_interval,
tenant_network_type => $tenant_network_type,
network_vlan_ranges => $network_vlan_ranges,
tunnel_id_ranges => $tunnel_id_ranges,
vxlan_udp_port => $vxlan_udp_port,
} ->
exec { 'neutron-db-sync':
provider => 'shell',
command => "${command} stamp head",
path => [ '/usr/bin', '/bin' ],
onlyif => "${command} current | grep -qE '^Current revision.*None$' "
}
include neutron::params
package { 'neutron':
ensure => $package_ensure,
name => $::neutron::params::package_name,
before => Exec['neutron-db-sync']
}
# Remove external class dependency
Service <| title == 'neutron-plugin-ovs-service' |> {
require => undef
}

View File

@ -1,58 +0,0 @@
handler: puppet
id: 'neutron_plugins_ovs_puppet'
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
package_ensure:
schema: str
value: 'present'
sql_max_retries:
schema: str
value:
sql_idle_timeout:
schema: str
value:
reconnect_interval:
schema: str
value:
tenant_network_type:
schema: str
value: 'vlan'
network_vlan_ranges:
schema: str
value:
tunnel_id_ranges:
schema: str
value: '1:1000'
vxlan_udp_port:
schema: int
value: 4789
db_user:
schema: str!
value:
db_password:
schema: str!
value:
db_name:
schema: str!
value:
db_host:
schema: str!
value:
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-neutron', branch: '5.1.0'}
puppet_module: 'neutron'
tags: [resource/neutron, resource/neutron_plugins_ovs]
version: 1.0.0

View File

@ -0,0 +1,12 @@
---
# TODO: this shouldn't be outside of the resource directory
- hosts: all
sudo: yes
tasks:
- script: /vagrant/bootstrap/playbooks/files/ubuntu-ansible.sh
- include: /vagrant/bootstrap/playbooks/tasks/cinder.yml
#- include: celery.yml tags=['master'] celery_dir=/var/run/celery
- include: /vagrant/bootstrap/playbooks/build-main.yml
- include: /vagrant/bootstrap/playbooks/custom-configs.yml master_ip={{ master_ip }}
- include: /vagrant/bootstrap/playbooks/celery.yml tags=slave

View File

@ -0,0 +1,18 @@
handler: ansible
id: 'solar_bootstrap'
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
master_ip:
schema: str!
value:
tags: []
version: 1.0.0

View File

@ -8,7 +8,6 @@ from solar.interfaces.db import get_db
from solar.events.api import add_events
from solar.events.controls import Dependency
db = get_db()
@ -176,7 +175,6 @@ def connect(emitter, receiver, mapping=None, events=None):
# receiver.save()
def disconnect(emitter, receiver):
# convert if needed
# TODO: handle invalid resource

View File

@ -83,3 +83,4 @@ def test_riak():
evapi.build_edges(changed, changes_graph, events)
assert nx.topological_sort(changes_graph) == [
'riak_service1.run', 'riak_service2.join', 'riak_service3.join', 'riak_service1.commit']

View File

@ -0,0 +1,6 @@
# rename it to vagrant-settings.yml then Vagrantfile
# will use values from this file
slaves_count: 2
slaves_ram: 1024
master_ram: 1024