diff options
25 files changed, 84 insertions, 22 deletions
@@ -2,6 +2,10 @@ COMPASS_DIR=`cd ${BASH_SOURCE[0]%/*}/;pwd` export COMPASS_DIR +if [[ -z "$DEPLOY_STEP" ]]; then + export DEPLOY_STEP="all" +fi + for i in python-cheetah python-yaml screen; do if [[ `dpkg-query -l $i` == 0 ]]; then continue 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/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml index c9eccfb4..52318d42 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) 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/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/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/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml index f06ce193..2254f11f 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml @@ -9,6 +9,8 @@ include: openvswitch.yml when: groups['odl']|length !=0 and inventory_hostname not in groups['odl'] +- meta: flush_handlers + - name: check out new flow table if enable shell: ovs-ofctl --protocol=OpenFlow13 dump-flows br-prv | grep CONTROLLER; while [ $? -ne 0 ]; do sleep 10; ovs-ofctl --protocol=OpenFlow13 dump-flows br-prv | grep CONTROLLER; done when: groups['odl']|length !=0 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 diff --git a/deploy_compass_only.sh b/deploy_compass_only.sh new file mode 100755 index 00000000..8cb31eb8 --- /dev/null +++ b/deploy_compass_only.sh @@ -0,0 +1,3 @@ +export DEPLOY_STEP="compass_only" + +./deploy.sh $* diff --git a/deploy_host_only.sh b/deploy_host_only.sh new file mode 100755 index 00000000..accade38 --- /dev/null +++ b/deploy_host_only.sh @@ -0,0 +1,3 @@ +export DEPLOY_STEP="host_only" + +./deploy.sh $* |