summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/openstack_osp9/roles/common
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/openstack_osp9/roles/common')
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/tasks/RedHat.yml3
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/tasks/main.yml96
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/templates/hosts7
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/templates/ntp.conf54
-rw-r--r--deploy/adapters/ansible/openstack_osp9/roles/common/templates/openstack_ppa_repo.repo.j27
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/templates/pip.conf5
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/vars/Debian.yml30
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/vars/RedHat.yml26
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/common/vars/main.yml14
9 files changed, 242 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/tasks/RedHat.yml b/deploy/adapters/ansible/openstack_osp9/roles/common/tasks/RedHat.yml
new file mode 100755
index 00000000..b9f01255
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/tasks/RedHat.yml
@@ -0,0 +1,3 @@
+---
+- name: add yum repository for openstack
+ template: src=openstack_ppa_repo.repo.j2 dest=/etc/yum.repos.d/openstack_ppa_repo.repo
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/tasks/main.yml b/deploy/adapters/ansible/openstack_osp9/roles/common/tasks/main.yml
new file mode 100755
index 00000000..0f4cf334
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/tasks/main.yml
@@ -0,0 +1,96 @@
+##############################################################################
+# 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
+##############################################################################
+---
+- include_vars: "{{ ansible_os_family }}.yml"
+
+- name: speed up ansible by purging landscape-common
+ apt: pkg=landscape-common state=absent purge=yes
+ when: ansible_os_family == "Debian"
+
+- name: update hosts files to all hosts
+ template: src=hosts dest=/etc/hosts backup=yes
+
+- name: get compass-core hostname
+ local_action: shell hostname
+ register: name
+
+- name: get compass-core addr
+ shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
+ register: COMPASS_SERVER
+
+- name: run redhat specific play if os is redhat
+ include: RedHat.yml
+ when: ansible_distribution == "RedHat"
+
+- name: update compass-core name and ip to hosts files
+ shell: |
+ echo "# compass" >> /etc/hosts
+ echo {{ COMPASS_SERVER.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts
+
+- name: install python-crypto
+ yum: name=python-crypto state=present
+ register: python_crypto_result
+ ignore_errors: yes
+ when: ansible_os_family == "RedHat"
+
+- name: remove python crypt egg file to work-around https://bugs.centos.org/view.php?id=9896&nbn=2
+ shell: rm -rf /usr/lib64/python2.7/site-packages/pycrypto-2.6.1-py2.7.egg-info
+ when: ansible_os_family == "RedHat" and python_crypto_result.msg == "Error unpacking rpm package python2-crypto-2.6.1-9.el7.x86_64\n"
+
+- name: install packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes"
+ 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: update pip.conf
+ template: src=pip.conf dest=~/.pip/{{ pip_conf }}
+
+- name: install pip packages
+ pip: name={{ item }} state=present extra_args='--pre'
+ with_items: pip_packages
+
+- name: install keyczar for accelerate
+ pip: name=python-keyczar state=present extra_args='--pre'
+ delegate_to: 127.0.0.1
+ run_once: true
+
+- name: update ntp conf
+ template: src=ntp.conf dest=/etc/ntp.conf backup=yes
+
+- name: use ntpdate once for initial sync time
+ shell: ntpdate {{ ntp_server }}
+ ignore_errors: True
+
+- name: sync sys clock to hard clock
+ shell: hwclock --systohc
+ ignore_errors: True
+
+- name: create fireball keys dir
+ file: path=~/.fireball.keys state=directory mode=0700
+ delegate_to: 127.0.0.1
+ run_once: true
+
+- 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)
+
+- name: kill daemon for accelerate
+ shell: lsof -ni :5099|grep LISTEN|awk '{print $2}'|xargs kill -9
+ ignore_errors: true
+
+- meta: flush_handlers
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/templates/hosts b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/hosts
new file mode 100755
index 00000000..6f76de51
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/hosts
@@ -0,0 +1,7 @@
+
+# localhost
+127.0.0.1 localhost
+# controller
+172.16.1.1 host1
+# compute
+172.16.1.1 host1
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/templates/ntp.conf b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/ntp.conf
new file mode 100755
index 00000000..2d560be2
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/ntp.conf
@@ -0,0 +1,54 @@
+# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
+
+driftfile /var/lib/ntp/ntp.drift
+
+
+# Enable this if you want statistics to be logged.
+#statsdir /var/log/ntpstats/
+
+statistics loopstats peerstats clockstats
+filegen loopstats file loopstats type day enable
+filegen peerstats file peerstats type day enable
+filegen clockstats file clockstats type day enable
+
+# Specify one or more NTP servers.
+
+# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
+# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
+# more information.
+server {{ ntp_server }}
+server {{ internal_vip.ip }}
+
+# Use local server as a fallback.
+server 127.127.1.0 # local clock
+fudge 127.127.1.0 stratum 10
+
+# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
+# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
+# might also be helpful.
+#
+# Note that "restrict" applies to both servers and clients, so a configuration
+# that might be intended to block requests from certain clients could also end
+# up blocking replies from your own upstream servers.
+
+# By default, exchange time with everybody, but don't allow configuration.
+restrict -4 default kod notrap nomodify
+restrict -6 default kod notrap nomodify
+
+# Local users may interrogate the ntp server more closely.
+restrict 127.0.0.1
+restrict ::1
+
+# Clients from this (example!) subnet have unlimited access, but only if
+# cryptographically authenticated.
+#restrict 192.168.123.0 mask 255.255.255.0 notrust
+
+
+# If you want to provide time to your local subnet, change the next line.
+# (Again, the address is an example only.)
+#broadcast 192.168.123.255
+
+# If you want to listen to time broadcasts on your local subnet, de-comment the
+# next lines. Please do this only if you trust everybody on the network!
+#disable auth
+#broadcastclient
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/templates/openstack_ppa_repo.repo.j2 b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/openstack_ppa_repo.repo.j2
new file mode 100644
index 00000000..148f3e14
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/openstack_ppa_repo.repo.j2
@@ -0,0 +1,7 @@
+[openstack_ppa_repo]
+name=rhel - openstack_repo
+proxy=_none_
+baseurl=http://{{ COMPASS_SERVER.stdout_lines[0] }}/cblr/repo_mirror/redhat7-osp9-ppa
+enabled=1
+gpgcheck=0
+skip_if_unavailable=1
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/templates/pip.conf b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/pip.conf
new file mode 100755
index 00000000..7bb3e43e
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/templates/pip.conf
@@ -0,0 +1,5 @@
+[global]
+find-links = http://{{ COMPASS_SERVER.stdout_lines[0] }}/pip
+no-index = true
+[install]
+trusted-host={{ COMPASS_SERVER.stdout_lines[0] }}
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/vars/Debian.yml b/deploy/adapters/ansible/openstack_osp9/roles/common/vars/Debian.yml
new file mode 100755
index 00000000..1d7972eb
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/vars/Debian.yml
@@ -0,0 +1,30 @@
+##############################################################################
+# 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
+##############################################################################
+---
+packages:
+ - ubuntu-cloud-keyring
+ - python-dev
+ - openvswitch-datapath-dkms
+ - openvswitch-switch
+ - python-memcache
+ - python-iniparse
+ - python-lxml
+ #- python-d* #TODO, need remove
+
+pip_packages:
+ - crudini
+ - python-keyczar
+ - yang2tosca
+
+pip_conf: pip.conf
+
+services:
+ - ntp
+
+
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/vars/RedHat.yml b/deploy/adapters/ansible/openstack_osp9/roles/common/vars/RedHat.yml
new file mode 100755
index 00000000..8143e1cb
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/vars/RedHat.yml
@@ -0,0 +1,26 @@
+##############################################################################
+# 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
+##############################################################################
+---
+packages:
+ - openvswitch
+ - python-devel
+ - python-memcached
+ - gcc
+ - redhat-lsb-core
+ - python-crypto
+
+pip_packages:
+ - crudini
+ - python-keyczar
+
+pip_conf: pip.conf
+
+services:
+ - openvswitch
+ - ntpd
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/common/vars/main.yml b/deploy/adapters/ansible/openstack_osp9/roles/common/vars/main.yml
new file mode 100755
index 00000000..713b6b5f
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_osp9/roles/common/vars/main.yml
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+---
+packages_noarch:
+ - python-pip
+ - ntp
+
+services_noarch: []