diff options
Diffstat (limited to 'deploy/adapters/ansible')
16 files changed, 77 insertions, 49 deletions
diff --git a/deploy/adapters/ansible/openstack/templates/nova.conf b/deploy/adapters/ansible/openstack/templates/nova.conf index ed415915..b15032f5 100644 --- a/deploy/adapters/ansible/openstack/templates/nova.conf +++ b/deploy/adapters/ansible/openstack/templates/nova.conf @@ -49,6 +49,8 @@ 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 + [database] # The SQLAlchemy connection string used to connect to the database connection = mysql://nova:{{ NOVA_DBPASS }}@{{ db_host }}/nova diff --git a/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh b/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh index 02860bde..d0c631fb 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh +++ b/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh @@ -5,17 +5,6 @@ umount /var/local/osd rm -r /var/local/osd fi -if [ ! -d "/ceph/images" ]; then -mkdir -p /ceph/images -fi - -rm -f /ceph/images/ceph-volumes.img - -if [ ! -f "/ceph/images/ceph-volumes.img" ]; then -echo "create ceph-volumes.img" -dd if=/dev/zero of=/ceph/images/ceph-volumes.img bs=1K seek=$(df / | awk '$3 ~ /[0-9]+/ { print $4 }') count=0 oflag=direct -sgdisk -g --clear /ceph/images/ceph-volumes.img -fi #safe check ps -ef |grep lvremove |awk '{print $2}' |xargs kill -9 @@ -23,24 +12,20 @@ ps -ef |grep vgremove |awk '{print $2}' |xargs kill -9 ps -ef |grep vgcreate |awk '{print $2}' |xargs kill -9 ps -ef |grep lvcreate |awk '{print $2}' |xargs kill -9 -if [ -L "/dev/ceph-volumes/ceph0" ]; then +if [ -L "/dev/cinder-volumes/ceph0" ]; then echo "remove lv vg" -lvremove -f /dev/ceph-volumes/ceph0 -vgremove -f ceph-volumes -rm -r /dev/ceph-volumes +lvremove -f /dev/cinder-volumes/ceph0 fi -echo "vgcreate" -vgcreate -y ceph-volumes $(losetup --show -f /ceph/images/ceph-volumes.img) echo "lvcreate" -lvcreate -l 100%FREE -nceph0 ceph-volumes +lvcreate -l 100%FREE -nceph0 cinder-volumes echo "mkfs" -mkfs.xfs -f /dev/ceph-volumes/ceph0 +mkfs.xfs -f /dev/cinder-volumes/ceph0 if [ ! -d "/var/local/osd" ]; then echo "mount osd" mkdir -p /var/local/osd -mount /dev/ceph-volumes/ceph0 /var/local/osd +mount /dev/cinder-volumes/ceph0 /var/local/osd fi diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml index 3959d466..744120b8 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml @@ -4,6 +4,9 @@ tags: - create_ceph_cluster +- name: default config for ceph + shell: cd {{ ceph_cluster_dir[0] }} && echo "osd_journal_size = 1024" >> ceph.conf && echo "osd_pool_default_size = 2" >> ceph.conf + - name: install ceph for every nodes includes jumpserver shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy install {{ ceph_cluster_hosts.stdout_lines[0]}} @@ -11,7 +14,7 @@ shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --overwrite-conf mon create-initial - name: gather keys - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy gatherkeys {{ ceph_cluster_hosts.stdout_lines[0] }} + shell: sleep 5 && cd {{ ceph_cluster_dir[0] }} && ceph-deploy gatherkeys {{ inventory_hostname }} ignore_errors: True - name: copy create_osd.sh to host1 diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml index 97d925d6..385c7571 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml @@ -4,6 +4,9 @@ tags: - create_ceph_cluster +- name: default config for ceph + shell: cd {{ ceph_cluster_dir[0] }} && echo "osd_journal_size = 1024" >> ceph.conf && echo "osd_pool_default_size = 2" >> ceph.conf + - name: install ceph for every nodes includes jumpserver shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy install --no-adjust-repos --repo-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa --gpg-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa/ceph_key_release.asc {{ ceph_cluster_hosts.stdout_lines[0]}} @@ -11,7 +14,7 @@ shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --overwrite-conf mon create-initial - name: gather keys - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy gatherkeys {{ ceph_cluster_hosts.stdout_lines[0] }} + shell: sleep 5 && cd {{ ceph_cluster_dir[0] }} && ceph-deploy gatherkeys {{ inventory_hostname }} ignore_errors: True - name: copy create_osd.sh to host1 @@ -34,7 +37,7 @@ - create_osd - name: prepare create osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --repo-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa --gpg-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa/ceph_key_release.asc osd prepare {{ item }}:/var/local/osd + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd prepare {{ item }}:/var/local/osd with_items: - "{{ groups['compute'] }}" tags: @@ -42,7 +45,7 @@ - name: activate osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --repo-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa --gpg-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa/ceph_key_release.asc osd activate {{ item }}:/var/local/osd + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd activate {{ item }}:/var/local/osd with_items: - "{{ groups['compute'] }}" tags: diff --git a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml index 85556a5a..b06aac50 100644 --- a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml +++ b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml @@ -4,6 +4,6 @@ - name: sync cinder db #cinder_manage: action=dbsync - shell: cinder-manage db sync + shell: su -s /bin/sh -c 'cinder-manage db sync' cinder notify: - restart cinder control serveice diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml index 0b72d6e2..3114e638 100644 --- a/deploy/adapters/ansible/roles/common/tasks/main.yml +++ b/deploy/adapters/ansible/roles/common/tasks/main.yml @@ -1,20 +1,17 @@ --- - include_vars: "{{ ansible_os_family }}.yml" -- name: first update pkgs - shell: "{{ ansible_pkg_mgr }} update" +- name: speed up ansible by purging landscape-common + apt: pkg=landscape-common state=absent purge=yes + when: ansible_os_family == "Debian" -- name: install packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest" - with_items: packages | union(packages_noarch) -- name: update hosts files to all hosts - template: src=hosts - dest=/etc/hosts - backup=yes +- name: install pip packages + pip: name={{ item }} state=present extra_args='--pre' + with_items: pip_packages -- name: make config template dir exist - file: path=/opt/os_templates state=directory mode=0755 +- name: update hosts files to all hosts + template: src=hosts dest=/etc/hosts backup=yes - name: get compass-core hostname local_action: shell hostname @@ -22,22 +19,28 @@ - name: get compass-core addr shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf - register: ip + register: COMPASS_SERVER - name: update compass-core name and ip to hosts files shell: | echo "# compass" >> /etc/hosts - echo {{ ip.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts + echo {{ COMPASS_SERVER.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts + +- name: first update pkgs + shell: "{{ ansible_pkg_mgr }} update" + +- name: install packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest" + with_items: packages | union(packages_noarch) + +- name: make config template dir exist + file: path=/opt/os_templates state=directory mode=0755 - name: create pip config directory file: path=~/.pip state=directory -- name: get pip source server addr - shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf - register: COMPASS_SERVER - - name: update pip.conf - template: src=pip.conf dest=~/.pip/pip.conf + template: src=pip.conf dest=~/.pip/{{ pip_conf }} - name: update ntp conf template: src=ntp.conf dest=/etc/ntp.conf backup=yes diff --git a/deploy/adapters/ansible/roles/common/vars/Debian.yml b/deploy/adapters/ansible/roles/common/vars/Debian.yml index c471d148..bc273a10 100644 --- a/deploy/adapters/ansible/roles/common/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/common/vars/Debian.yml @@ -6,6 +6,10 @@ packages: - openvswitch-switch - crudini +pip_packages: [] + +pip_conf: pip.conf + services: [] ntp_service: ntp diff --git a/deploy/adapters/ansible/roles/common/vars/RedHat.yml b/deploy/adapters/ansible/roles/common/vars/RedHat.yml index 57172b7f..10aa7715 100644 --- a/deploy/adapters/ansible/roles/common/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/common/vars/RedHat.yml @@ -1,8 +1,12 @@ --- packages: - - python-devel - openvswitch +pip_packages: + - crudini + +pip_conf: .pip.conf + services: - openvswitch diff --git a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml index dd5c6fd0..01c7ebb3 100644 --- a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml +++ b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml @@ -23,6 +23,11 @@ dest=/etc/openstack-dashboard/local_settings.py backup=yes +- name: update memcached conf + lineinfile: dest=/etc/memcached.conf state=present + regexp="-l *" + line="-l {{ internal_vip.ip }}" + - name: restart dashboard services service: name={{ item }} state=restarted enabled=yes with_items: services | union(services_noarch) diff --git a/deploy/adapters/ansible/roles/dashboard/vars/main.yml b/deploy/adapters/ansible/roles/dashboard/vars/main.yml index b6a965c2..39843a3e 100644 --- a/deploy/adapters/ansible/roles/dashboard/vars/main.yml +++ b/deploy/adapters/ansible/roles/dashboard/vars/main.yml @@ -3,4 +3,5 @@ packages_noarch: - memcached - openstack-dashboard -services_noarch: [] +services_noarch: + - memcached diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml index 5ca23a19..c46a2932 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml @@ -3,6 +3,10 @@ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: mongodb_packages | union(packages_noarch) +- name: install pymongod packages + pip: name={{ item }} state=present extra_args='--pre' + with_items: pip_packages + - name: copy ceilometer configs template: src=mongodb.conf dest=/opt/os_templates backup=yes @@ -17,7 +21,7 @@ - /var/lib/mongodb/journal/* - name: manually restart mongodb server - service: name=mongodb state=restarted + service: name={{ mongodb_serveice }} state=restarted - wait_for: port=27017 delay=3 timeout=60 host={{ internal_vip.ip }} diff --git a/deploy/adapters/ansible/roles/database/vars/Debian.yml b/deploy/adapters/ansible/roles/database/vars/Debian.yml index 6f085ffd..7035c2bf 100644 --- a/deploy/adapters/ansible/roles/database/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/database/vars/Debian.yml @@ -15,8 +15,12 @@ maridb_packages: - mysql-wsrep-server-5.5 - galera-3 +pip_packages: [] + services: [] +mongodb_serveice: mongodb + mysql_config_file_path: "/etc/mysql" mysql_config_file_name: ["my.cnf"] wsrep_config_file_path: "/etc/mysql/conf.d" diff --git a/deploy/adapters/ansible/roles/database/vars/RedHat.yml b/deploy/adapters/ansible/roles/database/vars/RedHat.yml index a4171559..ac2f2f22 100644 --- a/deploy/adapters/ansible/roles/database/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/database/vars/RedHat.yml @@ -4,13 +4,23 @@ mysql_packages: - mysql-server maridb_packages: + - MySQL-python - MariaDB-Galera-server - MariaDB-client - galera - MySQL-python +mongodb_packages: + - mongo-10gen-server + - mongo-10gen + +pip_packages: + - pymongo + services: [] +mongodb_serveice: mongod + mysql_config_file_path: "/etc/my.cnf.d" mysql_config_file_name: ["my-huge.cnf", "server.cnf"] wsrep_config_file_path: "/etc/my.cnf.d" diff --git a/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml b/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml index 4cd71ffc..2e024675 100644 --- a/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml +++ b/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml @@ -1,7 +1,7 @@ --- - name: sync glance db #glance_manage: action=dbsync - shell: glance-manage db sync + shell: su -s /bin/sh 'glance-manage db sync' glance ignore_errors: True notify: - restart glance services diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml index 6c39da8d..2ef7803d 100644 --- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml +++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml @@ -1,7 +1,7 @@ --- - name: keystone-manage db-sync #keystone_manage: action=dbsync - shell: keystone-manage db_sync + shell: su -s /bin/sh -c 'keystone-manage db_sync' keystone - name: wait for keystone ready wait_for: port=35357 delay=3 timeout=10 host={{ internal_vip.ip }} diff --git a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml index 8667a9b1..818ac57a 100644 --- a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml @@ -24,7 +24,7 @@ - setup_networks/setup_networks.py - name: copy boot scripts - copy: src={{ item }} dest=/etc/init.d mode=0755 + copy: src={{ item }} dest=/etc/init.d/ mode=0755 with_items: - setup_networks/net_init |