diff options
author | spisarski <s.pisarski@cablelabs.com> | 2017-02-15 09:13:54 -0700 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2017-02-15 09:15:34 -0700 |
commit | 57777f3df521553a06cd01a3861b415d2905ceca (patch) | |
tree | f3b3be457baec7b5231309989aa3ffa9658cd25d /docs/examples | |
parent | 73ef791a1cde68e0d8d69cddf63534fbb90f3e2d (diff) |
Initial patch with all code from CableLabs repository.
Change-Id: I70a2778718c5e7f21fd14e4ad28c9269d3761cc7
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'docs/examples')
-rw-r--r-- | docs/examples/complex-network/deploy-complex-network.yaml | 234 | ||||
-rw-r--r-- | docs/examples/complex-network/main.yml | 16 | ||||
-rw-r--r-- | docs/examples/complex-network/playbooks/sample-playbook.yml | 20 | ||||
-rw-r--r-- | docs/examples/external-network/deploy-ext-net.yaml | 77 | ||||
-rw-r--r-- | docs/examples/simple/deploy-simple.yaml | 101 | ||||
-rw-r--r-- | docs/examples/simple/files/motd | 8 | ||||
-rw-r--r-- | docs/examples/simple/main.yml | 16 | ||||
-rw-r--r-- | docs/examples/simple/playbooks/sample-playbook.yml | 23 | ||||
-rw-r--r-- | docs/examples/two-network/deploy-two-net-centos.yaml | 96 | ||||
-rw-r--r-- | docs/examples/two-network/deploy-two-net-ubuntu.yaml | 96 |
10 files changed, 687 insertions, 0 deletions
diff --git a/docs/examples/complex-network/deploy-complex-network.yaml b/docs/examples/complex-network/deploy-complex-network.yaml new file mode 100644 index 0000000..42559e8 --- /dev/null +++ b/docs/examples/complex-network/deploy-complex-network.yaml @@ -0,0 +1,234 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +openstack: + connection: + # Note - when http_proxy is set, you must also configure ssh for proxy tunneling on your host. + username: admin + password: cable123 + auth_url: http://10.197.103.50:5000/v2.0/ + project_name: admin + http_proxy: localhost:3128 + images: + - image: + name: centos-inst-test + format: qcow2 + image_user: centos + download_url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 + nic_config_pb_loc: provisioning/ansible/centos-network-setup/playbooks/configure_host.yml + - image: + name: Ubuntu-14.04 + format: qcow2 + image_user: ubuntu + download_url: http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img + nic_config_pb_loc: provisioning/ansible/ubuntu-network-setup/playbooks/configure_host.yml + networks: + - network: + name: mgr-net + subnets: + - subnet: + name: mgr-subnet + cidr: 10.0.1.0/24 + dns_nameservers: [8.8.8.8] + - subnet: + name: mgr-subnet-2 + cidr: 10.0.2.0/24 + dns_nameservers: [8.8.8.8] + - network: + name: site1-net + subnets: + - subnet: + name: site1-subnet + cidr: 192.168.0.0/24 + gateway_ip: 192.168.0.1 + - subnet: + name: site1-subnet-2 + cidr: 192.168.1.0/24 + gateway_ip: 192.168.1.1 + - network: + name: site2-net + subnets: + - subnet: + name: site2-subnet + cidr: 192.169.0.0/24 + gateway_ip: 192.169.0.1 + routers: + # Note: Routers between internal networks not being used but put in here as an example on how to do that. + - router: + name: mgr-router + external_gateway: external + internal_subnets: + - mgr-subnet + - mgr-subnet-2 + interfaces: + - port: + name: mgr-router-to-site1 + network_name: site1-net + ip_addrs: + - subnet_name: site1-subnet + ip: 192.168.0.10 + - router: + name: site1-router + external_gateway: external + internal_subnets: + - site1-subnet + - router: + name: site2-router + external_gateway: external + internal_subnets: + - site2-subnet + - router: + name: site-to-site-router + interfaces: + - port: + name: site1-router-port + network_name: site1-net + ip_addrs: + - subnet_name: site1-subnet + ip: 192.168.0.100 + - port: + name: site2-router-port + network_name: site2-net + ip_addrs: + - subnet_name: site2-subnet + ip: 192.169.0.100 + keypairs: + - keypair: + name: cmplx-net-kp + public_filepath: /tmp/cmplx-net-kp.pub + private_filepath: /tmp/cmplx-net-kp + instances: + - instance: + name: mgr-app + flavor: m1.small + imageName: centos-inst-test + keypair_name: cmplx-net-kp + vm_boot_timeout: 600 + vm_delete_timeout: 120 + ssh_connect_timeout: 120 + ports: + - port: + name: mgr-app-port + network_name: mgr-net + ip_addrs: + - subnet_name: mgr-subnet + ip: 10.0.1.30 + - subnet_name: mgr-subnet-2 + ip: 10.0.2.30 + floating_ips: +# TODO - Why is only one of these floating IPs not working and why does it vary which one? +# - floating_ip: +# name: fip1 +# port_name: mgr-app-port +# subnet_name: mgr-subnet +# router_name: mgr-router +# provisioning: False + - floating_ip: + name: fip2 + port_name: mgr-app-port + subnet_name: mgr-subnet-2 + router_name: mgr-router + - instance: + name: site1-ovs + flavor: m1.small + imageName: centos-inst-test + keypair_name: cmplx-net-kp + vm_boot_timeout: 600 + vm_delete_timeout: 120 + ssh_connect_timeout: 120 + ports: + - port: + name: site1-ovs-mgr-port + network_name: mgr-net + - port: + name: site1-ovs-site1-port + network_name: site1-net + floating_ips: + - floating_ip: + name: fip1 + port_name: site1-ovs-mgr-port + router_name: mgr-router + - instance: + name: site2-ovs + flavor: m1.small + imageName: Ubuntu-14.04 + keypair_name: cmplx-net-kp + vm_boot_timeout: 600 + vm_delete_timeout: 120 + ssh_connect_timeout: 120 + ports: + - port: + name: site2-ovs-mgr-port + network_name: mgr-net + - port: + name: site2-ovs-site2-port + network_name: site2-net + floating_ips: + - floating_ip: + name: fip1 + port_name: site2-ovs-mgr-port + subnet_name: mgr-subnet-2 + router_name: mgr-router + - instance: + name: site2-host + flavor: m1.small + imageName: Ubuntu-14.04 + keypair_name: cmplx-net-kp + vm_boot_timeout: 600 + vm_delete_timeout: 120 + ssh_connect_timeout: 120 + ports: + - port: + name: site2-host-port + network_name: site2-net + floating_ips: + - floating_ip: + name: fip1 + port_name: site2-host-port + subnet_name: site2-subnet + router_name: site2-router +# TODO - Add a playbook here... +#ansible: +# - playbook_location: main.yml +# hosts: +# - mgr-app +# - site1-ovs +# - site2-ovs +# - site2-host +# variables: +# mac1: +# type: port +# vm_name: site1-ovs +# port_name: site1-ovs-site1-port +# port_value: mac_address +# ip1: +# type: port +# vm_name: site1-ovs +# port_name: site1-ovs-mgr-port +# port_value: ip_address +# mac2: +# type: port +# vm_name: site2-ovs +# port_name: site2-ovs-site2-port +# port_value: mac_address +# ip2: +# type: port +# vm_name: site2-ovs +# port_name: site2-ovs-mgr-port +# port_value: ip_address +# - playbook_location: ./main.yml +# hosts: +# - site1-ovs +# - site2-ovs diff --git a/docs/examples/complex-network/main.yml b/docs/examples/complex-network/main.yml new file mode 100644 index 0000000..7f213ea --- /dev/null +++ b/docs/examples/complex-network/main.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- include: playbooks/sample-playbook.yml
\ No newline at end of file diff --git a/docs/examples/complex-network/playbooks/sample-playbook.yml b/docs/examples/complex-network/playbooks/sample-playbook.yml new file mode 100644 index 0000000..726f213 --- /dev/null +++ b/docs/examples/complex-network/playbooks/sample-playbook.yml @@ -0,0 +1,20 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- hosts: all + + tasks: + - name: Say hello + command: echo 'hello world' > ~/hello.out diff --git a/docs/examples/external-network/deploy-ext-net.yaml b/docs/examples/external-network/deploy-ext-net.yaml new file mode 100644 index 0000000..31c41ec --- /dev/null +++ b/docs/examples/external-network/deploy-ext-net.yaml @@ -0,0 +1,77 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +openstack: + connection: + # Note - when http_proxy is set, you must also configure ssh for proxy tunneling on your host. + username: admin + password: cable123 + auth_url: http://10.197.103.50:5000/v2.0/ + project_name: admin + http_proxy: localhost:3128 + images: + - image: + name: Ubuntu + format: qcow2 + image_user: ubuntu + download_url: http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img + networks: + - network: + name: ext-net + external: True + network_type: vlan + project_name: service + subnets: + - subnet: + name: ext-subnet + cidr: 10.197.101.0/24 + gateway_ip: 10.197.101.1 + start: 10.197.101.101 + end: 10.197.101.200 + - network: + name: internal-net + subnets: + - subnet: + name: internal-subnet + cidr: 10.0.1.0/24 + dns_nameservers: [8.8.8.8] + routers: + - router: + name: ext-net-router + external_gateway: ext-net + internal_subnets: + - internal-subnet + keypairs: + - keypair: + name: ext-net-kp + public_filepath: /tmp/ext-net.pub + private_filepath: /tmp/ext-net + instances: + - instance: + name: ext-net-app + flavor: m1.small + imageName: Ubuntu + keypair_name: ext-net-kp + ports: + - port: + name: internal-net-port + network_name: internal-net + floating_ips: + - floating_ip: + name: fip1 + port_name: internal-net-port + router_name: ext-net-router + subnet_name: internal-subnet + diff --git a/docs/examples/simple/deploy-simple.yaml b/docs/examples/simple/deploy-simple.yaml new file mode 100644 index 0000000..ae946de --- /dev/null +++ b/docs/examples/simple/deploy-simple.yaml @@ -0,0 +1,101 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +openstack: + connection: + # Note - when http_proxy is set, you must also configure ssh for proxy tunneling on your host. + username: admin + password: cable123 +# auth_url: http://10.197.103.50:5000/v2.0/ + auth_url: http://192.168.67.10:5000/v2.0 + project_name: admin + http_proxy: 10.197.123.27:3128 + ssh_proxy_cmd: '/usr/local/bin/corkscrew 10.197.123.27 3128 %h %p' + images: + - image: + name: Ubuntu14 + format: qcow2 + image_user: ubuntu + download_url: http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img + networks: + - network: + name: simple-net + subnets: + - subnet: + name: simple-subnet + cidr: 10.0.1.0/24 + dns_nameservers: [10.5.0.8, 8.8.8.8] + routers: + - router: + name: simple-router + external_gateway: external + internal_subnets: + - simple-subnet + keypairs: + - keypair: + name: simple + public_filepath: /tmp/simple.pub + private_filepath: /tmp/simple + instances: + - instance: + name: simple-1 + flavor: m1.small + imageName: Ubuntu14 + keypair_name: simple + userdata: "#cloud-config\npassword: cable123\nchpasswd: { expire: False }\nsshr_pwauth: True" + ports: + - port: + name: simple-net-port + network_name: simple-net + floating_ips: + - floating_ip: + name: fip1 + port_name: simple-net-port + router_name: simple-router + subnet_name: simple-subnet +ansible: + - playbook_location: main.yml + hosts: + - simple-1 + variables: + greeting_msg: + type: string + value: Greetings + os_user: + type: os_creds + value: username + os_pass: + type: os_creds + value: password + os_auth_url: + type: os_creds + value: auth_url + os_project: + type: os_creds + value: project_name + fip1: + type: vm-attr + vm_name: simple-1 + value: floating_ip + mac1: + type: port + vm_name: simple-1 + port_name: simple-net-port + port_value: mac_address + ip1: + type: port + vm_name: simple-1 + port_name: simple-net-port + port_value: ip_address
\ No newline at end of file diff --git a/docs/examples/simple/files/motd b/docs/examples/simple/files/motd new file mode 100644 index 0000000..cee5d06 --- /dev/null +++ b/docs/examples/simple/files/motd @@ -0,0 +1,8 @@ +{{ greeting_msg }} +OS_USER - {{ os_user }} +OS_PASSWORD - {{ os_pass }} +AUTH_URL - {{ os_auth_url }} +PROJECT_NAME - {{ os_project }} +Floating IP - {{ fip1 }} +Port MAC = {{ mac1 }} +Port IP = {{ ip1 }} diff --git a/docs/examples/simple/main.yml b/docs/examples/simple/main.yml new file mode 100644 index 0000000..7f213ea --- /dev/null +++ b/docs/examples/simple/main.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- include: playbooks/sample-playbook.yml
\ No newline at end of file diff --git a/docs/examples/simple/playbooks/sample-playbook.yml b/docs/examples/simple/playbooks/sample-playbook.yml new file mode 100644 index 0000000..84c46e4 --- /dev/null +++ b/docs/examples/simple/playbooks/sample-playbook.yml @@ -0,0 +1,23 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- hosts: all + become: yes + become_method: sudo + become_user: root + + tasks: + - name: Create MOTD + action: template owner=root group=root mode=666 src=../files/motd dest=/etc/motd diff --git a/docs/examples/two-network/deploy-two-net-centos.yaml b/docs/examples/two-network/deploy-two-net-centos.yaml new file mode 100644 index 0000000..4fae4aa --- /dev/null +++ b/docs/examples/two-network/deploy-two-net-centos.yaml @@ -0,0 +1,96 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +openstack: + connection: + # Note - when http_proxy is set, you must also configure ssh for proxy tunneling on your host. + username: admin + password: cable123 + auth_url: http://10.197.103.50:5000/v2.0/ + project_name: admin + http_proxy: localhost:3128 + images: + - image: + name: centos + format: qcow2 + image_user: centos + download_url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 + nic_config_pb_loc: provisioning/ansible/centos-network-setup/playbooks/configure_host.yml + networks: + - network: + name: net-1 + subnets: + - subnet: + name: subnet-1 + cidr: 10.0.1.0/24 + dns_nameservers: [8.8.8.8] + - network: + name: net-2 + subnets: + - subnet: + name: subnet-2 + cidr: 10.0.2.0/24 + dns_nameservers: [8.8.8.8] + routers: + - router: + name: router-1 + external_gateway: external + internal_subnets: + - subnet-1 + keypairs: + - keypair: + name: two-net + public_filepath: /tmp/two-net.pub + private_filepath: /tmp/two-net + instances: + - instance: + name: vm1 + flavor: m1.small + imageName: centos + keypair_name: two-net + ports: + - port: + name: port-1-vm1 + network_name: net-1 + - port: + name: port-2-vm1 + network_name: net-2 + floating_ips: + - floating_ip: + name: fip1 + port_name: port-1-vm1 + router_name: router-1 + subnet_name: subnet-1 + - instance: + name: vm2 + flavor: m1.small + imageName: centos + keypair_name: two-net + ports: + - port: + name: port-1-vm2 + network_name: net-1 + - port: + name: port-2-vm2 + network_name: net-2 + ip_addrs: + - subnet_name: subnet-2 + ip: 10.0.2.101 + floating_ips: + - floating_ip: + name: fip1 + port_name: port-1-vm2 + router_name: router-1 + subnet_name: subnet-1
\ No newline at end of file diff --git a/docs/examples/two-network/deploy-two-net-ubuntu.yaml b/docs/examples/two-network/deploy-two-net-ubuntu.yaml new file mode 100644 index 0000000..ffcb05d --- /dev/null +++ b/docs/examples/two-network/deploy-two-net-ubuntu.yaml @@ -0,0 +1,96 @@ +# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs") +# and others. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +openstack: + connection: + # Note - when http_proxy is set, you must also configure ssh for proxy tunneling on your host. + username: admin + password: cable123 + auth_url: http://10.197.103.50:5000/v2.0/ + project_name: admin + http_proxy: localhost:3128 + images: + - image: + name: Ubuntu + format: qcow2 + image_user: ubuntu + download_url: http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img + nic_config_pb_loc: provisioning/ansible/ubuntu-network-setup/playbooks/configure_host.yml + networks: + - network: + name: net-1 + subnets: + - subnet: + name: subnet-1 + cidr: 10.0.1.0/24 + dns_nameservers: [8.8.8.8] + - network: + name: net-2 + subnets: + - subnet: + name: subnet-2 + cidr: 10.0.2.0/24 + dns_nameservers: [8.8.8.8] + routers: + - router: + name: router-1 + external_gateway: external + internal_subnets: + - subnet-1 + keypairs: + - keypair: + name: simple + public_filepath: /tmp/simple.pub + private_filepath: /tmp/simple + instances: + - instance: + name: vm1 + flavor: m1.small + imageName: Ubuntu + keypair_name: simple + ports: + - port: + name: port-1-vm1 + network_name: net-1 + - port: + name: port-2-vm1 + network_name: net-2 + floating_ips: + - floating_ip: + name: fip1 + port_name: port-1-vm1 + router_name: router-1 + subnet_name: subnet-1 + - instance: + name: vm2 + flavor: m1.small + imageName: Ubuntu + keypair_name: simple + ports: + - port: + name: port-1-vm2 + network_name: net-1 + - port: + name: port-2-vm2 + network_name: net-2 + ip_addrs: + - subnet_name: subnet-2 + ip: 10.0.2.101 + floating_ips: + - floating_ip: + name: fip1 + port_name: port-1-vm2 + router_name: router-1 + subnet_name: subnet-1
\ No newline at end of file |