Replace all templates/(.*)\.yaml with templates/\1
Change-Id: I0d371595092323f9a87393954cd0cbdd3a72ac36
This commit is contained in:
parent
e33f5ac633
commit
c92483bf01
@ -77,7 +77,7 @@ Some very simple cluster setup:
|
||||
```bash
|
||||
cd /vagrant
|
||||
|
||||
solar resource create nodes templates/nodes.yaml '{"count": 2}'
|
||||
solar resource create nodes templates/nodes '{"count": 2}'
|
||||
solar resource create mariadb_service resources/mariadb_service '{"image": "mariadb", "root_password": "mariadb", "port": 3306}'
|
||||
solar resource create keystone_db resources/mariadb_db/ '{"db_name": "keystone_db", "login_user": "root"}'
|
||||
solar resource create keystone_db_user resources/mariadb_user/ user_name=keystone user_password=keystone # another valid format
|
||||
@ -266,7 +266,7 @@ functional way, and in particular avoid `for` loops. Here's an example:
|
||||
```python
|
||||
from solar import template
|
||||
|
||||
nodes = template.nodes_from('templates/riak_nodes.yaml')
|
||||
nodes = template.nodes_from('templates/riak_nodes')
|
||||
|
||||
riak_services = nodes.on_each(
|
||||
'resources/riak_node',
|
||||
|
@ -5,7 +5,7 @@ Wordpress tutorial
|
||||
---------------
|
||||
In this tutorial we will create Worpdress site using docker containers. We will create one container with Mysql database, then we will create database and user for it. After that we will create Wordpress container which is running on Apache.
|
||||
|
||||
For now you can use Solar only in our Vagrant environment.
|
||||
For now you can use Solar only in our Vagrant environment.
|
||||
First checkout Solar repo and start vagrant. We need two virtual machines. One where Solar database and Orchestrator will run and one where we will install Wordpress and all components:
|
||||
|
||||
2. Solar installation
|
||||
@ -36,7 +36,7 @@ First we need to create Solar Resource definition where global configuration wil
|
||||
Open meta file `/vagrant/tmp/wp_repo/wp_config/meta.yaml` with your favorite text editor and paste the following data:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
handler: none
|
||||
version: 1.0.0
|
||||
input:
|
||||
@ -56,7 +56,7 @@ Open meta file `/vagrant/tmp/wp_repo/wp_config/meta.yaml` with your favorite tex
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
Let's go through this document line by line. `handler: none` says that this resource has no handler and no actions. In next line we define version. The most important part starts from line 3. We define there the inputs for this resource. It will be possible to configure following inputs:
|
||||
Let's go through this document line by line. `handler: none` says that this resource has no handler and no actions. In next line we define version. The most important part starts from line 3. We define there the inputs for this resource. It will be possible to configure following inputs:
|
||||
|
||||
* `db_root_pass` - Mysql root password
|
||||
* `db_port` - Mysql port
|
||||
@ -71,12 +71,12 @@ In schema it's defined if input will be string or integer, `!` at the end means
|
||||
|
||||
All other required resources are already available in solar repositores: `resources` and `templates`. We will use four more resources:
|
||||
|
||||
* resources/docker - it installs docker
|
||||
* resources/docker - it installs docker
|
||||
* resources/docker_container - it manages docker container
|
||||
* resources/mariadb_db - it creates database in MariaDB and Mysql
|
||||
* resources/mariadb_user - it creates user in MariaDB and Mysql
|
||||
|
||||
There are three ways to create resources in Solar: Python API, CLI and Virtual Resources. We will use the last option.
|
||||
There are three ways to create resources in Solar: Python API, CLI and Virtual Resources. We will use the last option.
|
||||
Virtual Resource is just a simple yaml file where we define all needed resources and connections.
|
||||
|
||||
Create new file `/vagrant/tmp/wp_repo/docker.yaml`, open it and past the following data:
|
||||
@ -97,7 +97,7 @@ Create new file `/vagrant/tmp/wp_repo/docker.yaml`, open it and past the followi
|
||||
wp_db_name: 'wp'
|
||||
wp_db_user: 'wp'
|
||||
wp_db_pass: 'h4ack'
|
||||
|
||||
|
||||
- id: mysql
|
||||
from: resources/docker_container
|
||||
location: node1
|
||||
@ -189,7 +189,7 @@ Now it's time to deploy our configuration. When running `vagrant up solar-dev so
|
||||
|
||||
solar resource create nodes templates/nodes count=1
|
||||
|
||||
It will create all required resources to run actions on solar-dev1. You can analyze `templates/nodes.yaml` later. Now we create resources defined in `docker.yaml`
|
||||
It will create all required resources to run actions on solar-dev1. You can analyze content of `templates/nodes/1.0.0/nodes.yaml` later (that's the source for `templates/nodes`). Now we create resources defined in `docker`
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -5,7 +5,7 @@ function deploy {
|
||||
# this two commands will clean db
|
||||
solar resource clear_all
|
||||
|
||||
solar resource create nodes templates/nodes.yaml '{"count": 1}'
|
||||
solar resource create nodes templates/nodes '{"count": 1}'
|
||||
solar resource create mariadb1 /vagrant/resources/mariadb_service image=mariadb port=3306
|
||||
solar connect node1 mariadb1
|
||||
|
||||
|
@ -10,7 +10,7 @@ from solar.dblayer.model import ModelMeta
|
||||
def run():
|
||||
ModelMeta.remove_all()
|
||||
|
||||
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 2})
|
||||
resources = vr.create('nodes', 'templates/nodes', {'count': 2})
|
||||
|
||||
node1, node2 = [x for x in resources if x.name.startswith('node')]
|
||||
hosts1, hosts2 = [x for x in resources
|
||||
|
@ -5,7 +5,7 @@ Run it from /vagrant dir:
|
||||
|
||||
```
|
||||
solar resource clear_all
|
||||
solar resource create nodes templates/nodes.yaml '{"count": 1}'
|
||||
solar resource create nodes templates/nodes '{"count": 1}'
|
||||
solar resource create librarian_example examples/librarian/librarian.yaml '{"node": "node1"}'
|
||||
|
||||
solar changes stage
|
||||
|
@ -26,5 +26,5 @@ solar res action run ceph_mon1
|
||||
To add repositories use
|
||||
|
||||
```
|
||||
solar resource create apt1 templates/mos_repos.yaml node=node1 index=1
|
||||
solar resource create apt1 templates/mos_repos node=node1 index=1
|
||||
```
|
||||
|
@ -33,7 +33,7 @@ NETWORK_METADATA = yaml.load("""
|
||||
|
||||
def deploy():
|
||||
ModelMeta.remove_all()
|
||||
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 2})
|
||||
resources = vr.create('nodes', 'templates/nodes', {'count': 2})
|
||||
first_node, second_node = [x for x in resources if x.name.startswith('node')]
|
||||
first_transp = next(x for x in resources if x.name.startswith('transport'))
|
||||
|
||||
@ -60,7 +60,7 @@ def deploy():
|
||||
})[0]
|
||||
|
||||
managed_apt = vr.create(
|
||||
'managed_apt1', 'templates/mos_repos.yaml',
|
||||
'managed_apt1', 'templates/mos_repos',
|
||||
{'node': first_node.name, 'index': 0})[-1]
|
||||
|
||||
keys.connect(ceph_mon, {})
|
||||
|
@ -45,8 +45,8 @@ def lxc_template(idx):
|
||||
def deploy():
|
||||
ModelMeta.remove_all()
|
||||
|
||||
node1 = vr.create('nodes', 'templates/nodes.yaml', {})[0]
|
||||
seed = vr.create('nodes', 'templates/seed_node.yaml', {})[0]
|
||||
node1 = vr.create('nodes', 'templates/nodes', {})[0]
|
||||
seed = vr.create('nodes', 'templates/seed_node', {})[0]
|
||||
|
||||
ssh_key = vr.create('ssh_key1', 'resources/ssh_key', {
|
||||
'keys_dir': '/vagrant/.ssh',
|
||||
|
@ -40,9 +40,9 @@ def main():
|
||||
|
||||
|
||||
def prepare_nodes(nodes_count):
|
||||
resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": nodes_count})
|
||||
resources = vr.create('nodes', 'templates/nodes_with_transports', {"count": nodes_count})
|
||||
nodes = [x for x in resources if x.name.startswith('node')]
|
||||
resources = vr.create('nodes_network', 'templates/nodes_network.yaml', {"count": nodes_count})
|
||||
resources = vr.create('nodes_network', 'templates/nodes_network', {"count": nodes_count})
|
||||
nodes_sdn = [x for x in resources if x.name.startswith('node')]
|
||||
r = {}
|
||||
|
||||
|
@ -40,7 +40,7 @@ requests.post(bareon_sync)
|
||||
nodes_list = requests.get(discovery_service).json()
|
||||
|
||||
# Create slave node resources
|
||||
node_resources = vr.create('nodes', 'templates/not_provisioned_nodes.yaml',
|
||||
node_resources = vr.create('nodes', 'templates/not_provisioned_nodes',
|
||||
{'nodes': nodes_list})
|
||||
|
||||
# Get master node
|
||||
|
@ -30,21 +30,21 @@ resources:
|
||||
riaks: ['riak_service1', 'riak_service2', 'riak_service3']
|
||||
|
||||
- id: haproxy1
|
||||
from: templates/haproxy.yaml
|
||||
from: templates/haproxy
|
||||
values:
|
||||
node: {{nodes[0]}}
|
||||
service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http']
|
||||
index: 1
|
||||
|
||||
- id: haproxy2
|
||||
from: templates/haproxy.yaml
|
||||
from: templates/haproxy
|
||||
values:
|
||||
node: {{nodes[1]}}
|
||||
service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http']
|
||||
index: 2
|
||||
|
||||
- id: haproxy3
|
||||
from: templates/haproxy.yaml
|
||||
from: templates/haproxy
|
||||
values:
|
||||
node: {{nodes[2]}}
|
||||
service_configs: ['haproxy_riak_config_pb', 'haproxy_riak_config_http']
|
||||
|
@ -15,7 +15,7 @@ from solar.dblayer.model import ModelMeta
|
||||
def setup_riak():
|
||||
|
||||
ModelMeta.remove_all()
|
||||
nodes = template.nodes_from('templates/riak_nodes.yaml')
|
||||
nodes = template.nodes_from('templates/riak_nodes')
|
||||
|
||||
riak_services = nodes.on_each(
|
||||
'resources/riak_node',
|
||||
|
@ -31,7 +31,7 @@ from solar.dblayer.solar_models import Resource
|
||||
def setup_riak():
|
||||
|
||||
ModelMeta.remove_all()
|
||||
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 3})
|
||||
resources = vr.create('nodes', 'templates/nodes', {'count': 3})
|
||||
nodes = [x for x in resources if x.name.startswith('node')]
|
||||
hosts_services = [x for x in resources if x.name.startswith('hosts_file')]
|
||||
node1, node2, node3 = nodes
|
||||
|
@ -28,7 +28,7 @@ def setup_riak(nodes_num=None, hosts_mapping=False):
|
||||
nodes_num = NODES
|
||||
db.clear()
|
||||
|
||||
resources = vr.create('nodes', 'templates/nodes.yaml', {'count': nodes_num})
|
||||
resources = vr.create('nodes', 'templates/nodes', {'count': nodes_num})
|
||||
nodes = [x for x in resources if x.name.startswith('node')]
|
||||
hosts_services = [x for x in resources if x.name.startswith('hosts_file')]
|
||||
|
||||
|
@ -19,7 +19,7 @@ resources:
|
||||
ssh_key: '#{ssh_key}#'
|
||||
|
||||
- id: keystone_base
|
||||
from: templates/keystone_base.yaml
|
||||
from: templates/keystone_base
|
||||
values:
|
||||
login_user: root
|
||||
login_password: 'mariadb_service::root_password'
|
||||
@ -33,7 +33,7 @@ resources:
|
||||
ssh_key: '#{ssh_key}#'
|
||||
|
||||
- id: keystone_api_1
|
||||
from: templates/keystone_api.yaml
|
||||
from: templates/keystone_api
|
||||
values:
|
||||
idx: 1
|
||||
db_password: 'keystone_db_user::user_password'
|
||||
@ -49,7 +49,7 @@ resources:
|
||||
ssh_key: '#{ssh_key}#'
|
||||
|
||||
- id: openstack_base
|
||||
from: templates/openstack_base.yaml
|
||||
from: templates/openstack_base
|
||||
values:
|
||||
ip: '#{ip}#'
|
||||
ssh_user: '#{ssh_user}#'
|
||||
|
@ -2,7 +2,7 @@ id: glance_#{idx}#
|
||||
|
||||
resources:
|
||||
- id: glance_base_#{ idx }#
|
||||
from: templates/glance_db.yaml
|
||||
from: templates/glance_db
|
||||
values:
|
||||
idx: '#{ idx }#'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user