diff options
Diffstat (limited to 'deploy')
30 files changed, 132 insertions, 49 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 8dadd584..a60b3d05 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -1,21 +1,19 @@ --- - hosts: all remote_user: root - sudo: True roles: - common - setup-network - hosts: ha remote_user: root - sudo: True roles: - ha - hosts: controller remote_user: root - sudo: True roles: + - memcached - database - mq - keystone @@ -38,7 +36,6 @@ - hosts: compute remote_user: root - sudo: True roles: - nova-compute - neutron-compute @@ -47,13 +44,11 @@ - hosts: all remote_user: root - sudo: True roles: - odl_cluster - hosts: all remote_user: root - sudo: True roles: - onos_cluster @@ -65,24 +60,20 @@ - hosts: controller remote_user: root - sudo: True roles: - ext-network - hosts: ceph_adm remote_user: root - sudo: True roles: - ceph-deploy - hosts: all remote_user: root - sudo: True roles: - monitor - hosts: all remote_user: root - sudo: True roles: - secgroup diff --git a/deploy/adapters/ansible/openstack/templates/nova.conf b/deploy/adapters/ansible/openstack/templates/nova.conf index 2364132e..cec11440 100644 --- a/deploy/adapters/ansible/openstack/templates/nova.conf +++ b/deploy/adapters/ansible/openstack/templates/nova.conf @@ -1,3 +1,9 @@ +{% set memcached_servers = [] %} +{% for host in haproxy_hosts.values() %} +{% set _ = memcached_servers.append('%s:11211'% host) %} +{% endfor %} +{% set memcached_servers = memcached_servers|join(',') %} + [DEFAULT] dhcpbridge_flagfile=/etc/nova/nova.conf dhcpbridge=/usr/bin/nova-dhcpbridge @@ -49,7 +55,7 @@ notify_on_state_change = vm_and_task_state notification_driver = nova.openstack.common.notifier.rpc_notifier notification_driver = ceilometer.compute.nova_notifier -memcached_servers = {{ internal_vip.ip }}:11211 +memcached_servers = {{ memcached_servers }} [database] # The SQLAlchemy connection string used to connect to the database @@ -64,6 +70,7 @@ identity_uri = http://{{ internal_vip.ip }}:35357 admin_tenant_name = service admin_user = nova admin_password = {{ NOVA_PASS }} +memcached_servers = {{ memcached_servers }} [glance] host = {{ internal_vip.ip }} diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml index cb78acb6..98ac1274 100644 --- a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/main.yml @@ -15,3 +15,7 @@ - ceilometer_configs_templates - dest notify: restart ceilometer relation service + +- name: write services to monitor list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: ceilometer_services diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml index cb78acb6..98ac1274 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/main.yml @@ -15,3 +15,7 @@ - ceilometer_configs_templates - dest notify: restart ceilometer relation service + +- name: write services to monitor list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: ceilometer_services diff --git a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml index 686ce1f5..66bb5f06 100644 --- a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml +++ b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml @@ -4,7 +4,7 @@ with_items: packages | union(packages_noarch) - name: generate common cinder service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: upload cinder conf diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml index 6b193d6e..342f61ae 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml @@ -6,7 +6,7 @@ with_items: packages | union(packages_noarch) - name: generate cinder volume service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: check if physical device exists diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml index d4247ce5..c4c10099 100644 --- a/deploy/adapters/ansible/roles/common/tasks/main.yml +++ b/deploy/adapters/ansible/roles/common/tasks/main.yml @@ -52,3 +52,7 @@ - name: restart services service: name={{ item }} state=restarted enabled=yes with_items: services| union(services_noarch) + +- name: write services to monitor list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: services| union(services_noarch) diff --git a/deploy/adapters/ansible/roles/common/vars/main.yml b/deploy/adapters/ansible/roles/common/vars/main.yml index e3dfa496..2c5b5679 100644 --- a/deploy/adapters/ansible/roles/common/vars/main.yml +++ b/deploy/adapters/ansible/roles/common/vars/main.yml @@ -2,7 +2,5 @@ packages_noarch: - python-pip - ntp - - memcached -services_noarch: - - memcached +services_noarch: [] diff --git a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml index 54e48c25..86b4f93d 100644 --- a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml +++ b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml @@ -11,6 +11,9 @@ - name: restart http services service: name={{ http_service }} state=restarted enabled=yes +- name: write services to monitor list + lineinfile: dest=/opt/service create=yes line='{{ http_service }}' + - name: install dashboard packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: packages | union(packages_noarch) @@ -18,11 +21,6 @@ - name: remove ubuntu theme action: "{{ ansible_pkg_mgr }} name=openstack-dashboard-ubuntu-theme state=absent" -- name: update memcached conf - lineinfile: dest=/etc/memcached.conf state=present - regexp="-l *" - line="-l {{ internal_vip.ip }}" - - name: update ubuntu horizon settings lineinfile: dest: /etc/openstack-dashboard/local_settings.py diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml index 96df442d..35ee5858 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml @@ -3,6 +3,7 @@ service: name: mysql state: restarted + enabled: yes args: "--wsrep-new-cluster" when: - inventory_hostname == haproxy_hosts.keys()[0] @@ -21,6 +22,7 @@ service: name: mysql state: restarted + enabled: yes when: - inventory_hostname != haproxy_hosts.keys()[0] diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml index 41ee5ffe..97e00503 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml @@ -46,4 +46,4 @@ shell: rm -rf /var/lib/mysql/ib_logfile* - name: set owner - file: path=/var/lib owner=mysql group=mysql recurse=yes state=directory + file: path=/var/lib/mysql owner=mysql group=mysql recurse=yes state=directory diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml index c5e1d6d1..ada7f7ef 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml @@ -21,7 +21,10 @@ - /var/lib/mongodb/journal/* - name: manually restart mongodb server - service: name={{ mongodb_service }} state=restarted + service: name={{ mongodb_service }} state=restarted enabled=yes + +- name: write mongodb to monitor list + lineinfile: dest=/opt/service create=yes line={{ mongodb_service}} - wait_for: port=27017 delay=3 timeout=60 host={{ internal_vip.ip }} diff --git a/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml b/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml index 1a34c6f5..bd6b582b 100644 --- a/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml +++ b/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml @@ -4,7 +4,7 @@ with_items: packages | union(packages_noarch) - name: generate glance service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: update glance conf diff --git a/deploy/adapters/ansible/roles/ha/tasks/main.yml b/deploy/adapters/ansible/roles/ha/tasks/main.yml index 668f6847..f60740a3 100644 --- a/deploy/adapters/ansible/roles/ha/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ha/tasks/main.yml @@ -6,7 +6,7 @@ with_items: packages | union(packages_noarch) - name: generate ha service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: install pexpect diff --git a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg index 0778bb13..7d783a30 100644 --- a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg +++ b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg @@ -169,12 +169,16 @@ listen proxy-ceilometer_api_cluster listen proxy-dashboarad bind {{ public_vip.ip }}:80 - option tcpka - option httpchk - option tcplog - balance source + mode http + balance source + capture cookie vgnvisitor= len 32 + cookie SERVERID insert indirect nocache + option forwardfor + option httpchk + option httpclose + rspidel ^Set-cookie:\ IP= {% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:80 weight 1 check inter 2000 rise 2 fall 5 + server {{ host }} {{ ip }}:80 cookie {{ host }} weight 1 check inter 2000 rise 2 fall 5 {% endfor %} listen stats diff --git a/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml b/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml index ab23f873..32d8f42e 100644 --- a/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml +++ b/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml @@ -6,7 +6,7 @@ with_items: packages | union(packages_noarch) - name: generate heat service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: update heat conf diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml index e4488016..172d356e 100644 --- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml +++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml @@ -6,7 +6,7 @@ with_items: packages | union(packages_noarch) - name: generate keystone service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: update keystone conf diff --git a/deploy/adapters/ansible/roles/keystone/templates/keystone.conf b/deploy/adapters/ansible/roles/keystone/templates/keystone.conf index b022a084..22173e44 100644 --- a/deploy/adapters/ansible/roles/keystone/templates/keystone.conf +++ b/deploy/adapters/ansible/roles/keystone/templates/keystone.conf @@ -1,3 +1,8 @@ +{% set memcached_servers = [] %} +{% for host in haproxy_hosts.values() %} +{% set _ = memcached_servers.append('%s:11211'% host) %} +{% endfor %} +{% set memcached_servers = memcached_servers|join(',') %} [DEFAULT] admin_token={{ ADMIN_TOKEN }} @@ -518,8 +523,8 @@ log_dir = /var/log/keystone # (dogpile.cache.redis) be used in production deployments. # Small workloads (single process) like devstack can use the # dogpile.cache.memory backend. (string value) -#backend=keystone.common.cache.noop - +backend=keystone.cache.memcache_pool +memcache_servers={{ memcached_servers}} # Use a key-mangling function (sha1) to ensure fixed length # cache-keys. This is toggle-able for debugging purposes, it # is highly recommended to always leave this set to True. @@ -540,7 +545,7 @@ log_dir = /var/log/keystone # Global toggle for all caching using the should_cache_fn # mechanism. (boolean value) -#enabled=false +enabled=true # Extra debugging from the cache backend (cache keys, # get/set/delete/etc calls) This is only really useful if you diff --git a/deploy/adapters/ansible/roles/memcached/tasks/main.yml b/deploy/adapters/ansible/roles/memcached/tasks/main.yml new file mode 100644 index 00000000..8b955cbb --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: install packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" + with_items: packages | union(packages_noarch) + +- name: change memcache listen ip + lineinfile: dest=/etc/memcached.conf regexp="^-l " line="-l 0.0.0.0" + +- name: restart services + service: name={{ item }} state=restarted enabled=yes + with_items: services| union(services_noarch) diff --git a/deploy/adapters/ansible/roles/memcached/vars/Debian.yml b/deploy/adapters/ansible/roles/memcached/vars/Debian.yml new file mode 100644 index 00000000..7a0d09de --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/vars/Debian.yml @@ -0,0 +1,7 @@ +--- +packages: + - python-memcache + +services: [] + + diff --git a/deploy/adapters/ansible/roles/memcached/vars/RedHat.yml b/deploy/adapters/ansible/roles/memcached/vars/RedHat.yml new file mode 100644 index 00000000..8cd2462c --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/vars/RedHat.yml @@ -0,0 +1,7 @@ +--- +packages: + - python-memcached + +pip_packages: [] + +services: [] diff --git a/deploy/adapters/ansible/roles/memcached/vars/main.yml b/deploy/adapters/ansible/roles/memcached/vars/main.yml new file mode 100644 index 00000000..40c400a6 --- /dev/null +++ b/deploy/adapters/ansible/roles/memcached/vars/main.yml @@ -0,0 +1,6 @@ +--- +packages_noarch: + - memcached + +services_noarch: + - memcached diff --git a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml index 640692ff..f3474ea4 100644 --- a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml @@ -24,7 +24,7 @@ when: ansible_os_family == 'RedHat' - name: generate neutron compute service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: config ml2 plugin diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml index fce12722..044163e8 100644 --- a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml +++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml @@ -6,7 +6,7 @@ with_items: packages | union(packages_noarch) - name: generate neutron control service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: get tenant id to fill neutron.conf diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml index f8e9e8c4..fc1bc638 100644 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml @@ -36,7 +36,7 @@ with_items: packages | union(packages_noarch) - name: generate neutron network service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: fix openstack neutron plugin config file @@ -82,7 +82,8 @@ - include: odl.yml when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS }}" -- name: restart neutron services - debug: msg="restart neutron services" - notify: - - restart neutron network relation service +- name: restart neutron network relation service + service: name={{ item }} state=restarted enabled=yes + with_flattened: + - services_noarch + - services diff --git a/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml b/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml index f4bb373e..45dab3f8 100644 --- a/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml @@ -20,7 +20,7 @@ - restart nova-compute services - name: generate neutron control service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml index 7242fda6..58159589 100644 --- a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml +++ b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml @@ -6,7 +6,7 @@ with_items: packages | union(packages_noarch) - name: generate nova control service list - shell: echo {{ item }} >> /opt/service + lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) - name: update nova conf diff --git a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml index 818ac57a..6f024f18 100644 --- a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: disable NetworkManager + service: name=NetworkManager state=stopped enabled=no + when: ansible_os_family == 'RedHat' + +- name: enable network service + service: name=network state=started enabled=yes + when: ansible_os_family == 'RedHat' + - name: add ovs bridge openvswitch_bridge: bridge={{ item["name"] }} state=present with_items: "{{ network_cfg['provider_net_mappings'] }}" diff --git a/deploy/conf/cluster.conf b/deploy/conf/cluster.conf index 200fae65..09a8aae4 100644 --- a/deploy/conf/cluster.conf +++ b/deploy/conf/cluster.conf @@ -1,17 +1,25 @@ +# for Operating System export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)ubuntu-14\.04\.3.*'} +#export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)CentOS-7.*1503-01.*'} + +# don't touch this export ADAPTER_TARGET_SYSTEM_PATTERN="^openstack$" + +# for openstack juno export REPO_NAME=${REPO_NAME:-"trusty-juno-ppa"} export ADAPTER_NAME="openstack_juno" export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-juno" + + +# for openstack kilo #export REPO_NAME=${REPO_NAME:-"trusty-liberty-ppa"} #export ADAPTER_NAME="openstack_liberty" #export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-liberty" -#export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)CentOS-7.*1503-01.*'} +# for openstack kilo on Centos7 #export REPO_NAME=${REPO_NAME:-"centos7-kilo-ppa"} #export ADAPTER_NAME="openstack_kilo" -#export ADAPTER_TARGET_SYSTEM_PATTERN="^openstack$" #export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-kilo" export DEFAULT_ROLES="" diff --git a/deploy/launch.sh b/deploy/launch.sh index bad03cf7..9a223ec9 100755 --- a/deploy/launch.sh +++ b/deploy/launch.sh @@ -18,7 +18,7 @@ source ${COMPASS_DIR}/deploy/compass_vm.sh source ${COMPASS_DIR}/deploy/deploy_host.sh ######################### main process -if true +if [[ "$DEPLOY_STEP" == "compass_only" || "$DEPLOY_STEP" == "all" ]] then if ! prepare_env;then echo "prepare_env failed" @@ -34,7 +34,7 @@ fi log_info "deploy host macs: $machines" export machines - +echo "export machines=\""$machines"\"" > $WORK_DIR/switch_machines log_info "########## set up network begin #############" if ! create_nets;then log_error "create_nets failed" @@ -45,10 +45,21 @@ if ! launch_compass;then log_error "launch_compass failed" exit 1 fi + else + # test code -export machines="'00:00:3d:a4:ee:4c','00:00:63:35:3c:2b','00:00:f2:f2:b7:a5','00:00:2f:d3:88:28','00:00:46:67:11:e7'" +if [[ -f $WORK_DIR/switch_machines ]]; then + echo "using last generated machines" + source $WORK_DIR/switch_machines +else + export machines="'00:00:3d:a4:ee:4c','00:00:63:35:3c:2b','00:00:f2:f2:b7:a5','00:00:2f:d3:88:28','00:00:46:67:11:e7'" +fi + fi + +if [[ "$DEPLOY_STEP" == "host_only" || "$DEPLOY_STEP" == "all" ]]; then + if [[ ! -z $VIRT_NUMBER ]];then if ! launch_host_vms;then log_error "launch_host_vms failed" @@ -64,3 +75,5 @@ else #tear_down_compass exit 0 fi + +fi |