From 892cd68005252cb81902020e9fe4b1c7f0d3c0b9 Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Wed, 29 Mar 2017 15:11:27 +0200 Subject: [PATCH] xci: Add ansible files for sandbox noha flavor This patch adds noha target host configuration playbook, inventory, variable files and so on to use until we have time to fix things more properly and some other functionality becomes available in upstream. This approach will result in duplicates but it is something we can perhaps live with. NFS configuration is converted into a role and the rest is adjusted accordingly. The playbook to configure target hosts will be same with the one we will have for ha flavor but for different for the flavor mini. The user variables and openstack user configuration will be different between flavors and keeping deployment specific configuration. Change-Id: I8faceae846285fc3e4260cbced5b740a9b0c3766 Signed-off-by: Fatih Degirmenci --- prototypes/xci/file/noha/configure-targethosts.yml | 36 ++++ prototypes/xci/file/noha/flavor-vars.yml | 27 +++ prototypes/xci/file/noha/inventory | 9 + prototypes/xci/file/noha/openstack_user_config.yml | 190 +++++++++++++++++++++ prototypes/xci/file/noha/user_variables.yml | 27 +++ prototypes/xci/file/user_variables.yml | 0 .../playbooks/roles/configure-nfs/tasks/main.yml | 36 ++++ 7 files changed, 325 insertions(+) create mode 100644 prototypes/xci/file/noha/configure-targethosts.yml create mode 100644 prototypes/xci/file/noha/user_variables.yml delete mode 100644 prototypes/xci/file/user_variables.yml create mode 100644 prototypes/xci/playbooks/roles/configure-nfs/tasks/main.yml diff --git a/prototypes/xci/file/noha/configure-targethosts.yml b/prototypes/xci/file/noha/configure-targethosts.yml new file mode 100644 index 000000000..6dc147f3b --- /dev/null +++ b/prototypes/xci/file/noha/configure-targethosts.yml @@ -0,0 +1,36 @@ +--- +- hosts: all + remote_user: root + tasks: + - name: add public key to host + copy: + src: ../file/authorized_keys + dest: /root/.ssh/authorized_keys + - name: configure modules + copy: + src: ../file/modules + dest: /etc/modules + +- hosts: controller + remote_user: root + vars_files: + - ../var/{{ ansible_os_family }}.yml + - ../var/flavor-vars.yml + roles: + # TODO: this only works for ubuntu/xenial and need to be adjusted for other distros + - { role: configure-network, when: ansible_distribution_release == "xenial", src: "../template/controller.interface.j2", dest: "/etc/network/interfaces" } + +- hosts: compute + remote_user: root + vars_files: + - ../var/{{ ansible_os_family }}.yml + - ../var/flavor-vars.yml + roles: + # TODO: this only works for ubuntu/xenial and need to be adjusted for other distros + - { role: configure-network, when: ansible_distribution_release == "xenial", src: "../template/compute.interface.j2", dest: "/etc/network/interfaces" } + +- hosts: compute01 + remote_user: root + # TODO: this role is for configuring NFS on xenial and adjustment needed for other distros + roles: + - role: configure-nfs diff --git a/prototypes/xci/file/noha/flavor-vars.yml b/prototypes/xci/file/noha/flavor-vars.yml index e69de29bb..7f52d343a 100644 --- a/prototypes/xci/file/noha/flavor-vars.yml +++ b/prototypes/xci/file/noha/flavor-vars.yml @@ -0,0 +1,27 @@ +--- +host_info: { + 'opnfv': { + 'MGMT_IP': '172.29.236.10', + 'VLAN_IP': '192.168.122.2', + 'STORAGE_IP': '172.29.244.10' + }, + 'controller00': { + 'MGMT_IP': '172.29.236.11', + 'VLAN_IP': '192.168.122.3', + 'STORAGE_IP': '172.29.244.11' + }, + 'compute00': { + 'MGMT_IP': '172.29.236.12', + 'VLAN_IP': '192.168.122.4', + 'VLAN_IP_SECOND': '173.29.241.1', + 'VXLAN_IP': '172.29.240.12', + 'STORAGE_IP': '172.29.244.12' + }, + 'compute01': { + 'MGMT_IP': '172.29.236.13', + 'VLAN_IP': '192.168.122.5', + 'VLAN_IP_SECOND': '173.29.241.2', + 'VXLAN_IP': '172.29.240.13', + 'STORAGE_IP': '172.29.244.13' + } +} diff --git a/prototypes/xci/file/noha/inventory b/prototypes/xci/file/noha/inventory index e69de29bb..b4f9f6d0c 100644 --- a/prototypes/xci/file/noha/inventory +++ b/prototypes/xci/file/noha/inventory @@ -0,0 +1,9 @@ +[opnfv] +opnfv ansible_ssh_host=192.168.122.2 + +[controller] +controller00 ansible_ssh_host=192.168.122.3 + +[compute] +compute00 ansible_ssh_host=192.168.122.4 +compute01 ansible_ssh_host=192.168.122.5 diff --git a/prototypes/xci/file/noha/openstack_user_config.yml b/prototypes/xci/file/noha/openstack_user_config.yml index e69de29bb..999741580 100644 --- a/prototypes/xci/file/noha/openstack_user_config.yml +++ b/prototypes/xci/file/noha/openstack_user_config.yml @@ -0,0 +1,190 @@ +--- +cidr_networks: + container: 172.29.236.0/22 + tunnel: 172.29.240.0/22 + storage: 172.29.244.0/22 + +used_ips: + - "172.29.236.1,172.29.236.50" + - "172.29.240.1,172.29.240.50" + - "172.29.244.1,172.29.244.50" + - "172.29.248.1,172.29.248.50" + +global_overrides: + internal_lb_vip_address: 172.29.236.11 + external_lb_vip_address: 192.168.122.3 + tunnel_bridge: "br-vxlan" + management_bridge: "br-mgmt" + provider_networks: + - network: + container_bridge: "br-mgmt" + container_type: "veth" + container_interface: "eth1" + ip_from_q: "container" + type: "raw" + group_binds: + - all_containers + - hosts + is_container_address: true + is_ssh_address: true + - network: + container_bridge: "br-vxlan" + container_type: "veth" + container_interface: "eth10" + ip_from_q: "tunnel" + type: "vxlan" + range: "1:1000" + net_name: "vxlan" + group_binds: + - neutron_linuxbridge_agent + - network: + container_bridge: "br-vlan" + container_type: "veth" + container_interface: "eth12" + host_bind_override: "eth12" + type: "flat" + net_name: "flat" + group_binds: + - neutron_linuxbridge_agent + - network: + container_bridge: "br-vlan" + container_type: "veth" + container_interface: "eth11" + type: "vlan" + range: "1:1" + net_name: "vlan" + group_binds: + - neutron_linuxbridge_agent + - network: + container_bridge: "br-storage" + container_type: "veth" + container_interface: "eth2" + ip_from_q: "storage" + type: "raw" + group_binds: + - glance_api + - cinder_api + - cinder_volume + - nova_compute + +# ## +# ## Infrastructure +# ## + +# galera, memcache, rabbitmq, utility +shared-infra_hosts: + controller00: + ip: 172.29.236.11 + +# repository (apt cache, python packages, etc) +repo-infra_hosts: + controller00: + ip: 172.29.236.11 + +# load balancer +# Ideally the load balancer should not use the Infrastructure hosts. +# Dedicated hardware is best for improved performance and security. +haproxy_hosts: + controller00: + ip: 172.29.236.11 + +# rsyslog server +# log_hosts: +# log1: +# ip: 172.29.236.14 + +# ## +# ## OpenStack +# ## + +# keystone +identity_hosts: + controller00: + ip: 172.29.236.11 + +# cinder api services +storage-infra_hosts: + controller00: + ip: 172.29.236.11 + +# glance +# The settings here are repeated for each infra host. +# They could instead be applied as global settings in +# user_variables, but are left here to illustrate that +# each container could have different storage targets. +image_hosts: + controller00: + ip: 172.29.236.11 + container_vars: + limit_container_types: glance + glance_nfs_client: + - server: "172.29.244.13" + remote_path: "/images" + local_path: "/var/lib/glance/images" + type: "nfs" + options: "_netdev,auto" + +# nova api, conductor, etc services +compute-infra_hosts: + controller00: + ip: 172.29.236.11 + +# heat +orchestration_hosts: + controller00: + ip: 172.29.236.11 + +# horizon +dashboard_hosts: + controller00: + ip: 172.29.236.11 + +# neutron server, agents (L3, etc) +network_hosts: + controller00: + ip: 172.29.236.11 + +# ceilometer (telemetry API) +metering-infra_hosts: + controller00: + ip: 172.29.236.11 + +# aodh (telemetry alarm service) +metering-alarm_hosts: + controller00: + ip: 172.29.236.11 + +# gnocchi (telemetry metrics storage) +metrics_hosts: + controller00: + ip: 172.29.236.11 + +# nova hypervisors +compute_hosts: + compute00: + ip: 172.29.236.12 + compute01: + ip: 172.29.236.13 + +# ceilometer compute agent (telemetry) +metering-compute_hosts: + compute00: + ip: 172.29.236.12 + compute01: + ip: 172.29.236.13 +# cinder volume hosts (NFS-backed) +# The settings here are repeated for each infra host. +# They could instead be applied as global settings in +# user_variables, but are left here to illustrate that +# each container could have different storage targets. +storage_hosts: + controller00: + ip: 172.29.236.11 + container_vars: + cinder_backends: + limit_container_types: cinder_volume + lvm: + volume_group: cinder-volumes + volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver + volume_backend_name: LVM_iSCSI + iscsi_ip_address: "172.29.244.11" diff --git a/prototypes/xci/file/noha/user_variables.yml b/prototypes/xci/file/noha/user_variables.yml new file mode 100644 index 000000000..e4a63a257 --- /dev/null +++ b/prototypes/xci/file/noha/user_variables.yml @@ -0,0 +1,27 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# 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. + +# ## +# ## This file contains commonly used overrides for convenience. Please inspect +# ## the defaults for each role to find additional override options. +# ## + +# # Debug and Verbose options. +debug: false + +haproxy_keepalived_external_vip_cidr: "192.168.122.3/32" +haproxy_keepalived_internal_vip_cidr: "172.29.236.11/32" +haproxy_keepalived_external_interface: br-vlan +haproxy_keepalived_internal_interface: br-mgmt diff --git a/prototypes/xci/file/user_variables.yml b/prototypes/xci/file/user_variables.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/prototypes/xci/playbooks/roles/configure-nfs/tasks/main.yml b/prototypes/xci/playbooks/roles/configure-nfs/tasks/main.yml new file mode 100644 index 000000000..b188f4dbb --- /dev/null +++ b/prototypes/xci/playbooks/roles/configure-nfs/tasks/main.yml @@ -0,0 +1,36 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# TODO: this is for xenial and needs to be adjusted for different distros +- block: + - name: make NFS dir + file: + dest: /images + mode: 777 + state: directory + - name: configure NFS service + lineinfile: + dest: /etc/services + state: present + create: yes + line: "{{ item }}" + with_items: + - "nfs 2049/tcp" + - "nfs 2049/udp" + - name: configure NFS exports on ubuntu xenial + copy: + src: ../file/exports + dest: /etc/exports + when: ansible_distribution_release == "xenial" + # TODO: the service name might be different on other distros and needs to be adjusted + - name: restart ubuntu xenial NFS service + service: + name: nfs-kernel-server + state: restarted + when: ansible_distribution_release == "xenial" -- 2.16.6