Merge branch 'master' into librarian

Conflicts:
	examples/openstack/openstack.py
This commit is contained in:
Łukasz Oleś
2015-10-20 13:24:58 +02:00
24 changed files with 532 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- shell: rm -f {{item}}
with_items:
- /etc/apt/sources.list.d/{{name}}.list
- /etc/apt/preferences.d/{{name}}.pref
- shell: apt-get update
when: {{validate_integrity}}

View File

@@ -0,0 +1,11 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- template:
src: {{templates_dir}}/source
dest: /etc/apt/sources.list.d/{{name}}.list
- template:
src: {{templates_dir}}/preferences
dest: /etc/apt/preferences.d/{{name}}.pref
- shell: apt-get update
when: {{validate_integrity}}

View File

@@ -0,0 +1,25 @@
id: apt_repo
handler: ansible
version: 1.0.0
input:
ip:
schema: str!
value:
repo:
schema: str!
value:
name:
schema: str!
value:
package:
schema: str
value: '*'
pin:
schema: str
value:
pin_priority:
schema: int
value:
validate_integrity:
schema: bool
value: true

View File

@@ -0,0 +1,3 @@
Package: {{package}}
Pin: {{pin}}
Pin-Priority: {{pin_priority}}

View File

@@ -0,0 +1 @@
{{repo}}

View File

@@ -0,0 +1,7 @@
- hosts: [{{host}}]
sudo: yes
tasks:
- shell: echo 'Managed by solar' > /etc/apt/sources.list
when: {{ensure_other_removed}}
- shell: apt-get update
when: {{ensure_other_removed}}

View File

@@ -0,0 +1,17 @@
# This resource will clean
id: apt_repo_manager
handler: ansible
version: 1.0.0
input:
ip:
schema: str!
value:
repos:
schema: [str!]
value:
names:
schema: [str!]
value:
ensure_other_removed:
schema: bool
value: true

View File

@@ -0,0 +1,9 @@
# Node network resource for puppet handler
Setup and configure L23 networking for a node.
Leverages the powerful network_scheme structures to
create all required networking entities like interfaces,
bridges, bonds - both linux and ovs based.
Defaults are given for Debian OS family.
source https://github.com/xenolog/l23network

View File

@@ -0,0 +1,3 @@
class {'l23network':
ensure_package => 'absent',
}

View File

@@ -0,0 +1,41 @@
$resource = hiera($::resource_name)
$ensure_package = $resource['input']['ensure_package']['value']
$use_lnx = $resource['input']['use_lnx']['value']
$use_ovs = $resource['input']['use_ovs']['value']
$install_ovs = $resource['input']['install_ovs']['value']
$install_brtool = $resource['input']['install_brtool']['value']
$install_ethtool = $resource['input']['install_ethtool']['value']
$install_bondtool = $resource['input']['install_bondtool']['value']
$install_vlantool = $resource['input']['install_vlantool']['value']
$ovs_modname = $resource['input']['ovs_modname']['value']
$ovs_datapath_package_name = $resource['input']['ovs_datapath_package_name']['value']
$ovs_common_package_name = $resource['input']['ovs_common_package_name']['value']
$network_scheme = $resource['input']['network_scheme']['value']
class {'l23network':
ensure_package => $ensure_package,
use_lnx => $use_lnx,
use_ovs => $use_ovs,
install_ovs => $install_ovs,
install_brtool => $install_brtool,
install_ethtool => $install_ethtool,
install_bondtool => $install_bondtool,
install_vlantool => $install_vlantool,
ovs_modname => $ovs_modname,
ovs_datapath_package_name => $ovs_datapath_package_name,
ovs_common_package_name => $ovs_common_package_name,
}
prepare_network_config($network_scheme)
$sdn = generate_network_config()
notify { $sdn: require => Class['l23network'], }
# We need to wait at least 30 seconds for the bridges and other interfaces to
# come up after being created. This should allow for all interfaces to be up
# and ready for traffic before proceeding with further deploy steps. LP#1458954
exec { 'wait-for-interfaces':
path => '/usr/bin:/bin',
command => 'sleep 32',
require => Notify[$sdn]
}

View File

@@ -0,0 +1,60 @@
id: node_network_puppet
handler: puppet
puppet_module: l23network
version: 1.0.0
input:
package_ensure:
schema: str
value: 'present'
ensure_package:
schema: str
value: 'present'
use_lnx:
schema: bool
value: true
use_ovs:
schema: bool
value: false
install_ovs:
schema: bool
value: true
install_brtool:
schema: bool
value: true
install_ethtool:
schema: bool
value: true
install_bondtool:
schema: bool
value: true
install_vlantool:
schema: bool
value: true
ovs_modname:
schema: str
value: 'openvswitch'
ovs_datapath_package_name:
schema: str
value: 'openvswitch-datapath-dkms'
ovs_common_package_name:
schema: str
value: 'openvswitch-switch'
network_scheme:
schema: {
version: str!,
provider: str!,
interfaces: {},
transformations: [{}],
endpoints: {},
roles: {},
}
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/xenolog/l23network', branch: '50098cfa1f0f8e8d58e6a6b77a22f1380aa5c426'}
ip:
schema: str!
value:
tags: [resources/node_network]

View File

@@ -0,0 +1,11 @@
import requests
from solar.core.log import log
def test(resource):
log.debug('Testing node_network_puppet')
# requests.get(
# 'http://%s:%s' % (resource.args['ip'].value, resource.args['port'].value)
# TODO(bogdando) figure out how to test this
# )

View File

@@ -0,0 +1,9 @@
- hosts: [{{ host }}]
sudo: yes
tasks:
- apt:
name: python-libtorrent
state: present
- copy:
src: {{scripts_dir}}/solar_torrent.py
dest: /var/tmp/solar_torrent.py

View File

@@ -0,0 +1,18 @@
id: transport_torrent
handler: ansible
input:
trackers:
schema: [str!]
value: []
name:
schema: str!
value: torrent
location_id:
schema: str
value:
reverse: True
is_own: False
transports_id:
schema: str
value:
is_emit: False

View File

@@ -0,0 +1 @@
../../../solar/solar/core/transports/helpers/solar_torrent.py

View File

@@ -1,7 +1,7 @@
id: transports
input:
transports:
schema: [{user: str, password: str, port: int!, key: str, name: str!}]
schema: [{user: str, password: str, port: int!, key: str, name: str!, trackers: [str]}]
value: []
transports_id:
schema: str!