diff --git a/README.md b/README.md index 37a8c633..f9212223 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# x + ## Usage: Creating resources: diff --git a/haproxy-deployment.sh b/haproxy-deployment.sh new file mode 100755 index 00000000..1fae686f --- /dev/null +++ b/haproxy-deployment.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# HAProxy deployment with Keystone and Nova + +cd /vagrant + +rm clients.json +rm -Rf rs/* + +# Create resources +python cli.py resource create node1 x/resources/ro_node/ rs/ '{"ip":"10.0.0.3", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}' +python cli.py resource create node2 x/resources/ro_node/ rs/ '{"ip":"10.0.0.4", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}' +python cli.py resource create node3 x/resources/ro_node/ rs/ '{"ip":"10.0.0.5", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}' +python cli.py resource create node4 x/resources/ro_node/ rs/ '{"ip":"10.0.0.6", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}' +python cli.py resource create node5 x/resources/ro_node/ rs/ '{"ip":"10.0.0.7", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}' + +python cli.py resource create mariadb_keystone1_data x/resources/data_container/ rs/ '{"image": "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create mariadb_keystone2_data x/resources/data_container/ rs/ '{"image": "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create keystone1 x/resources/keystone/ rs/ '{"ip": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create keystone2 x/resources/keystone/ rs/ '{"ip": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create haproxy_keystone_config x/resources/haproxy_config/ rs/ '{"server": "", "ssh_user": "", "ssh_key": ""}' + +python cli.py resource create mariadb_nova1_data x/resources/data_container/ rs/ '{"image" : "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create mariadb_nova2_data x/resources/data_container/ rs/ '{"image" : "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create nova1 x/resources/nova/ rs/ '{"server": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create nova2 x/resources/nova/ rs/ '{"server": "", "ssh_user": "", "ssh_key": ""}' +python cli.py resource create haproxy_nova_config x/resources/haproxy_config/ rs/ '{"server": "", "ssh_user": "", "ssh_key": ""}' + +python cli.py resource create haproxy x/resources/haproxy/ rs/ '{"configs": [], "ssh_user": "", "ssh_key": ""}' + + +# Connect resources +python cli.py connect rs/node1 rs/mariadb_keystone1_data +python cli.py connect rs/node2 rs/mariadb_keystone2_data +python cli.py connect rs/mariadb_keystone1_data rs/keystone1 +python cli.py connect rs/mariadb_keystone2_data rs/keystone2 +python cli.py connect rs/haproxy_keystone_config rs/keystone2 --mapping '{"ip": "servers"}' + +python cli.py connect rs/node3 rs/mariadb_nova1_data +python cli.py connect rs/node4 rs/mariadb_nova2_data +python cli.py connect rs/mariadb_nova1_data rs/nova1 +python cli.py connect rs/mariadb_nova2_data rs/nova2 +python cli.py connect rs/nova2 rs/haproxy_nova_config --mapping '{"ip": "servers"}' + +python cli.py connect rs/node5 rs/haproxy +python cli.py connect rs/haproxy_keystone_config rs/haproxy --mapping '{"server": "servers"}' +python cli.py connect rs/haproxy_nova_config rs/haproxy --mapping '{"server": "servers"}' diff --git a/x/resources/haproxy/actions/remove.yml b/x/resources/haproxy/actions/remove.yml new file mode 100644 index 00000000..76142acf --- /dev/null +++ b/x/resources/haproxy/actions/remove.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker stop {{ name }} + - shell: docker rm {{ name }} diff --git a/x/resources/haproxy/actions/run.yml b/x/resources/haproxy/actions/run.yml new file mode 100644 index 00000000..e223fe8f --- /dev/null +++ b/x/resources/haproxy/actions/run.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker run -d --net="host" --privileged \ + --name {{ name }} {{ image }} diff --git a/x/resources/haproxy/meta.yaml b/x/resources/haproxy/meta.yaml new file mode 100644 index 00000000..568783c1 --- /dev/null +++ b/x/resources/haproxy/meta.yaml @@ -0,0 +1,5 @@ +id: haproxy +handler: ansible +version: 1.0.0 +input: + servers: diff --git a/x/resources/haproxy_config/actions/remove.yml b/x/resources/haproxy_config/actions/remove.yml new file mode 100644 index 00000000..76142acf --- /dev/null +++ b/x/resources/haproxy_config/actions/remove.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker stop {{ name }} + - shell: docker rm {{ name }} diff --git a/x/resources/haproxy_config/actions/run.yml b/x/resources/haproxy_config/actions/run.yml new file mode 100644 index 00000000..e223fe8f --- /dev/null +++ b/x/resources/haproxy_config/actions/run.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker run -d --net="host" --privileged \ + --name {{ name }} {{ image }} diff --git a/x/resources/haproxy_config/meta.yaml b/x/resources/haproxy_config/meta.yaml new file mode 100644 index 00000000..d6723a85 --- /dev/null +++ b/x/resources/haproxy_config/meta.yaml @@ -0,0 +1,5 @@ +id: haproxy_config +handler: ansible +version: 1.0.0 +input: + servers: diff --git a/x/resources/keystone/actions/remove.yml b/x/resources/keystone/actions/remove.yml new file mode 100644 index 00000000..76142acf --- /dev/null +++ b/x/resources/keystone/actions/remove.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker stop {{ name }} + - shell: docker rm {{ name }} diff --git a/x/resources/keystone/actions/run.yml b/x/resources/keystone/actions/run.yml new file mode 100644 index 00000000..e223fe8f --- /dev/null +++ b/x/resources/keystone/actions/run.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker run -d --net="host" --privileged \ + --name {{ name }} {{ image }} diff --git a/x/resources/keystone/meta.yaml b/x/resources/keystone/meta.yaml new file mode 100644 index 00000000..064045fa --- /dev/null +++ b/x/resources/keystone/meta.yaml @@ -0,0 +1,5 @@ +id: keystone +handler: ansible +version: 1.0.0 +input: + image: garland/docker-openstack-keystone diff --git a/x/resources/nova/actions/remove.yml b/x/resources/nova/actions/remove.yml new file mode 100644 index 00000000..76142acf --- /dev/null +++ b/x/resources/nova/actions/remove.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker stop {{ name }} + - shell: docker rm {{ name }} diff --git a/x/resources/nova/actions/run.yml b/x/resources/nova/actions/run.yml new file mode 100644 index 00000000..e223fe8f --- /dev/null +++ b/x/resources/nova/actions/run.yml @@ -0,0 +1,6 @@ +# TODO +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: docker run -d --net="host" --privileged \ + --name {{ name }} {{ image }} diff --git a/x/resources/nova/meta.yaml b/x/resources/nova/meta.yaml new file mode 100644 index 00000000..180686ed --- /dev/null +++ b/x/resources/nova/meta.yaml @@ -0,0 +1,5 @@ +id: nova +handler: ansible +version: 1.0.0 +input: + image: # TODO