--ansible-dir $WORK_PATH/deploy/adapters/ansible \
--default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server \
dracut-config-rescue-033-241.el7_1.5 dracut-network-033-241.el7_1.5"
+
+ make_repo --os-ver rhel7 --package-tag liberty \
+ --ansible-dir $WORK_PATH/deploy/adapters/ansible \
+ --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server \
+ dracut-config-rescue-033-241.el7_1.5 dracut-network-033-241.el7_1.5"
}
function main()
# modify centos7 repo for workaround
sed -i 's/epel-Derived from Red Hat Enterprise Linux 7.1 (Source)/epel-7/g' /etc/yum.repos.d/rdo-release.repo
+# add mongodb repo
+cat <<EOF >/etc/yum.repos.d/mongodb.repo
+[mongodb]
+name=MongoDB Repository
+baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
+gpgcheck=0
+enabled=1
+EOF
+
# add galeracluster repo
cat <<EOF >/etc/yum.repos.d/MariaDB.repo
[mariadb]
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-services: []
-packages: []
+ceilometer_packages:
+ - openstack-ceilometer-compute
+ - python-ceilometerclient
+ - python-pecan
+
+ceilometer_services:
+ - openstack-ceilometer-compute
+ - openstack-nova-compute
+
+ceilometer_configs_templates:
+ - src: ceilometer.j2
+ dest:
+ - /etc/ceilometer/ceilometer.conf
+ - src: nova.j2
+ dest:
+ - /etc/nova/nova.conf
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-services: []
-packages: []
+ceilometer_packages:
+ - openstack-ceilometer-api
+ - openstack-ceilometer-collector
+ - openstack-ceilometer-central
+ - openstack-ceilometer-notification
+ - openstack-ceilometer-alarm
+ - python-ceilometerclient
+
+ceilometer_services:
+ - openstack-ceilometer-central
+ - openstack-ceilometer-notification
+ - openstack-ceilometer-api
+ - openstack-ceilometer-collector
+ - openstack-ceilometer-alarm-evaluator
+ - openstack-ceilometer-alarm-notifier
+
+ceilometer_configs_templates:
+ - src: ceilometer.j2
+ dest:
+ - /etc/ceilometer/ceilometer.conf
+ - src: cinder.j2
+ dest:
+ - /etc/cinder/cinder.conf
+ - src: glance.j2
+ dest:
+ - /etc/glance/glance-api.conf
+ - /etc/glance/glance-registry.conf
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+- include_vars: "{{ ansible_os_family }}.yml"
+
- name: Create a default data directory
file: path="/var/lib/ceph/mon/ceph-{{ inventory_hostname }}" state="directory"
- name: Populate the monitor daemon
shell: "ceph-mon --mkfs -i {{ inventory_hostname }} --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring"
-- name: Touch the done file
- file: path="/var/lib/ceph/mon/ceph-{{ inventory_hostname }}/done" state="touch"
+- name: Touch the done and auto start file
+ file: path="/var/lib/ceph/mon/ceph-{{ inventory_hostname }}/{{ item }}" state="touch"
+ with_items:
+ - "done"
+ - "{{ ceph_start_type }}"
- name: start mon daemon
- shell: start ceph-mon id={{ inventory_hostname }}
-
-- name: auto start ceph-mon
- file: path="/var/lib/ceph/mon/ceph-{{ inventory_hostname }}/upstart" state="touch"
+ shell: "{{ ceph_start_script }}"
- name: wait for creating osd keyring
wait_for: path=/var/lib/ceph/bootstrap-osd/ceph.keyring
--- /dev/null
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+---
+
+ceph_start_script: "start ceph-mon id={{ inventory_hostname }}"
+ceph_start_type: "upstart"
--- /dev/null
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+---
+
+ceph_start_script: "/etc/init.d/ceph start mon.{{ inventory_hostname }}"
+ceph_start_type: "sysvinit"
--- /dev/null
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+---
+
- name: rebuild osd after reboot
lineinfile: dest=/etc/init/ceph-osd-all-starter.conf insertafter="^task" line="pre-start script\n set -e\n /opt/setup_storage/losetup.sh\n sleep 3\n mount /dev/storage-volumes/ceph0 /var/local/osd\nend script"
+ when: ansible_os_family == "Debian"
+
+- name: rebuild osd after reboot for centos
+ lineinfile: dest=/usr/init.d/ceph insertafter="^### END INIT INFO" line="\nsleep 1\nmount /dev/storage-volumes/ceph0 /var/local/osd"
+ when: ansible_os_family == "RedHat"
+
---
packages:
- openvswitch
+ - python-devel
- python-memcached
+ - gcc
pip_packages:
- crudini
+ - python-keyczar
pip_conf: pip.conf
+++ /dev/null
-#
-# The MySQL database server configuration file.
-#
-# You can copy this to one of:
-# - "/etc/mysql/my.cnf" to set global options,
-# - "~/.my.cnf" to set user-specific options.
-#
-# One can use all long options that the program supports.
-# Run program with --help to get a list of available options and with
-# --print-defaults to see which it would actually understand and use.
-#
-# For explanations see
-# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
-
-# This will be passed to all mysql clients
-# It has been reported that passwords should be enclosed with ticks/quotes
-# escpecially if they contain "#" chars...
-# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
-[client]
-port = 3306
-socket = /var/run/mysqld/mysqld.sock
-
-# Here is entries for some specific programs
-# The following values assume you have at least 32M ram
-
-# This was formally known as [safe_mysqld]. Both versions are currently parsed.
-[mysqld_safe]
-socket = /var/run/mysqld/mysqld.sock
-nice = 0
-
-[mysqld]
-#
-# * Basic Settings
-#
-user = mysql
-pid-file = /var/run/mysqld/mysqld.pid
-socket = /var/run/mysqld/mysqld.sock
-port = 3306
-basedir = /usr
-datadir = /var/lib/mysql
-tmpdir = /tmp
-lc-messages-dir = /usr/share/mysql
-skip-external-locking
-#
-# Instead of skip-networking the default is now to listen only on
-# localhost which is more compatible and is not less secure.
-bind-address = 0.0.0.0
-#
-# * Fine Tuning
-#
-key_buffer = 16M
-max_allowed_packet = 16M
-thread_stack = 192K
-thread_cache_size = 8
-# This replaces the startup script and checks MyISAM tables if needed
-# the first time they are touched
-myisam-recover = BACKUP
-#max_connections = 100
-#table_cache = 64
-#thread_concurrency = 10
-#
-# * Query Cache Configuration
-#
-query_cache_limit = 1M
-query_cache_size = 16M
-#
-# * Logging and Replication
-#
-# Both location gets rotated by the cronjob.
-# Be aware that this log type is a performance killer.
-# As of 5.1 you can enable the log at runtime!
-#general_log_file = /var/log/mysql/mysql.log
-#general_log = 1
-#
-# Error log - should be very few entries.
-#
-log_error = /var/log/mysql/error.log
-#
-# Here you can see queries with especially long duration
-#log_slow_queries = /var/log/mysql/mysql-slow.log
-#long_query_time = 2
-#log-queries-not-using-indexes
-#
-# The following can be used as easy to replay backup logs or for replication.
-# note: if you are setting up a replication slave, see README.Debian about
-# other settings you may need to change.
-#server-id = 1
-#log_bin = /var/log/mysql/mysql-bin.log
-expire_logs_days = 10
-max_binlog_size = 100M
-#binlog_do_db = include_database_name
-#binlog_ignore_db = include_database_name
-#
-# * InnoDB
-#
-# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
-# Read the manual for more InnoDB related options. There are many!
-#
-# * Security Features
-#
-# Read the manual, too, if you want chroot!
-# chroot = /var/lib/mysql/
-#
-# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
-#
-# ssl-ca=/etc/mysql/cacert.pem
-# ssl-cert=/etc/mysql/server-cert.pem
-# ssl-key=/etc/mysql/server-key.pem
-default-storage-engine = innodb
-innodb_file_per_table
-collation-server = utf8_general_ci
-init-connect = 'SET NAMES utf8'
-character-set-server = utf8
-
-[mysqldump]
-quick
-quote-names
-max_allowed_packet = 16M
-
-[mysql]
-#no-auto-rehash # faster start of mysql but no tab completition
-
-[isamchk]
-key_buffer = 16M
-
-#
-# * IMPORTANT: Additional settings that can override those from this file!
-# The files must end with '.cnf', otherwise they'll be ignored.
-#
-!includedir /etc/mysql/conf.d/
-
##############################################################################
---
- include_vars: "{{ ansible_os_family }}.yml"
+ tags:
+ - test_mongo
- include: mariadb_install.yml
- include: mariadb_cluster.yml
- inventory_hostname == haproxy_hosts.keys()[0]
- include: mongodb_install.yml
+ tags:
+ - test_mongo
+
- include: mongodb_config.yml
when:
- inventory_hostname == haproxy_hosts.keys()[0]
+ tags:
+ - test_mongo
- meta: flush_handlers
---
- include: mariadb_cluster_debian.yml
when: ansible_os_family == "Debian"
+
+- include: mariadb_cluster_redhat.yml
+ when: ansible_os_family == "RedHat"
--- /dev/null
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+---
+- name: start first node to create new cluster
+ shell: service mysql start --wsrep-new-cluster
+ when:
+ - inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: wait for cluster ready
+ command: mysql -e"show status like 'wsrep%'"
+ register: cluster_status
+ until: cluster_status|success
+ failed_when: not cluster_status.stdout | search("ON")
+ retries: 10
+ delay: 3
+ when:
+ - inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: restart other nodes and join cluster
+ service:
+ name: mysql
+ state: restarted
+ enabled: yes
+ when:
+ - inventory_hostname != haproxy_hosts.keys()[0]
+
+- name: restart first nodes
+ service:
+ name: mysql
+ state: restarted
+ when: inventory_hostname == haproxy_hosts.keys()[0] and haproxy_hosts|length > 1
##############################################################################
---
- name: create all needed db
- mysql_db: name={{ item.db }} state=present
+ mysql_db: login_unix_socket=/var/run/mysqld/mysqld.sock name={{ item.db }} state=present
with_items: "{{ credentials }}"
+ tags:
+ - test_db
- name: create service db user
mysql_user:
+ login_unix_socket=/var/run/mysqld/mysqld.sock
name={{ item[0].user }}
password={{ item[0].password }}
priv=*.*:ALL,GRANT
state=present
with_nested:
- "{{ credentials }}"
- - ['%', 'localhost', inventory_hostname]
+ - ['%', 'localhost', '{{ inventory_hostname }}']
+ tags:
+ - test_user
- name: create wsrep db user
mysql_user:
+ login_unix_socket=/var/run/mysqld/mysqld.sock
name={{ WSREP_SST_USER }}
password={{ WSREP_SST_PASS }}
priv=*.*:ALL,GRANT
host={{ item }}
state=present
- with_items: ['%', 'localhost', inventory_hostname]
+ with_items: ['%', 'localhost', '{{ inventory_hostname }}']
dest: "/etc/security/limits.conf"
mode: 0755
+- name: create conf dir for wsrep
+ file: path=/etc/my.cnf.d state=directory mode=0755
+ when: ansible_os_family == "RedHat"
+
- name: update mariadb config file
template:
src: '{{ item.src }}'
template: src=mongodb.conf dest=/opt/os_templates backup=yes
- name: update mongodb config file
- shell: crudini --merge /etc/mongodb.conf < /opt/os_templates/mongodb.conf
+ shell: crudini --merge {{ mongodb_config.dest }} < /opt/os_templates/mongodb.conf
- name: rm prealloc files
file:
dest: "{{ item }}"
state: absent
with_fileglob:
- - /var/lib/mongodb/journal/*
+ - "{{ mongodb_config.journal }}"
- name: manually restart mongodb server
service: name={{ mongodb_service }} state=restarted enabled=yes
+ ignore_errors: true
- name: write mongodb to monitor list
lineinfile: dest=/opt/service create=yes line={{ mongodb_service}}
max_allowed_packet = 16M
-!includedir /etc/mysql/conf.d/
+!includedir /etc/my.cnf.d/
--- /dev/null
+[client]
+port = 3306
+socket = /var/run/mysqld/mysqld.sock
+
+
+[mysqld_safe]
+socket = /var/run/mysqld/mysqld.sock
+nice = 0
+
+
+[mysql]
+default-character-set = utf8
+
+[mysqld]
+user = mysql
+collation-server = utf8_unicode_ci
+init-connect = 'SET NAMES utf8'
+character-set-server = utf8
+datadir = /var/lib/mysql
+bind-address = {{ internal_ip }}
+
+max-allowed-packet = 16M
+max-connect-errors = 1000000
+
+max_connections = {{ ansible_processor_vcpus * 100 }}
+
+wait_timeout = 28800
+tmp-table-size = 32M
+max-heap-table-size = 32M
+query-cache-type = 0
+query-cache-size = 0M
+thread-cache-size = 50
+open-files-limit = 65535
+table-definition-cache = 4096
+table-open-cache = 10240
+
+innodb-flush-method = O_DIRECT
+innodb-additional-mem-pool-size = 24M
+innodb-log-file-size = 1024M
+innodb-file-per-table = 1
+innodb-buffer-pool-size = 4096M
+
+innodb-read-io-threads = 4
+innodb-write-io-threads = 4
+innodb-doublewrite = 1
+innodb-log-buffer-size = 1024M
+innodb-buffer-pool-instances = 8
+innodb-log-files-in-group = 2
+innodb-thread-concurrency = {{ ansible_processor_vcpus * 2 }}
+
+innodb_stats_on_metadata = 0
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet = 16M
+
+
+!includedir /etc/mysql/conf.d/
--- /dev/null
+[client]
+port = 3306
+socket = /var/run/mysqld/mysqld.sock
+
+
+[mysqld_safe]
+socket = /var/run/mysqld/mysqld.sock
+nice = 0
+
+
+[mysql]
+default-character-set = utf8
+
+[mysqld]
+user = mysql
+collation-server = utf8_unicode_ci
+init-connect = 'SET NAMES utf8'
+character-set-server = utf8
+datadir = /var/lib/mysql
+bind-address = {{ internal_ip }}
+
+max-allowed-packet = 16M
+max-connect-errors = 1000000
+
+max_connections = {{ ansible_processor_vcpus * 100 }}
+
+wait_timeout = 28800
+tmp-table-size = 32M
+max-heap-table-size = 32M
+query-cache-type = 0
+query-cache-size = 0M
+thread-cache-size = 50
+open-files-limit = 65535
+table-definition-cache = 4096
+table-open-cache = 10240
+
+innodb-flush-method = O_DIRECT
+innodb-additional-mem-pool-size = 24M
+innodb-log-file-size = 1024M
+innodb-file-per-table = 1
+innodb-buffer-pool-size = 4096M
+
+innodb-read-io-threads = 4
+innodb-write-io-threads = 4
+innodb-doublewrite = 1
+innodb-log-buffer-size = 1024M
+innodb-buffer-pool-instances = 8
+innodb-log-files-in-group = 2
+innodb-thread-concurrency = {{ ansible_processor_vcpus * 2 }}
+
+innodb_stats_on_metadata = 0
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet = 16M
+
+
+!includedir /etc/my.cnf.d/
mongodb_service: mongodb
mysql_config:
- dest: /etc/mysql/my.cnf
- src: my.cnf
+ src: my_debian.cnf
- dest: /etc/mysql/conf.d/wsrep.cnf
src: wsrep.cnf
+mongodb_config:
+ dest: /etc/mongodb.conf
+ src: mongodb.conf
+ journal: /var/lib/mongodb/journal/*
+
wsrep_provider_file: "/usr/lib/galera/libgalera_smm.so"
services: []
-mongodb_service: mongodb
+mongodb_service: mongod
mysql_config:
- - dest: /etc/mysql/my.cnf
- src: my.cnf
- - dest: /etc/mysql/conf.d/wsrep.cnf
+ - dest: /etc/my.cnf
+ src: my_redhat.cnf
+ - dest: /etc/my.cnf.d/wsrep.cnf
src: wsrep.cnf
+mongodb_config:
+ dest: /etc/mongod.conf
+ src: mongodb.conf
+ journal: /var/lib/mongo/journal/*
+
wsrep_provider_file: "/usr/lib64/galera/libgalera_smm.so"
---
packages:
- openstack-glance
+ - rpcbind
nfs_services:
- rpcbind
- - rpc-statd
services:
- openstack-glance-api
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-services: []
-
-packages: []
+services:
+ - openstack-heat-api
+ - openstack-heat-api-cfn
+ - openstack-heat-engine
+packages:
+ - openstack-heat-api
+ - openstack-heat-api-cfn
+ - openstack-heat-engine
+ - python-heatclient
[DEFAULT]
admin_token={{ ADMIN_TOKEN }}
debug={{ DEBUG }}
-verbose={{ VERBOSE }}
log_dir = /var/log/keystone
[cache]
- name: change memcache listen ip
lineinfile: dest=/etc/memcached.conf regexp="^-l " line="-l 0.0.0.0"
+ when: ansible_os_family == "Debian"
- name: restart services
service: name={{ item }} state=restarted enabled=yes
--- /dev/null
+[Unit]
+Description=Storage Service
+Before=runlevel2.target runlevel3.target runlevel4.target runlevel5.target shutdown.target
+After=remote-fs.target nss-lookup.target network-online.target time-sync.target network-online.target net_init.service
+Before=ceph.service
+Wants=network-online.target
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "/etc/init.d/storage"
+
+[Install]
+WantedBy=multi-user.target
+
tags:
- storage
+- name: set autostart file for centos
+ copy: src=storage.service dest=/usr/lib/systemd/system/storage.service mode=0755
+ when: ansible_os_family == "RedHat"
+ tags:
+ - storage
+
+
- name: enable service
service: name=storage enabled=yes
tags: