diff options
102 files changed, 2615 insertions, 236 deletions
diff --git a/build/build-aarch64.yaml b/build/build-aarch64.yaml index e197f33b..84352284 100644 --- a/build/build-aarch64.yaml +++ b/build/build-aarch64.yaml @@ -15,8 +15,7 @@ packages: get_method: docker url: linaro/compass-deck:latest - # XXX: only supports k8s now - - name: compass-tasks + - name: compass-tasks-k8s description: "compass task container for kubernets deployment via kargo" get_method: docker url: linaro/compass-tasks-k8s:latest diff --git a/build/build.yaml b/build/build.yaml index 4719c2c7..4f70f397 100644 --- a/build/build.yaml +++ b/build/build.yaml @@ -15,10 +15,15 @@ packages: get_method: docker url: opnfv/compass-deck:latest - - name: compass-tasks - description: "compass task container integrated with openstack-ansible and kubespray" + - name: compass-tasks-osa + description: "compass task container integrated with openstack-ansible" get_method: docker - url: opnfv/compass-tasks:latest + url: huangxiangyu/compass-tasks-osa:latest + + - name: compass-tasks-k8s + description: "compass task container integrated with kubespray" + get_method: docker + url: compass4nfv/compass-tasks-k8s:latest - name: compass-cobbler description: "cobbler container for compass" diff --git a/ci/deploy_ci.sh b/ci/deploy_ci.sh index bd5adcc7..dd8786af 100755 --- a/ci/deploy_ci.sh +++ b/ci/deploy_ci.sh @@ -18,12 +18,13 @@ case $DEPLOY_SCENARIO in echo "os-onos-sfc-ha scenario supports mitaka only" exit 1 ;; - k8-nosdn-nofeature-ha) - export COMPASS_OS_VERSION=centos7 - export KUBERNETES_VERSION="v1.7.3" - ;; esac +if [[ "$DEPLOY_SCENARIO" =~ "k8-" ]]; then + export KUBERNETES_VERSION="v1.7.3" +fi + + if [[ "$NODE_NAME" =~ "intel-pod17" ]]; then export USER_NAMESERVER=8.8.8.8 fi diff --git a/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml b/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml index bfdc8958..68dec5c2 100755 --- a/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml +++ b/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml @@ -42,3 +42,16 @@ max_fail_percentage: 0 roles: - post-k8s + +- hosts: kube_node + remote_user: root + max_fail_percentage: 0 + roles: + - role: storage + when: stor4nfv is defined and stor4nfv == "Enable" + +- hosts: storage_master + remote_user: root + max_fail_percentage: 0 + roles: + - stor4nfv diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel-apps/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/2flannel-apps/tasks/main.yml new file mode 100644 index 00000000..a7ff10e2 --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel-apps/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: "2Flannel | Create ServiceAccount ClusterRole and ClusterRoleBinding" + command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/cni-2flannel-rbac.yml" + run_once: true + when: rbac_enabled and two_flannel_rbac_manifest.changed + +- name: 2Flannel | Start Resources + kube: + name: "kube-2flannel" + kubectl: "{{ bin_dir }}/kubectl" + filename: "{{ kube_config_dir }}/cni-2flannel.yml" + resource: "ds" + namespace: "{{system_namespace}}" + state: "{{ item | ternary('latest','present') }}" + with_items: "{{ two_flannel_manifest.changed }}" + when: inventory_hostname == groups['kube-master'][0] + +- name: 2Flannel | Wait for flannel subnet.env file presence + wait_for: + path: /run/2flannel/networks/subnet1.env + delay: 5 + timeout: 600 diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/defaults/main.yml b/deploy/adapters/ansible/kubernetes/roles/2flannel/defaults/main.yml new file mode 100644 index 00000000..f9e61eda --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/defaults/main.yml @@ -0,0 +1,21 @@ +--- +# Flannel public IP +# The address that flannel should advertise as how to access the system +# Disabled until https://github.com/coreos/flannel/issues/712 is fixed +# flannel_public_ip: "{{ access_ip|default(ip|default(ansible_default_ipv4.address)) }}" + +## interface that should be used for flannel operations +## This is actually an inventory node-level item +# flannel_interface: + +# You can choose what type of flannel backend to use +# please refer to flannel's docs : https://github.com/coreos/flannel/blob/master/README.md + +# Limits for apps +flannel_memory_limit: 500M +flannel_cpu_limit: 300m +flannel_memory_requests: 64M +flannel_cpu_requests: 150m + +two_flannel_network1: "{{ kube_pods_subnet }}" +two_flannel_network2: "10.235.64.0/18" diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml b/deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml new file mode 100644 index 00000000..44ead00e --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml @@ -0,0 +1,61 @@ +--- +- name: 2Flannel | delete default docker bridge + command: ip link delete docker0 + failed_when: false + notify: 2Flannel | restart docker + +- name: 2Flannel | delete 2flannel interface + command: ip link delete flannel0 && ip link delete flannel1 + failed_when: false + +# special cases for atomic because it defaults to live-restore: true +# So we disable live-restore to pickup the new flannel IP. After +# we enable it, we have to restart docker again to pickup the new +# setting and restore the original behavior +- name: 2Flannel | restart docker + command: /bin/true + notify: + - 2Flannel | reload systemd + - 2Flannel | reload docker.socket + - 2Flannel | configure docker live-restore true (atomic) + - 2Flannel | reload docker + - 2Flannel | pause while Docker restarts + - 2Flannel | wait for docker + +- name: 2Flannel | reload systemd + shell: systemctl daemon-reload + +- name: 2Flannel | reload docker.socket + service: + name: docker.socket + state: restarted + when: ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] + +- name: 2Flannel | configure docker live-restore true (atomic) + replace: + name: /etc/docker/daemon.json + regexp: '"live-restore":.*true' + replace: '"live-restore": false' + when: is_atomic + +- name: 2Flannel | reload docker + service: + name: docker + state: restarted + +- name: 2Flannel | pause while Docker restarts + pause: + seconds: 10 + prompt: "Waiting for docker restart" + +- name: 2Flannel | wait for docker + command: "{{ docker_bin_dir }}/docker images" + register: docker_ready + retries: 10 + delay: 5 + until: docker_ready.rc == 0 + +- name: 2Flannel | reload kubelet + service: + name: kubelet + state: restarted diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/2flannel/tasks/main.yml new file mode 100644 index 00000000..e7adeefe --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/tasks/main.yml @@ -0,0 +1,73 @@ +--- +- include: pre-upgrade.yml + +- name: 2Flannel | Verify if br_netfilter module exists + shell: "modinfo br_netfilter" + register: modinfo_br_netfilter + failed_when: modinfo_br_netfilter.rc not in [0, 1] + changed_when: false + +- name: 2Flannel | Enable br_netfilter module + modprobe: + name: br_netfilter + state: present + when: modinfo_br_netfilter.rc == 0 + +# kube-proxy needs net.bridge.bridge-nf-call-iptables enabled when found +# if br_netfilter is not a module +- name: 2Flannel | Check if bridge-nf-call-iptables key exists + command: "sysctl net.bridge.bridge-nf-call-iptables" + failed_when: false + changed_when: false + register: sysctl_bridge_nf_call_iptables + +- name: 2Flannel | Enable bridge-nf-call tables + sysctl: + name: "{{ item }}" + state: present + value: 1 + reload: "yes" + when: modinfo_br_netfilter.rc == 1 and sysctl_bridge_nf_call_iptables.rc == 0 + with_items: + - net.bridge.bridge-nf-call-iptables + - net.bridge.bridge-nf-call-arptables + - net.bridge.bridge-nf-call-ip6tables + +- name: 2Flannel | Install Multus CNI + shell: |- + /usr/bin/docker run --rm --network=host -v /opt/cni/bin/:/opt/cni/bin/ golang:1.9 \ + bash -c \ + "git clone https://github.com/Intel-Corp/multus-cni && \ + cd multus-cni && ./build && cp bin/multus /opt/cni/bin" + +- name: 2Flannel | Create cni-flannel-rbac manifest + template: + src: cni-2flannel-rbac.yml.j2 + dest: "{{ kube_config_dir }}/cni-2flannel-rbac.yml" + register: two_flannel_rbac_manifest + when: inventory_hostname == groups['kube-master'][0] and rbac_enabled + +- name: 2Flannel | Create cni-flannel manifest + template: + src: cni-2flannel.yml.j2 + dest: "{{ kube_config_dir }}/cni-2flannel.yml" + register: two_flannel_manifest + when: inventory_hostname == groups['kube-master'][0] + +- name: 2Flannel | Set 2Flannel etcd configuration + shell: |- + ETCDCTL_CA_FILE=/etc/ssl/etcd/ssl/ca.pem \ + ETCDCTL_CERT_FILE=/etc/ssl/etcd/ssl/node-{{ ansible_hostname }}.pem \ + ETCDCTL_KEY_FILE=/etc/ssl/etcd/ssl/node-{{ ansible_hostname }}-key.pem \ + {{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \ + set /{{ cluster_name }}/{{ item.config }}/network/config \ + '{ "Network": "{{ item.network }}", "Backend": {"Type":"udp", "Port":{{ item.port}} }}' + with_items: + - {config: "2flannel.1", + network: "{{ two_flannel_network1 }}", + port: 8285} + - {config: "2flannel.2", + network: "{{ two_flannel_network2 }}", + port: 8286} + delegate_to: "{{groups['etcd'][0]}}" + run_once: true diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/tasks/pre-upgrade.yml b/deploy/adapters/ansible/kubernetes/roles/2flannel/tasks/pre-upgrade.yml new file mode 100644 index 00000000..a49002fe --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/tasks/pre-upgrade.yml @@ -0,0 +1,14 @@ +--- +- name: 2Flannel pre-upgrade | Purge legacy flannel systemd unit file + file: + path: "/etc/systemd/system/docker.service.d/flannel-options.conf" + state: absent + notify: + - 2Flannel | delete default docker bridge + +- name: 2Flannel pre-upgrade | Purge legacy Flannel static pod manifest + file: + path: "{{ kube_manifest_dir }}/flannel-pod.manifest" + state: absent + notify: + - 2Flannel | delete flannel interface diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/templates/cni-2flannel-rbac.yml.j2 b/deploy/adapters/ansible/kubernetes/roles/2flannel/templates/cni-2flannel-rbac.yml.j2 new file mode 100644 index 00000000..b4d1be11 --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/templates/cni-2flannel-rbac.yml.j2 @@ -0,0 +1,44 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: 2flannel + namespace: "{{system_namespace}}" +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: 2flannel +rules: + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - apiGroups: + - "" + resources: + - nodes + verbs: + - list + - watch + - apiGroups: + - "" + resources: + - nodes/status + verbs: + - patch +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: 2flannel +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: 2flannel +subjects: +- kind: ServiceAccount + name: 2flannel + namespace: "{{system_namespace}}" diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/templates/cni-2flannel.yml.j2 b/deploy/adapters/ansible/kubernetes/roles/2flannel/templates/cni-2flannel.yml.j2 new file mode 100644 index 00000000..9c159d37 --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/templates/cni-2flannel.yml.j2 @@ -0,0 +1,211 @@ +--- +kind: ConfigMap +apiVersion: v1 +metadata: + name: kube-2flannel-cfg1 + namespace: "{{system_namespace}}" + labels: + tier: node + app: 2flannel +data: + cni-conf.json: | + { + "name": "2flannel-networks", + "type": "multus", + "delegates": [ + { + "type": "flannel", + "name": "flannel1", + "subnetFile": "/run/2flannel/networks/subnet2.env", + "dataDir": "/var/lib/cni/flannel/2", + "delegate": { + "bridge": "kbr1", + "isDefaultGateway": false + } + }, + { + "type": "flannel", + "name": "flannel0", + "subnetFile": "/run/2flannel/networks/subnet1.env", + "dataDir": "/var/lib/cni/flannel/1", + "masterplugin": true, + "delegate": { + "bridge": "kbr0", + "isDefaultGateway": true + } + } + ] + } + net-conf.json: | + { + "Network": {{ two_flannel_network1 }}, + "Backend": { + "Type": "udp", + "Port": 8285 + } + } +--- +kind: ConfigMap +apiVersion: v1 +metadata: + name: kube-2flannel-cfg2 + namespace: "{{system_namespace}}" + labels: + tier: node + app: 2flannel +data: + net-conf.json: | + { + "Network": {{ two_flannel_network2 }}, + "Backend": { + "Type": "udp", + "Port": 8286 + } + } +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: kube-2flannel + namespace: "{{system_namespace}}" + labels: + tier: node + k8s-app: 2flannel +spec: + template: + metadata: + labels: + tier: node + k8s-app: 2flannel + spec: +{% if rbac_enabled %} + serviceAccountName: 2flannel +{% endif %} + containers: + - name: kube-2flannel-1 + image: {{ flannel_image_repo }}:{{ flannel_image_tag }} + imagePullPolicy: {{ k8s_image_pull_policy }} + resources: + limits: + cpu: {{ flannel_cpu_limit }} + memory: {{ flannel_memory_limit }} + requests: + cpu: {{ flannel_cpu_requests }} + memory: {{ flannel_memory_requests }} + command: [ "/opt/bin/flanneld", "--ip-masq", + "-etcd-endpoints={{ etcd_access_addresses }}", + "-etcd-prefix=/{{ cluster_name }}/2flannel.1/network", + "-etcd-cafile=/etc/ssl/etcd/ssl/ca.pem", + "-etcd-certfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME).pem", + "-etcd-keyfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME)-key.pem", + "-subnet-file=/run/2flannel/networks/subnet1.env" ] + securityContext: + privileged: true + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + volumeMounts: + - name: run + mountPath: /run + - name: cni + mountPath: /etc/cni/net.d + - name: ssl + mountPath: /etc/ssl/etcd/ssl/ + - name: 2flannel-cfg1 + mountPath: /etc/kube-flannel/ + - name: kube-2flannel-2 + image: {{ flannel_image_repo }}:{{ flannel_image_tag }} + imagePullPolicy: {{ k8s_image_pull_policy }} + resources: + limits: + cpu: {{ flannel_cpu_limit }} + memory: {{ flannel_memory_limit }} + requests: + cpu: {{ flannel_cpu_requests }} + memory: {{ flannel_memory_requests }} + command: [ "/opt/bin/flanneld", "--ip-masq", + "-etcd-endpoints={{ etcd_access_addresses }}", + "-etcd-prefix=/{{ cluster_name }}/2flannel.2/network", + "-etcd-cafile=/etc/ssl/etcd/ssl/ca.pem", + "-etcd-certfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME).pem", + "-etcd-keyfile=/etc/ssl/etcd/ssl/node-$(NODE_NAME)-key.pem", + "-subnet-file=/run/2flannel/networks/subnet2.env" ] + securityContext: + privileged: true + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + volumeMounts: + - name: run + mountPath: /run + - name: cni + mountPath: /etc/cni/net.d + - name: ssl + mountPath: /etc/ssl/etcd/ssl/ + - name: 2flannel-cfg2 + mountPath: /etc/kube-flannel/ + - name: install-cni + image: {{ flannel_cni_image_repo }}:{{ flannel_cni_image_tag }} + command: ["/install-cni.sh"] + env: + # The CNI network config to install on each node. + - name: CNI_NETWORK_CONFIG + valueFrom: + configMapKeyRef: + name: kube-2flannel-cfg1 + key: cni-conf.json + - name: CNI_CONF_NAME + value: "10-multus-2flannel.conf" + volumeMounts: + - name: cni + mountPath: /host/etc/cni/net.d + - name: host-cni-bin + mountPath: /host/opt/cni/bin/ + hostNetwork: true + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule + volumes: + - name: run + hostPath: + path: /run + - name: cni + hostPath: + path: /etc/cni/net.d + - name: ssl + hostPath: + path: /etc/ssl/etcd/ssl/ + - name: 2flannel-cfg1 + configMap: + name: kube-2flannel-cfg1 + - name: 2flannel-cfg2 + configMap: + name: kube-2flannel-cfg2 + - name: host-cni-bin + hostPath: + path: /opt/cni/bin + updateStrategy: + rollingUpdate: + maxUnavailable: {{ serial | default('20%') }} + type: RollingUpdate diff --git a/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml index af52ad04..6d947623 100644 --- a/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml +++ b/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml @@ -57,7 +57,6 @@ - netaddr - jinja2 - - name: copy inventories generate script copy: src: generate_inventories.py @@ -126,6 +125,13 @@ regexp: '^#loadbalancer_apiserver_localhost: true' line: 'loadbalancer_apiserver_localhost: true' +- name: use the user name and password login the dashboard + lineinfile: + dest: /opt/kargo_k8s/inventory/group_vars/k8s-cluster.yml + regexp: '^#kube_basic_auth: false' + line: 'kube_basic_auth: true' + + - name: add vip to ssl keys lineinfile: dest: /opt/kargo_k8s/inventory/group_vars/k8s-cluster.yml @@ -149,6 +155,68 @@ - extra-vars-{{ ansible_architecture }}.yml - extra-vars.yml +- name: copy 2flannel playbook to kargo + copy: + src: "{{ run_dir }}/roles/2flannel" + dest: /opt/kargo_k8s/roles/network_plugin + +- name: copy 2flannel-apps playbook to kargo + copy: + src: "{{ run_dir }}/roles/2flannel-apps/" + dest: /opt/kargo_k8s/roles/kubernetes-apps/network_plugin/2flannel + +- name: append 2flannel to network plugin + blockinfile: + path: /opt/kargo_k8s/roles/network_plugin/meta/main.yml + block: " - role: network_plugin/2flannel\n \ + when: kube_network_plugin == '2flannel'\n tags: 2flannel\n" + +- name: append 2flannel apps to network plugin + blockinfile: + path: /opt/kargo_k8s/roles/kubernetes-apps/network_plugin/meta/main.yml + block: " - role: kubernetes-apps/network_plugin/2flannel\n \ + when: kube_network_plugin == '2flannel'\n tags: 2flannel\n" + +- name: append 2flannel to valid kube_network_plugin list + replace: + path: "/opt/kargo_k8s/roles/kubernetes/{{ item.path }}" + regexp: "{{ item.regexp }}" + replace: "{{ item.replace }}" + with_items: + - {path: 'master/templates/manifests/kube-controller-manager.manifest.j2', + regexp: '"cloud", "flannel"', + replace: '"cloud", "flannel", "2flannel"'} + - {path: 'node/templates/kubelet.kubeadm.env.j2', + regexp: '"calico", "canal", "flannel", "weave"', + replace: '"calico", "canal", "flannel", "weave", "2flannel"'} + - {path: 'node/templates/kubelet.standard.env.j2', + regexp: '"calico", "canal", "flannel", "weave"', + replace: '"calico", "canal", "flannel", "weave", "2flannel"'} + - {path: 'node/templates/kubelet.rkt.service.j2', + regexp: '"calico", "weave", "canal", "flannel"', + replace: '"calico", "weave", "canal", "flannel", "2flannel"'} + - {path: 'preinstall/tasks/main.yml', + regexp: '"calico", "weave", "canal", "flannel"', + replace: '"calico", "weave", "canal", "flannel", "2flannel"'} + +# yamllint disable rule:line-length +- name: enable CSI plugin feature + lineinfile: + dest: "/opt/kargo_k8s/roles/kubespray-defaults/defaults/main.yaml" + regexp: "^kube_feature_gates:" + line: "{% raw %}kube_feature_gates: ['Initializers={{ istio_enabled|string }}', 'PersistentLocalVolumes={{ local_volumes_enabled|string }}', 'CSIPersistentVolume=True', 'MountPropagation=True']{% endraw %}" + when: + - stor4nfv is defined and stor4nfv == "Enable" +# yamllint enable rule:line-length + +- name: enable CSI plugin runtime_config + lineinfile: + dest: /opt/kargo_k8s/roles/kubernetes/master/defaults/main.yml + insertafter: '^ - admissionregistration.k8s.io/v1alpha1' + line: ' - storage.k8s.io/v1alpha1' + when: + - stor4nfv is defined and stor4nfv == "Enable" + - name: run kargo playbook shell: | cd /opt/kargo_k8s diff --git a/deploy/adapters/ansible/kubernetes/roles/kargo/vars/main.yml b/deploy/adapters/ansible/kubernetes/roles/kargo/vars/main.yml index b73056e5..21287b02 100644 --- a/deploy/adapters/ansible/kubernetes/roles/kargo/vars/main.yml +++ b/deploy/adapters/ansible/kubernetes/roles/kargo/vars/main.yml @@ -3,3 +3,4 @@ helm_flag: true apiserver_loadbalancer_domain_name: "{{ public_vip.ip }}" vipaddress: "{{ public_vip.ip }}" exlb_port: 8383 +kubelet_fail_swap_on: false diff --git a/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/main.yml index 76203440..c915ec09 100644 --- a/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/main.yml +++ b/deploy/adapters/ansible/kubernetes/roles/pre-k8s/tasks/main.yml @@ -12,3 +12,7 @@ - include: "{{ ansible_os_family }}.yml" when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' + +- name: close the swap partition + shell: | + swapoff -a diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 9a442da3..6ea57c04 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -58,6 +58,13 @@ - collectd - hosts: + - controller + remote_user: root + roles: + - influxdb + - grafana + +- hosts: - neutron_openvswitch_agent - compute remote_user: root diff --git a/deploy/adapters/ansible/roles/config-osa/files/redhat-7.yml b/deploy/adapters/ansible/roles/config-osa/files/redhat-7.yml new file mode 100644 index 00000000..ccfe7da2 --- /dev/null +++ b/deploy/adapters/ansible/roles/config-osa/files/redhat-7.yml @@ -0,0 +1,5 @@ +--- + +tacker_distro_packages: + - rsync + - git-core diff --git a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml index 8bb56656..5f4f2fb2 100755 --- a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml +++ b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml @@ -361,3 +361,10 @@ dest: /opt/openstack-ansible/playbooks/setup-openstack.yml insertafter: "^- include: os-trove" line: "- include: os-tacker-install.yml" + +- name: add variables file of tacker for centos + copy: + src: redhat-7.yml + dest: /etc/ansible/roles/os_tacker/vars/redhat-7.yml + +- include: set_openstack_release.yml diff --git a/deploy/adapters/ansible/roles/config-osa/tasks/set_openstack_release.yml b/deploy/adapters/ansible/roles/config-osa/tasks/set_openstack_release.yml new file mode 100644 index 00000000..c886eabf --- /dev/null +++ b/deploy/adapters/ansible/roles/config-osa/tasks/set_openstack_release.yml @@ -0,0 +1,15 @@ +############################################################################ +# Copyright (c) 2018 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: set openstack release + lineinfile: + dest: "{{ run_dir }}/group_vars/all" + line: "openstack_release: {{ openstack_release }}" + +- meta: refresh_inventory diff --git a/deploy/adapters/ansible/roles/config-osa/vars/main.yml b/deploy/adapters/ansible/roles/config-osa/vars/main.yml index 0b3b0c1e..65f67c18 100644 --- a/deploy/adapters/ansible/roles/config-osa/vars/main.yml +++ b/deploy/adapters/ansible/roles/config-osa/vars/main.yml @@ -11,3 +11,6 @@ LOCAL_REPOSITORY_IP: "192.168.137.222" ceph_host: "{{ hostvars[inventory_hostname]['groups']['ceph_osd'][0] }}" repo_dest_path: "/var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/" networking_sfc_version: 4.0.0 +# yamllint disable rule:line-length +openstack_release: "{{ lookup('yamlfile', '/opt/openstack-ansible/group_vars/all/all.yml key=openstack_release') }}" +# yamllint enable rule:line-length diff --git a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml index fb0dc67d..d5582391 100644 --- a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml +++ b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml @@ -69,3 +69,20 @@ flat: "yes" when: - inventory_hostname == groups['network_hosts'][0] + +# yamllint disable rule:line-length +- name: fix horizon upload image issue + lineinfile: + dest: "/openstack/venvs/horizon-{{ openstack_release }}/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py" + regexp: "^HORIZON_IMAGES_UPLOAD_MODE" + line: "HORIZON_IMAGES_UPLOAD_MODE = 'legacy'" + when: + - inventory_hostname in groups['dashboard_containers'] +# yamllint enable rule:line-length + +- name: restart apache2 + service: + name: apache2 + state: restarted + when: + - inventory_hostname in groups['dashboard_containers'] diff --git a/deploy/playbook_done.py b/deploy/ansible_plugins/callback/playbook_done.py index 6b1043d4..4784ff63 100644 --- a/deploy/playbook_done.py +++ b/deploy/ansible_plugins/callback/playbook_done.py @@ -17,6 +17,8 @@ """Ansible playbook callback after a playbook run has completed.""" import sys +from distutils.version import LooseVersion +from ansible import __version__ as __ansible_version__ from ansible.plugins.callback import CallbackBase compass_bin = "/opt/compass/bin" @@ -85,7 +87,10 @@ class CallbackModule(CallbackBase): return def v2_playbook_on_stats(self, stats): - all_vars = self.play.get_variable_manager().get_vars(self.loader) + if LooseVersion(__ansible_version__) < LooseVersion("2.4"): + all_vars = self.play.get_variable_manager().get_vars(self.loader) + else: + all_vars = self.play.get_variable_manager().get_vars() host_vars = all_vars["hostvars"] hosts = sorted(stats.processed.keys()) cluster_name = host_vars[hosts[0]]['cluster_name'] diff --git a/deploy/status_callback.py b/deploy/ansible_plugins/callback/status_callback.py index 6169b87f..b87d2094 100644 --- a/deploy/status_callback.py +++ b/deploy/ansible_plugins/callback/status_callback.py @@ -11,6 +11,8 @@ import httplib import simplejson as json import sys # noqa:F401 +from distutils.version import LooseVersion +from ansible import __version__ as __ansible_version__ from ansible.plugins.callback import CallbackBase COMPASS_HOST = "compass-deck" @@ -101,7 +103,10 @@ class CallbackModule(CallbackBase): def v2_playbook_on_stats(self, stats): self._display.display("playbook_on_stats enter") - all_vars = self.play.get_variable_manager().get_vars(self.loader) + if LooseVersion(__ansible_version__) < LooseVersion("2.4"): + all_vars = self.play.get_variable_manager().get_vars(self.loader) + else: + all_vars = self.play.get_variable_manager().get_vars() host_vars = all_vars["hostvars"] hosts = sorted(stats.processed.keys()) cluster_name = host_vars[hosts[0]]['cluster_name'] diff --git a/deploy/ansible_plugins/lookup/yamlfile.py b/deploy/ansible_plugins/lookup/yamlfile.py new file mode 100644 index 00000000..c915adc7 --- /dev/null +++ b/deploy/ansible_plugins/lookup/yamlfile.py @@ -0,0 +1,55 @@ +#!/bin/venv python + +import yaml +import sys + +compass_bin = "/opt/compass/bin" +sys.path.append(compass_bin) +import switch_virtualenv # noqa: F401 + +from ansible.errors import AnsibleError # noqa: E402 +from ansible.plugins.lookup import LookupBase # noqa: E402 + + +class LookupModule(LookupBase): + + def read_yaml(self, yaml_path, key, default=None): + if not key: + return None + + with open(yaml_path) as fd: + yaml_data = yaml.safe_load(fd) + + if key in yaml_data: + return yaml_data[key] + else: + return default + + def run(self, terms, variables=None, **kwargs): + res = [] + if not isinstance(terms, list): + terms = [terms] + + for term in terms: + params = term.split() + yaml_path = params[0] + + param_dict = { + 'key': None, + 'default': None + } + + try: + for param in params[1:]: + key, value = param.split('=') + assert(key in param_dict) + param_dict[key] = value + except (AttributeError, AssertionError), e: + raise AnsibleError(e) + + data = self.read_yaml(yaml_path, + param_dict['key'], + param_dict['default']) + res.append(data) + + return res diff --git a/deploy/compass_conf/flavor/kubernetes.conf b/deploy/compass_conf/flavor/kubernetes.conf index 71acadff..e7e8ffc8 100755 --- a/deploy/compass_conf/flavor/kubernetes.conf +++ b/deploy/compass_conf/flavor/kubernetes.conf @@ -4,7 +4,7 @@ FLAVORS = [{ 'display_name': 'ansible-kubernetes', 'template': 'ansible-kubernetes.tmpl', 'roles': [ - 'kube_master', 'etcd', 'kube_node', 'ha' + 'kube_master', 'etcd', 'kube_node', 'ha', 'storage_master', 'storage_node' ], }] diff --git a/deploy/compass_conf/package_installer/ansible-kubernetes.conf b/deploy/compass_conf/package_installer/ansible-kubernetes.conf index 820691b7..044af9a9 100755 --- a/deploy/compass_conf/package_installer/ansible-kubernetes.conf +++ b/deploy/compass_conf/package_installer/ansible-kubernetes.conf @@ -7,7 +7,7 @@ SETTINGS = { 'playbook_file': 'site.yml', 'inventory_file': 'inventory.py', 'inventory_json_file': 'inventory.json', - 'inventory_group': ['kube_master', 'etcd', 'kube_node', 'ha'], + 'inventory_group': ['kube_master', 'etcd', 'kube_node', 'ha', 'ceph_adm', 'ceph_mon', 'ceph_osd', 'storage_master', 'storage_node'], 'group_variable': 'all', 'etc_hosts_path': 'roles/pre-k8s/templates/hosts', 'runner_dirs': ['roles','kubernetes/roles'] diff --git a/deploy/compass_conf/role/kubernetes_ansible.conf b/deploy/compass_conf/role/kubernetes_ansible.conf index c27779ad..3e79cbb9 100755 --- a/deploy/compass_conf/role/kubernetes_ansible.conf +++ b/deploy/compass_conf/role/kubernetes_ansible.conf @@ -15,6 +15,15 @@ ROLES = [{ 'role': 'ha', 'display_name': 'ha', 'description': 'ha' +}, { + 'role': 'storage_master', + 'display_name': 'storage master', + 'description': 'storage master', + 'optional': True +}, { + 'role': 'storage_node', + 'display_name': 'storage node', + 'description': 'storage node', + 'optional': True } - ] diff --git a/deploy/compass_conf/templates/ansible_installer/kubernetes/ansible_cfg/ansible-kubernetes.tmpl b/deploy/compass_conf/templates/ansible_installer/kubernetes/ansible_cfg/ansible-kubernetes.tmpl index f09fa9c8..da4554e3 100644 --- a/deploy/compass_conf/templates/ansible_installer/kubernetes/ansible_cfg/ansible-kubernetes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/kubernetes/ansible_cfg/ansible-kubernetes.tmpl @@ -3,7 +3,7 @@ log_path = /var/ansible/run/kubernetes-$cluster_name/ansible.log host_key_checking = False callback_whitelist = playbook_done, status_callback -callback_plugins = /opt/ansible_callbacks +callback_plugins = /opt/ansible_plugins/callback forks=100 [ssh_connection] diff --git a/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl b/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl index f132365a..f6d96c78 100644 --- a/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl @@ -40,6 +40,7 @@ deploy_type: $getVar('deploy_type', 'virtual') public_cidr: $kube_nodes[0]['install']['subnet'] storage_cidr: "{{ ip_settings[inventory_hostname]['storage']['cidr'] }}" mgmt_cidr: "{{ ip_settings[inventory_hostname]['mgmt']['cidr'] }}" +external_cidr: "{{ ip_settings[inventory_hostname]['external']['cidr'] }}" public_net_info: "{{ network_cfg.public_net_info }}" host_ip_settings: "{{ ip_settings[inventory_hostname] }}" @@ -159,6 +160,13 @@ CONGRESS_PASS: $congress_pass DEMO_PASS: $demo_pass ADMIN_PASS: $admin_pass +#set plugins = $getVar('plugins', []) +#for item in plugins +#set keys = $item.keys() +#set values = $item.values() +$keys[0]: $values[0] +#end for + #set neutron_service_plugins=['router'] #if $getVar('enable_fwaas', True) diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_pike/ansible_cfg/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_pike/ansible_cfg/HA-ansible-multinodes.tmpl index cd8c8d30..6fdb6b16 100755 --- a/deploy/compass_conf/templates/ansible_installer/openstack_pike/ansible_cfg/HA-ansible-multinodes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/openstack_pike/ansible_cfg/HA-ansible-multinodes.tmpl @@ -3,7 +3,8 @@ log_path = /var/ansible/run/openstack_pike-$cluster_name/ansible.log host_key_checking = False callback_whitelist = playbook_done, status_callback -callback_plugins = /opt/ansible_callbacks +callback_plugins = /opt/ansible_plugins/callback +lookup_plugins = /opt/ansible_plugins/lookup forks=100 [ssh_connection] diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index cf215f3b..17171578 100755 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -23,7 +23,7 @@ function check_container_alive() { docker exec -it compass-mq bash -c "exit" 1>/dev/null 2>&1 local mq_state=$? - if [ $((deck_state||tasks_state||cobbler_state||db_state||mq-state)) == 0 ]; then + if [ $((deck_state||tasks_state||cobbler_state||db_state||mq_state)) == 0 ]; then echo "true" else echo "false" diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf index 5395405d..274847ae 100644 --- a/deploy/conf/base.conf +++ b/deploy/conf/base.conf @@ -2,17 +2,10 @@ export DHA=${DHA:-$COMPASS_DIR/deploy/conf/vm_environment/os-nosdn-nofeature-ha. export NEUTRON=${NEUTRON:-$COMPASS_DIR/deploy/conf/neutron_cfg.yaml} export NETWORK=${NETWORK:-$COMPASS_DIR/deploy/conf/network_cfg.yaml} export TAR_URL=${TAR_URL:-file://`pwd`/work/building/compass.tar.gz} -export INSTALL_IP=${INSTALL_IP:-10.1.0.1} -export EXT_NAT_MASK=${EXT_NAT_MASK:-255.255.252.0} -export EXT_NAT_GW=${EXT_NAT_GW:-192.16.1.1} -export EXT_NAT_IP_START=${EXT_NAT_IP_START:-192.16.1.3} -export EXT_NAT_IP_END=${EXT_NAT_IP_END:-192.16.1.254} -export EXTERNAL_NIC=${EXTERNAL_NIC:-eth0} +export PXE_NIC=${PXE_NIC:-eth0} export DOMAIN="ods.com" export PARTITIONS="/=30%,/home=5%,/tmp=5%,/var=60%" -export SUBNETS="10.1.0.0/24,172.16.2.0/24,172.16.3.0/24,172.16.4.0/24" -export MANAGEMENT_IP_START=${MANAGEMENT_IP_START:-'10.1.0.50'} export MANAGEMENT_INTERFACE=${MANAGEMENT_INTERFACE:-eth0} export DASHBOARD_URL="" export ENABLE_SECGROUP=${ENABLE_SECGROUP:-"true"} @@ -27,7 +20,6 @@ export NETWORK_MAPPING=${NETWORK_MAPPING:-"install=${MANAGEMENT_INTERFACE}"} export PROXY="" export IGNORE_PROXY="" export SEARCH_PATH="ods.com" -export GATEWAY="10.1.0.1" export SERVER_CREDENTIAL="root=root" export LOCAL_REPO_URL="" export OS_CONFIG_FILENAME="" diff --git a/deploy/conf/cluster.conf b/deploy/conf/cluster.conf index 750ff113..0d947100 100644 --- a/deploy/conf/cluster.conf +++ b/deploy/conf/cluster.conf @@ -24,10 +24,10 @@ export ADAPTER_NAME="openstack_$OPENSTACK_VERSION" export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-$OPENSTACK_VERSION" if [[ "x"$KUBERNETES_VERSION != "x" ]]; then + unset OPENSTACK_VERSION export ADAPTER_NAME=kubernetes export ADAPTER_FLAVOR_PATTERN=ansible-kubernetes export ADAPTER_TARGET_SYSTEM_PATTERN='^kubernetes$' fi export DEFAULT_ROLES="" -export VIP="10.1.0.222" diff --git a/deploy/conf/compass.conf b/deploy/conf/compass.conf index 9d9145f1..be5d17c3 100644 --- a/deploy/conf/compass.conf +++ b/deploy/conf/compass.conf @@ -1,20 +1,25 @@ -export COMPASS_VIRT_CPUS=4 -export COMPASS_VIRT_MEM=4096 +export CLUSTER_NAME=${CLUSTER_NAME:-opnfv} +export INSTALL_IP=${INSTALL_IP:-$INSTALL_GW} export COMPASS_SERVER=$INSTALL_IP export COMPASS_DECK_PORT="5050" export COMPASS_SERVER_URL="http://$INSTALL_IP:$COMPASS_DECK_PORT/api" export HTTP_SERVER_URL="http://$INSTALL_IP:$COMPASS_DECK_PORT/api" export COMPASS_USER_EMAIL="admin@huawei.com" export COMPASS_USER_PASSWORD="admin" + export COMPASS_DNS1=${COMPASS_DNS1:-'8.8.8.8'} export COMPASS_DNS2=${COMPASS_DNS2:-} -export COMPASS_EXTERNAL_IP=${COMPASS_EXTERNAL_IP:-} -export COMPASS_EXTERNAL_MASK=${COMPASS_EXTERNAL_MASK:-} -export COMPASS_EXTERNAL_GW=${COMPASS_EXTERNAL_GW:-} export LANGUAGE="EN" export TIMEZONE="America/Los_Angeles" export NTP_SERVER="$COMPASS_SERVER" export NAMESERVERS=${USER_NAMESERVER:-"$COMPASS_SERVER"} export COMPASS_REPO_PORT="5151" export OFFLINE_DEPLOY=${OFFLINE_DEPLOY:-'Disable'} -export COMPOSE_IMAGES="[compass-db,compass-mq,compass-deck,compass-tasks,compass-cobbler]" + +if [[ "x"$COMPOSE_IMAGES == "x" && "x"$OPENSTACK_VERSION != "x" ]]; then + export COMPOSE_IMAGES="[compass-db,compass-mq,compass-deck,compass-tasks-osa,compass-cobbler]" +fi + +if [[ "x"$COMPOSE_IMAGES == "x" && "x"$KUBERNETES_VERSION != "x" ]]; then + export COMPOSE_IMAGES="[compass-db,compass-mq,compass-deck,compass-tasks-k8s,compass-cobbler]" +fi diff --git a/deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml b/deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml new file mode 100644 index 00000000..6cf62db7 --- /dev/null +++ b/deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml @@ -0,0 +1,74 @@ +############################################################################## +# 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 +############################################################################## + +--- +TYPE: baremetal +FLAVOR: cluster +POWER_TOOL: ipmitool + +ipmiUser: root +ipmiVer: '2.0' + +plugins: + - stor4nfv: "Enable" + +hosts: + - name: host1 + mac: 'F8:4A:BF:55:A2:8D' + interfaces: + - eth1: 'F8:4A:BF:55:A2:8E' + ipmiIp: 172.16.130.26 + ipmiPass: Opnfv@pod1 + roles: + - kube_master + - etcd + - ha + + - name: host2 + mac: 'D8:49:0B:DA:5A:B7' + interfaces: + - eth1: 'D8:49:0B:DA:5A:B8' + ipmiIp: 172.16.130.27 + ipmiPass: Opnfv@pod1 + roles: + - kube_master + - etcd + - ha + + - name: host3 + mac: '78:D7:52:A0:B1:99' + interfaces: + - eth1: '78:D7:52:A0:B1:9A' + ipmiIp: 172.16.130.29 + ipmiPass: Opnfv@pod1 + roles: + - kube_master + - etcd + - ha + - storage_master + + - name: host4 + mac: 'D8:49:0B:DA:5B:5D' + interfaces: + - eth1: 'D8:49:0B:DA:5B:5E' + ipmiIp: 172.16.130.30 + ipmiPass: Opnfv@pod1 + roles: + - kube_node + - storage_node + + - name: host5 + mac: 'D8:49:0B:DA:56:85' + interfaces: + - eth1: 'D8:49:0B:DA:56:86' + ipmiIp: 172.16.130.31 + ipmiPass: Opnfv@pod1 + roles: + - kube_node + - storage_node diff --git a/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml new file mode 100644 index 00000000..a96a5259 --- /dev/null +++ b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml @@ -0,0 +1,73 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## + +--- + +TYPE: baremetal +FLAVOR: cluster +POWER_TOOL: ipmitool + +ipmiVer: '2.0' + +hosts: + - name: host1 + mac: 'EC:38:8F:79:0C:2C' + ipmiUser: root + ipmiPass: Opnfv@pod2 + ipmiIp: 172.16.130.20 + interfaces: + - eth1: 'EC:38:8F:79:0C:2D' + roles: + - kube_master + - etcd + - ha + + - name: host2 + mac: 'EC:38:8F:79:0C:48' + ipmiIp: 172.16.130.19 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:79:0C:49' + roles: + - kube_master + - etcd + - ha + + - name: host3 + mac: 'EC:38:8F:79:10:CC' + ipmiIp: 172.16.130.18 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:79:10:CD' + roles: + - kube_master + - etcd + - ha + + - name: host4 + mac: 'EC:38:8F:79:0C:6C' + ipmiIp: 172.16.130.17 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:79:0C:6D' + roles: + - kube_node + + - name: host5 + mac: 'EC:38:8F:7A:E6:ED' + ipmiIp: 172.16.130.16 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:7A:E6:EE' + roles: + - kube_node diff --git a/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml new file mode 100644 index 00000000..4fbea1f0 --- /dev/null +++ b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml @@ -0,0 +1,79 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## + +--- + +TYPE: baremetal +FLAVOR: cluster +POWER_TOOL: ipmitool + +ipmiVer: '2.0' + +plugins: + - stor4nfv: "Enable" + +hosts: + - name: host1 + mac: 'EC:38:8F:79:0C:2C' + ipmiUser: root + ipmiPass: Opnfv@pod2 + ipmiIp: 172.16.130.20 + interfaces: + - eth1: 'EC:38:8F:79:0C:2D' + roles: + - kube_master + - etcd + - ha + + - name: host2 + mac: 'EC:38:8F:79:0C:48' + ipmiIp: 172.16.130.19 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:79:0C:49' + roles: + - kube_master + - etcd + - ha + + - name: host3 + mac: 'EC:38:8F:79:10:CC' + ipmiIp: 172.16.130.18 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:79:10:CD' + roles: + - kube_master + - etcd + - ha + - storage_master + + - name: host4 + mac: 'EC:38:8F:79:0C:6C' + ipmiIp: 172.16.130.17 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:79:0C:6D' + roles: + - kube_node + - storage_node + + - name: host5 + mac: 'EC:38:8F:7A:E6:ED' + ipmiIp: 172.16.130.16 + ipmiUser: root + ipmiPass: Opnfv@pod2 + interfaces: + - eth1: 'EC:38:8F:7A:E6:EE' + roles: + - kube_node + - storage_node diff --git a/deploy/conf/hardware_environment/intel-pod17/k8-nosdn-nofeature-ha.yml b/deploy/conf/hardware_environment/intel-pod17/k8-nosdn-nofeature-ha.yml index 7cc2c215..660f5e2e 100644 --- a/deploy/conf/hardware_environment/intel-pod17/k8-nosdn-nofeature-ha.yml +++ b/deploy/conf/hardware_environment/intel-pod17/k8-nosdn-nofeature-ha.yml @@ -27,6 +27,7 @@ hosts: roles: - kube_master - etcd + - ha - name: host2 mac: 'A4:BF:01:14:01:13' @@ -39,6 +40,7 @@ hosts: roles: - kube_master - etcd + - ha - name: host3 mac: 'A4:BF:01:14:71:1E' @@ -51,6 +53,7 @@ hosts: roles: - kube_master - etcd + - ha - name: host4 mac: 'A4:BF:01:16:2F:17' diff --git a/deploy/conf/virtual.conf b/deploy/conf/virtual.conf index 1e9034f3..dcee7d30 100644 --- a/deploy/conf/virtual.conf +++ b/deploy/conf/virtual.conf @@ -3,7 +3,13 @@ export VIRT_CPUS=${VIRT_CPUS:-8} export VIRT_MEM=${VIRT_MEM:-16384} export VIRT_DISK=${VIRT_DISK:-200G} +export EXT_NAT_MASK=${EXT_NAT_MASK:-255.255.252.0} +export EXT_NAT_GW=${EXT_NAT_GW:-192.16.1.1} +export EXT_NAT_IP_START=${EXT_NAT_IP_START:-192.16.1.3} +export EXT_NAT_IP_END=${EXT_NAT_IP_END:-192.16.1.254} + export SWITCH_IPS="1.1.1.1" export SWITCH_CREDENTIAL="version=2c,community=public" export DEPLOYMENT_TIMEOUT="300" export POLL_SWITCHES_FLAG="nopoll_switches" +export NAT_EXTERNAL=${NAT_EXTERNAL:true} diff --git a/deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml b/deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml index 9912d59b..9c2c23fb 100644 --- a/deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml +++ b/deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml @@ -16,6 +16,7 @@ hosts: roles: - kube_master - etcd + - ha - name: host2 roles: diff --git a/deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml new file mode 100644 index 00000000..e5e458f7 --- /dev/null +++ b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml @@ -0,0 +1,45 @@ +############################################################################## +# 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 +############################################################################## + +--- +TYPE: virtual +FLAVOR: cluster + +plugins: + - stor4nfv: "Enable" + +hosts: + - name: host1 + roles: + - kube_master + - etcd + - ha + + - name: host2 + roles: + - kube_master + - etcd + - ha + + - name: host3 + roles: + - kube_master + - etcd + - ha + - storage_master + + - name: host4 + roles: + - kube_node + - storage_node + + - name: host5 + roles: + - kube_node + - storage_node diff --git a/deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml new file mode 100644 index 00000000..f8c29b3e --- /dev/null +++ b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml @@ -0,0 +1,28 @@ +############################################################################## +# 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 +############################################################################## + +--- +TYPE: virtual +FLAVOR: cluster + +plugins: + - stor4nfv: "Enable" + +hosts: + - name: host1 + roles: + - kube_master + - etcd + - storage_master + - ha + + - name: host2 + roles: + - kube_node + - storage_node diff --git a/deploy/config_parse.py b/deploy/config_parse.py index 1575ca37..ceaab0f5 100644 --- a/deploy/config_parse.py +++ b/deploy/config_parse.py @@ -13,8 +13,6 @@ import yaml import sys from Cheetah.Template import Template -PXE_INTF = "eth0" - def init(file): with open(file) as fd: @@ -64,9 +62,10 @@ def hostmacs(s, seq, host=None): def export_network_file(dha, network, ofile): - env = {} - - mgmt_net = [item for item in network['ip_settings'] + install_network_env = {} + host_network_env = {} + ip_settings = network['ip_settings'] + mgmt_net = [item for item in ip_settings if item['name'] == 'mgmt'][0] mgmt_gw = mgmt_net['gw'] mgmt_cidr = mgmt_net['cidr'] @@ -74,12 +73,15 @@ def export_network_file(dha, network, ofile): mgmt_netmask = '.'.join([str((0xffffffff << (32 - prefix) >> i) & 0xff) for i in [24, 16, 8, 0]]) dhcp_ip_range = ' '.join(mgmt_net['dhcp_ranges'][0]) - env.update({'INSTALL_GW': mgmt_gw}) - env.update({'INSTALL_CIDR': mgmt_cidr}) - env.update({'INSTALL_NETMASK': mgmt_netmask}) - env.update({'INSTALL_IP_RANGE': dhcp_ip_range}) - export_env_dict(env, ofile) - + internal_vip = network['internal_vip']['ip'] + install_network_env.update({'INSTALL_GW': mgmt_gw}) + install_network_env.update({'INSTALL_CIDR': mgmt_cidr}) + install_network_env.update({'INSTALL_NETMASK': mgmt_netmask}) + install_network_env.update({'INSTALL_IP_RANGE': dhcp_ip_range}) + install_network_env.update({'VIP': internal_vip}) + export_env_dict(install_network_env, ofile) + + pxe_nic = os.environ['PXE_NIC'] host_ip_range = mgmt_net['ip_ranges'][0] host_ips = netaddr.iter_iprange(host_ip_range[0], host_ip_range[1]) host_networks = [] @@ -87,8 +89,11 @@ def export_network_file(dha, network, ofile): host_name = host['name'] host_ip = str(host_ips.next()) host_networks.append( - "{0}:{1}={2}|is_mgmt".format(host_name, PXE_INTF, host_ip)) - host_network_env = {"HOST_NETWORKS": ';'.join(host_networks)} + '{0}:{1}={2}|is_mgmt'.format(host_name, pxe_nic, host_ip)) + host_subnets = [item['cidr'] for item in ip_settings] + host_network_env.update({'NETWORK_MAPPING': "install=" + pxe_nic}) + host_network_env.update({'HOST_NETWORKS': ';'.join(host_networks)}) + host_network_env.update({'SUBNETS': ','.join(host_subnets)}) export_env_dict(host_network_env, ofile, True) diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh index 7a91bd88..512386e5 100755 --- a/deploy/deploy_host.sh +++ b/deploy/deploy_host.sh @@ -37,7 +37,7 @@ function deploy_host(){ --adapter_flavor_pattern="${ADAPTER_FLAVOR_PATTERN}" --repo_name="${REPO_NAME}" \ --http_proxy="${PROXY}" --https_proxy="${PROXY}" --no_proxy="${IGNORE_PROXY}" \ --ntp_server="${NTP_SERVER}" --dns_servers="${NAMESERVERS}" --domain="${DOMAIN}" \ - --search_path="${SEARCH_PATH}" --default_gateway="${GATEWAY}" \ + --search_path="${SEARCH_PATH}" --default_gateway="${INSTALL_GW}" \ --server_credential="${SERVER_CREDENTIAL}" --local_repo_url="${LOCAL_REPO_URL}" \ --os_config_json_file="${OS_CONFIG_FILENAME}" --service_credentials="${SERVICE_CREDENTIALS}" \ --console_credentials="${CONSOLE_CREDENTIALS}" --host_networks="${HOST_NETWORKS}" \ diff --git a/deploy/host_virtual.sh b/deploy/host_virtual.sh index 03a1230f..d955b747 100755 --- a/deploy/host_virtual.sh +++ b/deploy/host_virtual.sh @@ -52,6 +52,11 @@ function launch_host_vms() { vm_template_file="$vm_template_dir/host.xml" vm_template_arch="$vm_template_dir/host-$COMPASS_ARCH.xml" [ -f $vm_template_arch ] && vm_template_file=$vm_template_arch + if [[ "$NAT_EXTERNAL" == "false" ]]; then + NET_IAAS="external" + else + NET_IAAS="external_nat" + fi log_info "bringing up pxe boot vms" i=0 @@ -67,7 +72,7 @@ function launch_host_vms() { -e "s#REPLACE_IMAGE#$vm_dir/disk.img#g" \ -e "s/REPLACE_BOOT_MAC/${mac_array[i]}/g" \ -e "s/REPLACE_NET_INSTALL/install/g" \ - -e "s/REPLACE_NET_IAAS/external_nat/g" \ + -e "s/REPLACE_NET_IAAS/$NET_IAAS/g" \ "$vm_template_file" \ > $vm_dir/libvirt.xml diff --git a/deploy/launch.sh b/deploy/launch.sh index 98d9e4d6..2b32c337 100755 --- a/deploy/launch.sh +++ b/deploy/launch.sh @@ -15,6 +15,7 @@ mkdir -p $WORK_DIR/script export DEPLOY_FIRST_TIME=${DEPLOY_FIRST_TIME:-"true"} export DEPLOY_RECOVERY=${DEPLOY_RECOVERY:-"false"} +source ${COMPASS_DIR}/deploy/conf/base.conf source ${COMPASS_DIR}/deploy/prepare.sh prepare_python_env source ${COMPASS_DIR}/util/log.sh @@ -24,7 +25,6 @@ check_input_para source $(process_default_para $*) || exit 1 source ${COMPASS_DIR}/deploy/conf/${FLAVOR}.conf source ${COMPASS_DIR}/deploy/conf/${TYPE}.conf -source ${COMPASS_DIR}/deploy/conf/base.conf source ${COMPASS_DIR}/deploy/conf/compass.conf source ${COMPASS_DIR}/deploy/network.sh source ${COMPASS_DIR}/deploy/host_${TYPE}.sh diff --git a/deploy/network.sh b/deploy/network.sh index 698771b3..eea62277 100755 --- a/deploy/network.sh +++ b/deploy/network.sh @@ -76,9 +76,9 @@ function setup_bridge_external() sudo virsh net-destroy external sudo virsh net-undefine external - #save_network_info + save_network_info sed -e "s/REPLACE_NAME/external/g" \ - -e "s/REPLACE_OVS/br-external_nat/g" \ + -e "s/REPLACE_OVS/br-external/g" \ $COMPASS_DIR/deploy/template/network/bridge_ovs.xml \ > $WORK_DIR/network/external.xml @@ -86,14 +86,12 @@ function setup_bridge_external() sudo virsh net-start external sudo virsh net-autostart external - python $COMPASS_DIR/deploy/setup_vnic.py } function recover_bridge_external() { sudo virsh net-start external - python $COMPASS_DIR/deploy/setup_vnic.py } function setup_nat_net() { @@ -128,7 +126,12 @@ function recover_nat_net() { function setup_virtual_net() { setup_nat_net install $INSTALL_GW $INSTALL_NETMASK - setup_nat_net external_nat $EXT_NAT_GW $EXT_NAT_MASK $EXT_NAT_IP_START $EXT_NAT_IP_END + + if [[ "$NAT_EXTERNAL" == "false" ]]; then + setup_bridge_external + else + setup_nat_net external_nat $EXT_NAT_GW $EXT_NAT_MASK $EXT_NAT_IP_START $EXT_NAT_IP_END + fi } function recover_virtual_net() { diff --git a/deploy/template/vm/host-aarch64.xml b/deploy/template/vm/host-aarch64.xml index 7f32a198..69202fd2 100644 --- a/deploy/template/vm/host-aarch64.xml +++ b/deploy/template/vm/host-aarch64.xml @@ -9,9 +9,6 @@ <boot dev='hd'/> <boot dev='network'/> </os> - <features> - <gic version='2'/> - </features> <cpu mode='host-passthrough'/> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> diff --git a/docs/release/installation/k8s-deploy-arm.rst b/docs/release/installation/k8s-deploy-arm.rst new file mode 100644 index 00000000..b5b54c20 --- /dev/null +++ b/docs/release/installation/k8s-deploy-arm.rst @@ -0,0 +1,106 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International Licence. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) by Yibo Cai (Arm) + +Validated platform +================== + +================ ========= ================ ======== + Jump server Node +--------------------------- -------------------------- +distro libvirt distro k8s +================ ========= ================ ======== +ubuntu 16.04.3 1.3.1 centos7 1708 1.7.5 +================ ========= ================ ======== + +Prepare jump server +=================== +This document assumes you are using a baremetal Arm server as Compass4NFV jump server. It's possible to deploy jump server inside a virtual machine, this case is not covered here. + +#. Install Ubuntu 16.04.3 aarch64 on jump server. + +#. Install required packages. + + .. code-block:: bash + + $ sudo apt install docker.io libvirt-bin virt-manager qemu qemu-efi + +#. Disable DHCP of default libvirt network. + + Libvirt creates a default network at intallation, which enables DHCP and occupies port 67. It conflicts with compass-cobbler container. + + .. code-block:: bash + + $ sudo virsh net-edit default + + .. code-block:: xml + + <!-- remove below lines and save/quit -> + <dhcp> + <range start='192.168.122.2' end='192.168.122.254'/> + </dhcp> + + .. code-block:: bash + + $ sudo virsh net-destroy default + $ sudo virsh net-start default + +#. Make sure ports 67, 69, 80, 443 are free. + + Compass-cobber requires ports 67, 69 to provide DHCP and TFTP services. Compass-deck provides HTTP and HTTPS through ports 80, 443. All these ports should be free before deployment. + +#. Tear down apparmor service. + + .. code-block:: bash + + $ sudo service apparmor teardown + +#. Enable password-less sudo for current user (optional). + + +Build Arm tarball +================= + +Clone Compass4NFV code. Run below command to build deployment tarball for Arm. + +.. code-block:: bash + + $ COMPASS_ISO_REPO='http://people.linaro.org/~yibo.cai/compass' ./build.sh + +It downloads and archives Ubuntu/CentOS installation ISO and Compass core docker images for later deployment. + + +Deploy K8s in VM +================ +This section introduces the steps to deploy K8s cluster in virtual machines running on jump server. Two VM nodes will be created, one master and one minion, with flannel networking. + +Clear old Compass core +---------------------- + +Compass core consists of five containers which are responsible for deploying K8s clusters. + +- *compass-deck*: provides API service and web UI +- *compass-tasks*: deploy K8s to nodes +- *compass-cobbler*: deploy OS to nodes +- *compass-db*: mysql service +- *compass-mq*: rabbitmq service + +Run below command to remove running Compass containers for a clean deployment. + +.. code-block:: bash + + $ docker rm -f `docker ps | grep compass | cut -f1 -d' '` + +Deploy OS and K8s +----------------- +To deploy OS and K8s on two virtual nodes, run: + +.. code-block:: bash + + $ ADAPTER_OS_PATTERN='(?i)CentOS-7.*arm.*' \ + OS_VERSION=centos7 \ + KUBERNETES_VERSION=v1.7.5 \ + DHA=${PWD}/deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml \ + NETWORK=${PWD}/deploy/conf/vm_environment/network.yml \ + VIRT_NUMBER=2 VIRT_CPUS=4 VIRT_MEM=8192 VIRT_DISK=50G \ + ./deploy.sh diff --git a/plugins/barometer/plugin.desc b/plugins/barometer/plugin.desc index 896d6f27..3d976c2e 100644 --- a/plugins/barometer/plugin.desc +++ b/plugins/barometer/plugin.desc @@ -15,6 +15,7 @@ plugin: maintainers: - john.hinman@intel.com + - ramamani.yeleswarapu@intel.com # host os type: ubuntu/centos os_version: ubuntu @@ -50,3 +51,12 @@ plugin: inventory: - compute + - role: influxdb + phrase: post_openstack + inventory: + - controller + + - role: grafana + phrase: post_openstack + inventory: + - controller diff --git a/plugins/barometer/roles/collectd/files/install_docker.sh b/plugins/barometer/roles/collectd/files/install_docker.sh new file mode 100644 index 00000000..f0c08bae --- /dev/null +++ b/plugins/barometer/roles/collectd/files/install_docker.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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 +# ############################################################################# + +apt-get update +apt-get install -y apt-transport-https ca-certificates curl software-properties-common +sleep 3 + +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +apt-key fingerprint 0EBFCD88 + +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + +apt-get update +sleep 3 + +apt-get install -y docker-ce +sleep 5 diff --git a/plugins/barometer/roles/collectd/tasks/collectd.yml b/plugins/barometer/roles/collectd/tasks/collectd.yml index 48e15989..0f6a6266 100644 --- a/plugins/barometer/roles/collectd/tasks/collectd.yml +++ b/plugins/barometer/roles/collectd/tasks/collectd.yml @@ -1,5 +1,5 @@ # ############################################################################# -# Copyright (c) 2017 Intel Corp. +# Copyright (c) 2017-18 Intel Corp. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -7,120 +7,173 @@ # http://www.apache.org/licenses/LICENSE-2.0 # ############################################################################# --- -- name: install dependencies - apt: - name: "{{ item }}" - state: present - with_items: - - libltdl7 - - init-system-helpers - - mcelog - - rrdtool - - libc6 - - librrd4 - - libvirt-bin - - libvirt-dev - - gcc - - git - - python3-pip - -- name: create workspace directory - file: - path: "{{ workspace }}" - state: directory - mode: 0755 - -- name: download, unarchive and install collectd packages +- name: copy install_docker script + remote_user: root + copy: + src: install_docker.sh + dest: /opt/install_docker.sh + mode: 0777 + +- name: install docker + command: su -s /bin/sh -c "/opt/install_docker.sh" + +- name: create collectd_sample_configs dir + remote_user: root shell: | - cd "{{ workspace }}"; - wget "{{ artifacts_collectd_pkg }}"; - su -s /bin/sh -c \ - "tar xzf collectd_pkg.tar.gz -C {{ workspace }} --strip-components 1"; - apt-get install ./libcollectd*.deb -y; - apt-get install ./collectd*.deb -y - -- name: make stack dir - file: - path: /opt/stack - state: directory - mode: 0755 - -- name: check plugin dir exists - stat: - path: /opt/stack/collectd-ceilometer-plugin - register: stat_result + rm -rf /root/collectd_sample_configs; + mkdir /root/collectd_sample_configs; -- name: fetch collectd plugin source code +- name: docker pull opnfv/barometer-collectd + remote_user: root shell: | - cd /opt/stack; - git clone https://github.com/openstack/collectd-ceilometer-plugin.git; - cd /opt/stack/collectd-ceilometer-plugin; - git checkout stable/pike - when: stat_result.stat.exists == False + docker pull opnfv/barometer-collectd; + sleep 5 - name: configure logfile conf + remote_user: root template: src: logfile.conf.j2 - dest: /etc/collectd/collectd.conf.d/logfile.conf + dest: /root/collectd_sample_configs/logfile.conf + +- name: configure csv conf + remote_user: root + template: + src: csv.conf.j2 + dest: /root/collectd_sample_configs/csv.conf + +- name: check if vswitchd on host + shell: ps -ef | grep vswitchd | grep -v grep > /dev/null + register: vswitchd_result + ignore_errors: "true" + +- name: check if db.sock exists + stat: + path: /var/run/openvswitch/db.sock + register: dbsock_result + ignore_errors: "true" + +- name: configure ovs_stats conf and ovs_events conf + remote_user: root + template: + src: "{{ item }}.conf.j2" + dest: "/root/collectd_sample_configs/{{ item }}.conf" + when: vswitchd_result|succeeded and dbsock_result|succeeded + with_items: + - ovs_stats + - ovs_events + +- name: check if mcelog running on host + shell: ps -ef | grep mcelog | grep -v grep > /dev/null + register: mcelog_running + ignore_errors: "true" + +- name: check if mcelog exists + shell: which mcelog > /dev/null + register: mcelog_exists + ignore_errors: "true" + +- name: check if mcelog-client exists + stat: + path: /var/run/mcelog-client + register: mcelog_client_exists + ignore_errors: "true" + +- name: configure mcelog conf + remote_user: root + template: + src: mcelog.conf.j2 + dest: /root/collectd_sample_configs/mcelog.conf + when: mcelog_running|succeeded and mcelog_exists|succeeded and mcelog_client_exists|succeeded - name: configure collectd-aodh plugin conf + remote_user: root template: src: collectd-aodh.conf.j2 - dest: /etc/collectd/collectd.conf.d/collectd-aodh-plugin.conf + dest: /root/collectd_sample_configs/collectd-aodh-plugin.conf - name: configure collectd-gnocchi plugin conf + remote_user: root template: src: collectd-gnocchi.conf.j2 - dest: /etc/collectd/collectd.conf.d/collectd-gnocchi-plugin.conf + dest: /root/collectd_sample_configs/collectd-gnocchi-plugin.conf + +- name: check if hugepages folders exist on host + stat: + path: "{{ item }}" + register: hugepages_result + ignore_errors: "true" + with_items: + /sys/devices/system/node + /sys/kernel/mm/hugepages - name: configure hugepages conf + remote_user: root template: src: hugepages.conf.j2 - dest: /etc/collectd/collectd.conf.d/hugepages.conf + dest: /root/collectd_sample_configs/hugepages.conf + when: hugepages_result|succeeded -- name: configure mcelog conf +- name: check if rdt on host + shell: | + grep -q cqm* "/proc/cpuinfo" + register: rdt_result + ignore_errors: "true" + +- name: configure rdt conf + remote_user: root template: - src: mcelog.conf.j2 - dest: /etc/collectd/collectd.conf.d/mcelog.conf + src: rdt.conf.j2 + dest: /root/collectd_sample_configs/rdt.conf + when: rdt_result|succeeded + +- name: load msr kernel module + modprobe: + name: msr + state: present + +- name: check if libvirtd on host + shell: ps -ef | grep libvirtd | grep -v grep > /dev/null + register: libvirt_result + ignore_errors: "true" -- name: configure ovs_stats conf +- name: configure virt conf + remote_user: root template: - src: ovs_stats.conf.j2 - dest: /etc/collectd/collectd.conf.d/ovs_stats.conf + src: virt.conf.j2 + dest: /root/collectd_sample_configs/virt.conf + when: libvirt_result|succeeded -- name: configure ovs_events conf +- name: configure virt conf extra stats when rdt is present + remote_user: root + shell: | + sed -i '/ExtraStats/s/^#//g' /root/collectd_sample_configs/virt.conf + when: rdt_result|failed and libvirt_result|succeeded + +- name: configure rrdtool conf template: - src: ovs_events.conf.j2 - dest: /etc/collectd/collectd.conf.d/ovs_events.conf - -- name: configure collectd conf - lineinfile: - dest: /etc/collectd/collectd.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' - with_items: - - regexp: '#LoadPlugin numa' - line: 'LoadPlugin numa' - - regexp: '#LoadPlugin virt' - line: 'LoadPlugin virt' - - regexp: '#LoadPlugin cpufreq' - line: 'LoadPlugin cpufreq' - - regexp: '#LoadPlugin cpusleep' - line: 'LoadPlugin cpusleep' + src: rrdtool.conf.j2 + dest: /root/collectd_sample_configs/rrdtool.conf -- name: configure mcelog conf - lineinfile: - dest: /etc/mcelog/mcelog.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' - with_items: - - regexp: '#socket-path = /var/run/mcelog-client' - line: 'socket-path = /var/run/mcelog-client' +- name: configure intel_pmu conf + remote_user: root + template: + src: intel_pmu.conf.j2 + dest: /root/collectd_sample_configs/intel_pmu.conf + +- name: configure network conf + remote_user: root + template: + src: network.conf.j2 + dest: /root/collectd_sample_configs/network.conf + +- name: configure default plugins + remote_user: root + template: + src: default_plugins.conf.j2 + dest: /root/collectd_sample_configs/default_plugins.conf -- name: install gnocchiclient, aodhclient, set ovs manager, restart mcelog, collectd +- name: run barometer collectd container + remote_user: root shell: | - pip install gnocchiclient; - pip install aodhclient; - ovs-vsctl set-manager ptcp:6640:127.0.0.1; - systemctl restart mcelog; - systemctl restart collectd + docker run -dti --net=host -v /root/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \ + -v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer-collectd /run_collectd.sh diff --git a/plugins/barometer/roles/collectd/tasks/main.yml b/plugins/barometer/roles/collectd/tasks/main.yml index d33823ed..88602ea2 100644 --- a/plugins/barometer/roles/collectd/tasks/main.yml +++ b/plugins/barometer/roles/collectd/tasks/main.yml @@ -1,5 +1,5 @@ # ############################################################################# -# Copyright (c) 2017 Intel Corp. +# Copyright (c) 2017-18 Intel Corp. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 diff --git a/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 b/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 index 301ba25a..b7fcfb60 100644 --- a/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 @@ -3,7 +3,7 @@ </LoadPlugin> <Plugin python> - ModulePath "/opt/stack/collectd-ceilometer-plugin" + ModulePath "/src/barometer/src/collectd-openstack-plugins/collectd-openstack-plugins" LogTraces true Interactive false Import "collectd_ceilometer.aodh.plugin" diff --git a/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 b/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 index b54e9d5a..79e2872e 100644 --- a/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 @@ -3,7 +3,7 @@ </LoadPlugin> <Plugin python> - ModulePath "/opt/stack/collectd-ceilometer-plugin" + ModulePath "/src/barometer/src/collectd-openstack-plugins/collectd-openstack-plugins" LogTraces true Interactive false Import "collectd_ceilometer.gnocchi.plugin" diff --git a/plugins/barometer/roles/collectd/templates/csv.conf.j2 b/plugins/barometer/roles/collectd/templates/csv.conf.j2 new file mode 100644 index 00000000..06abf4ba --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/csv.conf.j2 @@ -0,0 +1,20 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +LoadPlugin csv + +<Plugin csv> + DataDir "/tmp/collectd/csv" + StoreRates false +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/default_plugins.conf.j2 b/plugins/barometer/roles/collectd/templates/default_plugins.conf.j2 new file mode 100644 index 00000000..a4d632a6 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/default_plugins.conf.j2 @@ -0,0 +1,31 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +Hostname "{{ inventory_hostname }}" + +LoadPlugin cpufreq +LoadPlugin disk +LoadPlugin ethstat +LoadPlugin ipc +LoadPlugin ipmi +LoadPlugin load +LoadPlugin memory +LoadPlugin numa +LoadPlugin processes +LoadPlugin df +LoadPlugin turbostat +LoadPlugin uptime +LoadPlugin contextswitch +LoadPlugin irq +LoadPlugin swap + diff --git a/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 b/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 index cefcc25d..9378c1f2 100644 --- a/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 @@ -1,3 +1,16 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. LoadPlugin hugepages <Plugin hugepages> diff --git a/plugins/barometer/roles/collectd/templates/intel_pmu.conf.j2 b/plugins/barometer/roles/collectd/templates/intel_pmu.conf.j2 new file mode 100644 index 00000000..caba8825 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/intel_pmu.conf.j2 @@ -0,0 +1,23 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +LoadPlugin intel_pmu + +<Plugin intel_pmu> + ReportHardwareCacheEvents true + ReportKernelPMUEvents true + ReportSoftwareEvents true +# EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json" +# HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/logfile.conf.j2 b/plugins/barometer/roles/collectd/templates/logfile.conf.j2 index 77d86a99..bf53ae8f 100644 --- a/plugins/barometer/roles/collectd/templates/logfile.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/logfile.conf.j2 @@ -1,3 +1,16 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. LoadPlugin "logfile" <Plugin "logfile"> diff --git a/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 b/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 index 3a043ec8..f9ae8aa0 100644 --- a/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 @@ -1,9 +1,25 @@ -LoadPlugin mcelog +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +<LoadPlugin mcelog> + Interval 1 +</LoadPlugin> <Plugin mcelog> <Memory> - McelogClientSocket "/var/run/mcelog-client" - PersistentNotification false + McelogClientSocket "/var/run/mcelog-client" + PersistentNotification false </Memory> +## McelogLogfile "/var/log/mcelog" </Plugin> diff --git a/plugins/barometer/roles/collectd/templates/network.conf.j2 b/plugins/barometer/roles/collectd/templates/network.conf.j2 new file mode 100644 index 00000000..e9343e66 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/network.conf.j2 @@ -0,0 +1,19 @@ +# Copyright 2017-18 OPNFV, Intel Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +LoadPlugin network + +<Plugin network> + Server "{{ internal_vip.ip }}" "25826" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 b/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 index d72e2004..2d71fa18 100644 --- a/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 @@ -1,8 +1,23 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. <LoadPlugin ovs_events> Interval 1 </LoadPlugin> + <Plugin "ovs_events"> Port 6640 + Address "127.0.0.1" Socket "/var/run/openvswitch/db.sock" Interfaces "br0" "veth0" SendNotification false diff --git a/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 b/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 index 945c4e92..b7e4d5c8 100644 --- a/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 @@ -1,6 +1,20 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License <LoadPlugin ovs_stats> Interval 1 </LoadPlugin> + <Plugin ovs_stats> Port "6640" Address "127.0.0.1" diff --git a/plugins/barometer/roles/collectd/templates/rdt.conf.j2 b/plugins/barometer/roles/collectd/templates/rdt.conf.j2 new file mode 100644 index 00000000..96d5eb34 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/rdt.conf.j2 @@ -0,0 +1,21 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +<LoadPlugin intel_rdt> + Interval 1 +</LoadPlugin> + +<Plugin "intel_rdt"> + Cores "" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/rrdtool.conf.j2 b/plugins/barometer/roles/collectd/templates/rrdtool.conf.j2 new file mode 100644 index 00000000..50bd6603 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/rrdtool.conf.j2 @@ -0,0 +1,21 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +Loadplugin rrdtool + +<Plugin rrdtool> + DataDir "/tmp/collectd/rrd" + CacheFlush 120 + WritesPerSecond 50 +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/virt.conf.j2 b/plugins/barometer/roles/collectd/templates/virt.conf.j2 new file mode 100644 index 00000000..c6161237 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/virt.conf.j2 @@ -0,0 +1,32 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LoadPlugin virt + +<Plugin virt> +# Connection "xen:///" + RefreshInterval 60 +# Domain "name" +# BlockDevice "name:device" +# BlockDeviceFormat target +# BlockDeviceFormatBasename false +# InterfaceDevice "name:device" +# IgnoreSelected false +# HostnameFormat name +# InterfaceFormat name +# PluginInstanceFormat name +# Instances 1 +# ExtraStats "cpu_util disk disk_err domain_state fs_info job_stats_background pcpu perf vcpupin" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/vars/main.yml b/plugins/barometer/roles/collectd/vars/main.yml index 9fc0687d..b3a0b3b7 100644 --- a/plugins/barometer/roles/collectd/vars/main.yml +++ b/plugins/barometer/roles/collectd/vars/main.yml @@ -1,5 +1,5 @@ # ############################################################################# -# Copyright (c) 2017 Intel Corp. +# Copyright (c) 2017-18 Intel Corp. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -8,9 +8,3 @@ # ############################################################################# --- openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml - -workspace: /tmp/plugin - -artifacts_collectd_pkg: http://artifacts.opnfv.org/compass4nfv/package/master/collectd_pkg.tar.gz - -collectd_ver: 5.8.0.23.g576797d-1~xenial_amd64.deb diff --git a/plugins/barometer/roles/grafana/files/configure_grafana.sh b/plugins/barometer/roles/grafana/files/configure_grafana.sh new file mode 100644 index 00000000..39fcc82b --- /dev/null +++ b/plugins/barometer/roles/grafana/files/configure_grafana.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2017-2018 OPNFV, Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "${influxdb_host}" ] +then + influxdb_host=localhost +fi + + +while [ -z "$RETURN" ] +do + sleep 1 + RETURN=$(curl -u admin:admin -X POST -H 'content-type: application/json'\ + http://127.0.0.1:3000/api/datasources -d \ + '{"name":"collectd","type":"influxdb","url":"http://'"${influxdb_host}"':8086","access":"proxy","isDefault":true,"database":"collectd","user":"admin","password":"admin","basicAuth":false}') +done + +FILES=/opt/barometer/docker/barometer-grafana/dashboards/*.json +for f in $FILES +do + curl -u admin:admin -X POST -H 'content-type: application/json' \ + http://127.0.0.1:3000/api/dashboards/db -d @$f ; +done diff --git a/plugins/barometer/roles/grafana/files/install_grafana.sh b/plugins/barometer/roles/grafana/files/install_grafana.sh new file mode 100644 index 00000000..0b9f4ec5 --- /dev/null +++ b/plugins/barometer/roles/grafana/files/install_grafana.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2017-2018 OPNFV, Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +echo "deb https://packagecloud.io/grafana/stable/debian/ wheezy main" | tee /etc/apt/sources.list.d/grafana.list + +curl https://packagecloud.io/gpg.key | apt-key add - + +apt-get update + +apt-get install -y grafana + +sleep 5 + +service grafana-server start diff --git a/plugins/barometer/roles/grafana/tasks/grafana.yml b/plugins/barometer/roles/grafana/tasks/grafana.yml new file mode 100644 index 00000000..9c01920f --- /dev/null +++ b/plugins/barometer/roles/grafana/tasks/grafana.yml @@ -0,0 +1,34 @@ +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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: copy install_grafana script + remote_user: root + copy: + src: install_grafana.sh + dest: /opt/install_grafana.sh + mode: 0777 + +- name: install grafana + command: su -s /bin/sh -c "/opt/install_grafana.sh" + +- name: fetch barometer source code + remote_user: root + shell: | + cd /opt && rm -rf barometer; + git clone https://github.com/opnfv/barometer.git; + +- name: copy configure_grafana script + remote_user: root + copy: + src: configure_grafana.sh + dest: /opt/configure_grafana.sh + mode: 0777 + +- name: configure grafana + command: su -s /bin/sh -c "/opt/configure_grafana.sh" diff --git a/plugins/barometer/roles/grafana/tasks/main.yml b/plugins/barometer/roles/grafana/tasks/main.yml new file mode 100644 index 00000000..50d15b49 --- /dev/null +++ b/plugins/barometer/roles/grafana/tasks/main.yml @@ -0,0 +1,11 @@ +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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: grafana.yml + when: barometer is defined and barometer == "Enable" diff --git a/plugins/barometer/roles/influxdb/files/install_influxdb.sh b/plugins/barometer/roles/influxdb/files/install_influxdb.sh new file mode 100644 index 00000000..7fd1e046 --- /dev/null +++ b/plugins/barometer/roles/influxdb/files/install_influxdb.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Copyright 2017-2018 OPNFV, Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +curl -sL https://repos.influxdata.com/influxdb.key | apt-key add - + +source /etc/lsb-release + +echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list + +apt-get update + +apt-get install -y influxdb + +sleep 5 + +# install types.db +mkdir /opt/collectd && mkdir /opt/collectd/share && mkdir /opt/collectd/share/collectd && cd /opt/collectd/share/collectd + +wget https://raw.githubusercontent.com/collectd/collectd/master/src/types.db && cd - diff --git a/plugins/barometer/roles/influxdb/tasks/influxdb.yml b/plugins/barometer/roles/influxdb/tasks/influxdb.yml new file mode 100644 index 00000000..8e1f4ca1 --- /dev/null +++ b/plugins/barometer/roles/influxdb/tasks/influxdb.yml @@ -0,0 +1,28 @@ +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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: copy install_influxdb script + remote_user: root + copy: + src: install_influxdb.sh + dest: /opt/install_influxdb.sh + mode: 0777 + +- name: install influxdb + command: su -s /bin/sh -c "/opt/install_influxdb.sh" + +- name: configure /etc/influxdb/influxdb.conf + remote_user: root + template: + src: influxdb.conf.j2 + dest: /etc/influxdb/influxdb.conf + +- name: start influxdb service + remote_user: root + shell: service influxdb start diff --git a/plugins/barometer/roles/influxdb/tasks/main.yml b/plugins/barometer/roles/influxdb/tasks/main.yml new file mode 100644 index 00000000..b6da783b --- /dev/null +++ b/plugins/barometer/roles/influxdb/tasks/main.yml @@ -0,0 +1,11 @@ +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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: influxdb.yml + when: barometer is defined and barometer == "Enable" diff --git a/plugins/barometer/roles/influxdb/templates/influxdb.conf.j2 b/plugins/barometer/roles/influxdb/templates/influxdb.conf.j2 new file mode 100644 index 00000000..d35e93a7 --- /dev/null +++ b/plugins/barometer/roles/influxdb/templates/influxdb.conf.j2 @@ -0,0 +1,478 @@ +### Welcome to the InfluxDB configuration file. + +# The values in this file override the default values used by the system if +# a config option is not specified. The commented out lines are the configuration +# field and the default value used. Uncommenting a line and changing the value +# will change the value used at runtime when the process is restarted. + +# Once every 24 hours InfluxDB will report usage data to usage.influxdata.com +# The data includes a random ID, os, arch, version, the number of series and other +# usage data. No data from user databases is ever transmitted. +# Change this option to true to disable reporting. +# reporting-disabled = false + +# Bind address to use for the RPC service for backup and restore. +# bind-address = "127.0.0.1:8088" + +### +### [meta] +### +### Controls the parameters for the Raft consensus group that stores metadata +### about the InfluxDB cluster. +### + +[meta] + # Where the metadata/raft database is stored + dir = "/var/lib/influxdb/meta" + + # Automatically create a default retention policy when creating a database. + # retention-autocreate = true + + # If log messages are printed for the meta service + # logging-enabled = true + +### +### [data] +### +### Controls where the actual shard data for InfluxDB lives and how it is +### flushed from the WAL. "dir" may need to be changed to a suitable place +### for your system, but the WAL settings are an advanced configuration. The +### defaults should work for most systems. +### + +[data] + # The directory where the TSM storage engine stores TSM files. + dir = "/var/lib/influxdb/data" + + # The directory where the TSM storage engine stores WAL files. + wal-dir = "/var/lib/influxdb/wal" + + # The amount of time that a write will wait before fsyncing. A duration + # greater than 0 can be used to batch up multiple fsync calls. This is useful for slower + # disks or when WAL write contention is seen. A value of 0s fsyncs every write to the WAL. + # Values in the range of 0-100ms are recommended for non-SSD disks. + # wal-fsync-delay = "0s" + + + # The type of shard index to use for new shards. The default is an in-memory index that is + # recreated at startup. A value of "tsi1" will use a disk based index that supports higher + # cardinality datasets. + # index-version = "inmem" + + # Trace logging provides more verbose output around the tsm engine. Turning + # this on can provide more useful output for debugging tsm engine issues. + # trace-logging-enabled = false + + # Whether queries should be logged before execution. Very useful for troubleshooting, but will + # log any sensitive data contained within a query. + # query-log-enabled = true + + # Settings for the TSM engine + + # CacheMaxMemorySize is the maximum size a shard's cache can + # reach before it starts rejecting writes. + # Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k). + # Vaues without a size suffix are in bytes. + # cache-max-memory-size = "1g" + + # CacheSnapshotMemorySize is the size at which the engine will + # snapshot the cache and write it to a TSM file, freeing up memory + # Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k). + # Values without a size suffix are in bytes. + # cache-snapshot-memory-size = "25m" + + # CacheSnapshotWriteColdDuration is the length of time at + # which the engine will snapshot the cache and write it to + # a new TSM file if the shard hasn't received writes or deletes + # cache-snapshot-write-cold-duration = "10m" + + # CompactFullWriteColdDuration is the duration at which the engine + # will compact all TSM files in a shard if it hasn't received a + # write or delete + # compact-full-write-cold-duration = "4h" + + # The maximum number of concurrent full and level compactions that can run at one time. A + # value of 0 results in 50% of runtime.GOMAXPROCS(0) used at runtime. Any number greater + # than 0 limits compactions to that value. This setting does not apply + # to cache snapshotting. + # max-concurrent-compactions = 0 + + # The maximum series allowed per database before writes are dropped. This limit can prevent + # high cardinality issues at the database level. This limit can be disabled by setting it to + # 0. + # max-series-per-database = 1000000 + + # The maximum number of tag values per tag that are allowed before writes are dropped. This limit + # can prevent high cardinality tag values from being written to a measurement. This limit can be + # disabled by setting it to 0. + # max-values-per-tag = 100000 + +### +### [coordinator] +### +### Controls the clustering service configuration. +### + +[coordinator] + # The default time a write request will wait until a "timeout" error is returned to the caller. + # write-timeout = "10s" + + # The maximum number of concurrent queries allowed to be executing at one time. If a query is + # executed and exceeds this limit, an error is returned to the caller. This limit can be disabled + # by setting it to 0. + # max-concurrent-queries = 0 + + # The maximum time a query will is allowed to execute before being killed by the system. This limit + # can help prevent run away queries. Setting the value to 0 disables the limit. + # query-timeout = "0s" + + # The time threshold when a query will be logged as a slow query. This limit can be set to help + # discover slow or resource intensive queries. Setting the value to 0 disables the slow query logging. + # log-queries-after = "0s" + + # The maximum number of points a SELECT can process. A value of 0 will make + # the maximum point count unlimited. This will only be checked every second so queries will not + # be aborted immediately when hitting the limit. + # max-select-point = 0 + + # The maximum number of series a SELECT can run. A value of 0 will make the maximum series + # count unlimited. + # max-select-series = 0 + + # The maxium number of group by time bucket a SELECT can create. A value of zero will max the maximum + # number of buckets unlimited. + # max-select-buckets = 0 + +### +### [retention] +### +### Controls the enforcement of retention policies for evicting old data. +### + +[retention] + # Determines whether retention policy enforcement enabled. + # enabled = true + + # The interval of time when retention policy enforcement checks run. + # check-interval = "30m" + +### +### [shard-precreation] +### +### Controls the precreation of shards, so they are available before data arrives. +### Only shards that, after creation, will have both a start- and end-time in the +### future, will ever be created. Shards are never precreated that would be wholly +### or partially in the past. + +[shard-precreation] + # Determines whether shard pre-creation service is enabled. + # enabled = true + + # The interval of time when the check to pre-create new shards runs. + # check-interval = "10m" + + # The default period ahead of the endtime of a shard group that its successor + # group is created. + # advance-period = "30m" + +### +### Controls the system self-monitoring, statistics and diagnostics. +### +### The internal database for monitoring data is created automatically if +### if it does not already exist. The target retention within this database +### is called 'monitor' and is also created with a retention period of 7 days +### and a replication factor of 1, if it does not exist. In all cases the +### this retention policy is configured as the default for the database. + +[monitor] + # Whether to record statistics internally. + # store-enabled = true + + # The destination database for recorded statistics + # store-database = "_internal" + + # The interval at which to record statistics + # store-interval = "10s" + +### +### [http] +### +### Controls how the HTTP endpoints are configured. These are the primary +### mechanism for getting data into and out of InfluxDB. +### + +[http] + # Determines whether HTTP endpoint is enabled. + # enabled = true + + # The bind address used by the HTTP service. + # bind-address = ":8086" + + # Determines whether user authentication is enabled over HTTP/HTTPS. + # auth-enabled = false + + # The default realm sent back when issuing a basic auth challenge. + # realm = "InfluxDB" + + # Determines whether HTTP request logging is enabled. + # log-enabled = true + + # Determines whether detailed write logging is enabled. + # write-tracing = false + + # Determines whether the pprof endpoint is enabled. This endpoint is used for + # troubleshooting and monitoring. + # pprof-enabled = true + + # Determines whether HTTPS is enabled. + # https-enabled = false + + # The SSL certificate to use when HTTPS is enabled. + # https-certificate = "/etc/ssl/influxdb.pem" + + # Use a separate private key location. + # https-private-key = "" + + # The JWT auth shared secret to validate requests using JSON web tokens. + # shared-secret = "" + + # The default chunk size for result sets that should be chunked. + # max-row-limit = 0 + + # The maximum number of HTTP connections that may be open at once. New connections that + # would exceed this limit are dropped. Setting this value to 0 disables the limit. + # max-connection-limit = 0 + + # Enable http service over unix domain socket + # unix-socket-enabled = false + + # The path of the unix domain socket. + # bind-socket = "/var/run/influxdb.sock" + + # The maximum size of a client request body, in bytes. Setting this value to 0 disables the limit. + # max-body-size = 25000000 + + +### +### [ifql] +### +### Configures the ifql RPC API. +### + +[ifql] + # Determines whether the RPC service is enabled. + # enabled = true + + # Determines whether additional logging is enabled. + # log-enabled = true + + # The bind address used by the ifql RPC service. + # bind-address = ":8082" + + +### +### [subscriber] +### +### Controls the subscriptions, which can be used to fork a copy of all data +### received by the InfluxDB host. +### + +[subscriber] + # Determines whether the subscriber service is enabled. + # enabled = true + + # The default timeout for HTTP writes to subscribers. + # http-timeout = "30s" + + # Allows insecure HTTPS connections to subscribers. This is useful when testing with self- + # signed certificates. + # insecure-skip-verify = false + + # The path to the PEM encoded CA certs file. If the empty string, the default system certs will be used + # ca-certs = "" + + # The number of writer goroutines processing the write channel. + # write-concurrency = 40 + + # The number of in-flight writes buffered in the write channel. + # write-buffer-size = 1000 + + +### +### [[graphite]] +### +### Controls one or many listeners for Graphite data. +### + +[[graphite]] + # Determines whether the graphite endpoint is enabled. + # enabled = false + # database = "graphite" + # retention-policy = "" + # bind-address = ":2003" + # protocol = "tcp" + # consistency-level = "one" + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Batching + # will buffer points in memory if you have many coming in. + + # Flush if this many points get buffered + # batch-size = 5000 + + # number of batches that may be pending in memory + # batch-pending = 10 + + # Flush at least this often even if we haven't hit buffer limit + # batch-timeout = "1s" + + # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. + # udp-read-buffer = 0 + + ### This string joins multiple matching 'measurement' values providing more control over the final measurement name. + # separator = "." + + ### Default tags that will be added to all metrics. These can be overridden at the template level + ### or by tags extracted from metric + # tags = ["region=us-east", "zone=1c"] + + ### Each template line requires a template pattern. It can have an optional + ### filter before the template and separated by spaces. It can also have optional extra + ### tags following the template. Multiple tags should be separated by commas and no spaces + ### similar to the line protocol format. There can be only one default template. + # templates = [ + # "*.app env.service.resource.measurement", + # # Default template + # "server.*", + # ] + +### +### [collectd] +### +### Controls one or many listeners for collectd data. +### + +[[collectd]] + enabled = true + bind-address = ":25826" # the bind address + database = "collectd" # Name of the database that will be written to + retention-policy = "" + batch-size = 5000 # will flush if this many points get buffered + batch-pending = 10 # number of batches that may be pending in memory + batch-timeout = "10s" + read-buffer = 0 # UDP read buffer size, 0 means to use OS default + typesdb = "/opt/collectd/share/collectd/types.db" + security-level = "none" # "none", "sign", or "encrypt" + + # enabled = false + # bind-address = ":25826" + # database = "collectd" + # retention-policy = "" + # + # The collectd service supports either scanning a directory for multiple types + # db files, or specifying a single db file. + # typesdb = "/usr/local/share/collectd" + # + # security-level = "none" + # auth-file = "/etc/collectd/auth_file" + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Batching + # will buffer points in memory if you have many coming in. + + # Flush if this many points get buffered + # batch-size = 5000 + + # Number of batches that may be pending in memory + # batch-pending = 10 + + # Flush at least this often even if we haven't hit buffer limit + # batch-timeout = "10s" + + # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. + # read-buffer = 0 + + # Multi-value plugins can be handled two ways. + # "split" will parse and store the multi-value plugin data into separate measurements + # "join" will parse and store the multi-value plugin as a single multi-value measurement. + # "split" is the default behavior for backward compatability with previous versions of influxdb. + # parse-multivalue-plugin = "split" +### +### [opentsdb] +### +### Controls one or many listeners for OpenTSDB data. +### + +[[opentsdb]] + # enabled = false + # bind-address = ":4242" + # database = "opentsdb" + # retention-policy = "" + # consistency-level = "one" + # tls-enabled = false + # certificate= "/etc/ssl/influxdb.pem" + + # Log an error for every malformed point. + # log-point-errors = true + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Only points + # metrics received over the telnet protocol undergo batching. + + # Flush if this many points get buffered + # batch-size = 1000 + + # Number of batches that may be pending in memory + # batch-pending = 5 + + # Flush at least this often even if we haven't hit buffer limit + # batch-timeout = "1s" + +### +### [[udp]] +### +### Controls the listeners for InfluxDB line protocol data via UDP. +### + +[[udp]] + # enabled = false + # bind-address = ":8089" + # database = "udp" + # retention-policy = "" + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Batching + # will buffer points in memory if you have many coming in. + + # Flush if this many points get buffered + # batch-size = 5000 + + # Number of batches that may be pending in memory + # batch-pending = 10 + + # Will flush at least this often even if we haven't hit buffer limit + # batch-timeout = "1s" + + # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. + # read-buffer = 0 + +### +### [continuous_queries] +### +### Controls how continuous queries are run within InfluxDB. +### + +[continuous_queries] + # Determines whether the continuous query service is enabled. + # enabled = true + + # Controls whether queries are logged when executed by the CQ service. + # log-enabled = true + + # Controls whether queries are logged to the self-monitoring data store. + # query-stats-enabled = false + + # interval for how often continuous queries will be checked if they need to run + # run-interval = "1s" + + diff --git a/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service index a6966d82..fe125ccf 100755 --- a/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service +++ b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service @@ -10,7 +10,7 @@ Type=simple WorkingDirectory=/opt/opendaylight PermissionsStartOnly=true ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.9.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.10.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main Restart=on-failure LimitNOFILE=65535 TimeoutStopSec=15 diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml index 39d0312f..5faa4a22 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml @@ -3,7 +3,7 @@ - name: configure odl l3 driver shell: | crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ - odl-router,metering; + odl-router_v2,metering,trunk; when: odl_l3_agent == "Enable" - name: configure opendaylight -> ml2 diff --git a/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg index 86b2baec..fa0e87f7 100755 --- a/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg +++ b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg @@ -37,9 +37,9 @@ # Comma separated list of features repositories to register by default # featuresRepositories = \ - mvn:org.opendaylight.integration/features-index/0.7.0/xml/features, \ - mvn:org.apache.karaf.features/framework/4.0.9/xml/features, \ - mvn:org.apache.karaf.features/standard/4.0.9/xml/features + mvn:org.opendaylight.integration/features-index/0.7.1/xml/features, \ + mvn:org.apache.karaf.features/framework/4.0.10/xml/features, \ + mvn:org.apache.karaf.features/standard/4.0.10/xml/features # # Comma separated list of features to install at startup diff --git a/plugins/odl_cluster/roles/setup-odl/vars/main.yml b/plugins/odl_cluster/roles/setup-odl/vars/main.yml index 45b6c5e1..05ad98f5 100755 --- a/plugins/odl_cluster/roles/setup-odl/vars/main.yml +++ b/plugins/odl_cluster/roles/setup-odl/vars/main.yml @@ -17,8 +17,8 @@ odl_username: admin odl_password: admin odl_api_port: 8181 -odl_pkg_url: karaf-0.7.0.tar.gz -odl_pkg_name: karaf-0.7.0.tar.gz +odl_pkg_url: karaf-0.7.1.tar.gz +odl_pkg_name: karaf-0.7.1.tar.gz odl_home: "/opt/opendaylight/" odl_base_features: - config @@ -48,7 +48,7 @@ odl_extra_features: odl_features: "{{ odl_base_features + odl_extra_features }}" -sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz +sdn_package: http://artifacts.opnfv.org/compass4nfv/package/master/sdn_package.tar.gz jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz jdk8_script_name: install_jdk8.tar diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service index a6966d82..fe125ccf 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service @@ -10,7 +10,7 @@ Type=simple WorkingDirectory=/opt/opendaylight PermissionsStartOnly=true ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.9.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.10.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main Restart=on-failure LimitNOFILE=65535 TimeoutStopSec=15 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf index acf2e2f4..6621a212 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf @@ -1,6 +1,6 @@ [DEFAULT] -service_plugins = odl-router,metering,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin +service_plugins = odl-router_v2,metering,trunk,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin [sfc] drivers = odl diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml index 684f314c..13b4c571 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml @@ -8,7 +8,7 @@ - name: install networking-odl pip: name: networking-odl - virtualenv: /openstack/venvs/neutron-15.1.4 + virtualenv: /openstack/venvs/neutron-{{ os_ver }} - name: configure vsctl for dhcp agent shell: | diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml index 82a26005..39b501db 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml @@ -70,7 +70,7 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig \ --datapath_type=system --bridge_mappings={{ contr_l2_mappings }} when: - inventory_hostname not in groups['nova_compute'] @@ -78,7 +78,7 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig \ --datapath_type=system --bridge_mappings={{ contr_l3_mappings }} when: - inventory_hostname not in groups['nova_compute'] @@ -86,14 +86,14 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig --datapath_type=system when: - inventory_hostname in groups['nova_compute'] - odl_l3_agent == "Disable" - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig --datapath_type=system --bridge_mappings={{ compu_l3_mappings }} when: - inventory_hostname in groups['nova_compute'] diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml index 7b699a35..0eacde6e 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml @@ -1,7 +1,7 @@ --- - name: copy download script - copy: - src: odl_pkg.sh + template: + src: odl_pkg.sh.j2 dest: /opt/odl_pkg.sh mode: 0777 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml index 40149346..0269bb37 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml @@ -8,12 +8,12 @@ - name: install networking-odl pip: name: networking-odl - virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify + virtualenv: /openstack/venvs/neutron-{{ os_ver }} - name: install networking-sfc pip: name: networking-sfc - virtualenv: /openstack/venvs/neutron-15.1.4 + virtualenv: /openstack/venvs/neutron-{{ os_ver }} when: odl_sfc == "Enable" - name: turn off neutron-server on control node diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml index d8bcf154..be45567a 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml @@ -3,7 +3,7 @@ - name: configure odl l3 driver shell: | crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ - odl-router,metering; + odl-router_v2,metering,trunk; when: odl_l3_agent == "Enable" - name: configure opendaylight -> ml2 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml index 0c11e36f..c4451ca2 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml @@ -2,7 +2,7 @@ - name: Perform a Neutron DB online upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade --expand @@ -11,7 +11,7 @@ - name: Perform a Neutron DB offline upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade --contract @@ -20,7 +20,7 @@ - name: SFC DB upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --subproject networking-sfc upgrade head become: "yes" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml index c43b6dcc..8fd1109f 100644 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml @@ -3,6 +3,5 @@ - name: upgrade networking-sfc pip: name: networking-sfc - extra_args: -U - virtualenv: /openstack/venvs/tacker-15.1.4 + virtualenv: /openstack/venvs/tacker-{{ os_ver }} when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 b/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 new file mode 100755 index 00000000..f8882b23 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 @@ -0,0 +1,19 @@ +#!/bin/bash + +rm -rf /home/networking +rm -rf /home/tmp + +mkdir -p /home/networking +mkdir -p /home/tmp + +cd /home/networking + +git clone https://github.com/openstack/networking-odl.git -b stable/{{ os_name }} +git clone https://github.com/openstack/networking-sfc.git -b stable/{{ os_name }} + +pip wheel /home/networking/networking-odl/ -w /home/tmp/ +pip wheel /home/networking/networking-sfc/ -w /home/tmp/ + +cp /home/tmp/networking* /var/www/repo/os-releases/{{ os_ver }}/ubuntu-16.04-x86_64/ + +sleep 30 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg index afb7e6b5..05f7a7cd 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg @@ -37,9 +37,9 @@ # Comma separated list of features repositories to register by default # featuresRepositories = \ - mvn:org.opendaylight.integration/features-index/0.7.0/xml/features, \ - mvn:org.apache.karaf.features/framework/4.0.9/xml/features, \ - mvn:org.apache.karaf.features/standard/4.0.9/xml/features + mvn:org.opendaylight.integration/features-index/0.7.1/xml/features, \ + mvn:org.apache.karaf.features/framework/4.0.10/xml/features, \ + mvn:org.apache.karaf.features/standard/4.0.10/xml/features # # Comma separated list of features to install at startup diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml index b3d71edb..014fc5b8 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml @@ -9,6 +9,9 @@ --- openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml +os_ver: 16.0.5 +os_name: pike + odl_username: admin odl_password: admin odl_api_port: 8181 @@ -18,8 +21,8 @@ sfc_plugins: src: sfc.conf dst: /opt/sfc.conf -odl_pkg_url: karaf-0.7.0.tar.gz -odl_pkg_name: karaf-0.7.0.tar.gz +odl_pkg_url: karaf-0.7.1.tar.gz +odl_pkg_name: karaf-0.7.1.tar.gz odl_home: "/opt/opendaylight/" odl_base_features: - config @@ -49,19 +52,9 @@ odl_extra_features: odl_features: "{{ odl_base_features + odl_extra_features }}" -sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz - -# yamllint disable rule:line-length -networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz -# yamllint enable rule:line-length +sdn_package: http://artifacts.opnfv.org/compass4nfv/package/master/sdn_package.tar.gz jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz jdk8_script_name: install_jdk8.tar common_packages_noarch: [] - -odl_pip: networking-odl-3.2.0 - -networking_odl_version: 4.0.0 - -networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch b/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch new file mode 100644 index 00000000..9e25214a --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch @@ -0,0 +1,90 @@ +diff --git a/defaults/main.yml b/defaults/main.yml +index fd6fc37..3ae4bce 100644 +--- a/defaults/main.yml ++++ b/defaults/main.yml +@@ -381,3 +381,9 @@ dragonflow_ex_peer_patch_port: patch-int + dragonflow_int_peer_patch_port: patch-ex + dragonflow_external_network_bridge: br-ex + dragonflow_publisher_bind_address: "*" ++ ++# Install Openvswitch without NSH support ++ovs_nsh_support: True ++# ++# # Set higher priority to mardim PPA when ovs_nsh_support is True ++ovs_nsh_apt_pinned_packages: [{ package: "*", release: "LP-PPA-mardim-mardim-ppa"}] +diff --git a/meta/main.yml b/meta/main.yml +index 418b4a9..7a6739a 100644 +--- a/meta/main.yml ++++ b/meta/main.yml +@@ -39,7 +39,10 @@ galaxy_info: + - openstack + dependencies: + - pip_install +- - apt_package_pinning ++ - role: apt_package_pinning ++ apt_pinned_packages: "{{ ovs_nsh_support | ternary(ovs_nsh_apt_pinned_packages, omit) }}" ++ when: ++ - ansible_pkg_mgr == 'apt' + - galera_client + - openstack_openrc + - role: etcd +diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml +index 59fd87f..1162a2b 100644 +--- a/tasks/neutron_pre_install.yml ++++ b/tasks/neutron_pre_install.yml +@@ -79,3 +79,12 @@ + mode: "0440" + owner: "root" + group: "root" ++ ++- name: add ovs-nsh repo ++ apt_repository: ++ repo: "ppa:mardim/mardim-ppa" ++ update_cache: True ++ state: present ++ when: ++ - ansible_pkg_mgr == 'apt' ++ - ovs_nsh_support | bool +diff --git a/vars/main.yml b/vars/main.yml +index dec0e36..afdff3f 100644 +--- a/vars/main.yml ++++ b/vars/main.yml +@@ -27,8 +27,12 @@ neutron_package_list: |- + {% if (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) + or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) + or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) %} ++ {% if (ovs_nsh_support and ansible_pkg_mgr in ['apt', 'zypper']) %} ++ {% set _ = packages.extend(neutron_ovs_nsh_required_packages) %} ++ {% else %} + {% set _ = packages.extend(neutron_ovs_distro_packages) %} + {% endif %} ++ {% endif %} + {% if neutron_services['neutron-linuxbridge-agent']['group'] in group_names and neutron_services['neutron-linuxbridge-agent'].service_en | bool %} + {% set _ = packages.extend(neutron_lxb_distro_packages) %} + {% endif %} +@@ -50,6 +54,8 @@ calico_felix_bin: /usr/local/bin/calico-felix + ### Python code details + ### + ++neutron_ovs_nsh_distro_packages: [] ++ + neutron_requires_pip_packages: + - virtualenv + - virtualenv-tools +diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml +index eb52ebf..a2c6275 100644 +--- a/vars/ubuntu-16.04.yml ++++ b/vars/ubuntu-16.04.yml +@@ -25,6 +25,12 @@ neutron_vpnaas_service_provider: VPN:strongswan:neutron_vpnaas.services.vpn.serv + ## APT Cache options + cache_timeout: 600 + ++neutron_ovs_nsh_required_packages: ++ - openvswitch-datapath-dkms ++ - openvswitch-common ++ - openvswitch-switch ++ - python-openvswitch ++ + neutron_distro_packages: + - conntrack + - dnsmasq-base diff --git a/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml index a80a81ef..039d5460 100644 --- a/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml +++ b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml @@ -7,28 +7,14 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- -- name: add ovs package in neutron - lineinfile: - dest: /etc/ansible/roles/os_neutron/vars/ubuntu-16.04.yml - insertbefore: 'openvswitch-common' - line: ' - openvswitch-datapath-dkms' -- name: add ovs package in neutron - lineinfile: - dest: /etc/ansible/roles/os_neutron/vars/ubuntu-16.04.yml - insertafter: 'openvswitch-switch' - line: ' - python-openvswitch' +- name: copy patch file + copy: + src: odl_sfc.patch + dest: /opt/odl_sfc.patch -- name: modify ovs installation in neutron - blockinfile: - dest: /etc/ansible/roles/os_neutron/tasks/neutron_install.yml - insertafter: '^# limitations' - block: | - - name: add ovs-nsh repo - apt_repository: - repo: "ppa:mardim/mardim-ppa" - update_cache: True - state: present - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] +- name: apply odl_sfc patch to os_neutron + shell: | + cd /etc/ansible/roles/os_neutron; + patch -p1 < /opt/odl_sfc.patch; + cd - diff --git a/plugins/stor4nfv/plugin.desc b/plugins/stor4nfv/plugin.desc new file mode 100644 index 00000000..ae589a60 --- /dev/null +++ b/plugins/stor4nfv/plugin.desc @@ -0,0 +1,45 @@ +# Plugin for Stor4nfv service for Compass4nfv. +# Stor4NFV provides a storage solution based on Ceph and +# OpenSDS, and focuses on the optimization for storage +# intensive use cases of NFV, like I/O performance improvements. +# +# More details can be found in the development document. +# ############################################################## +--- +plugin: + # plugin name,it is also as the switch to enable/disable plugin in scenario + # files + name: stor4nfv + + description: provide a storage solution based on Ceph and OpenSDS + + maintainers: + + # host os type: ubuntu/centos + os_version: ubuntu + + # true: this plugin is deployed separately on a new node + # false: this plugin is deployed on controller or compute node + independent_hosts: false + + # artifact: package download url for this plugin + artifacts: + url: + + # orchestration + # A plugin can have mutiple components, each component may need to be + # installed on different inventory or have its own configuration. + # due to Compass4nfv currently only supports ansible, so each component + # of the installation and configuration script need to be use ansible. + # cm : congfiguration management tool : only ansible support + # role: each component corresponds to ansible script that locates in the same + # directory as plugin.desc. + # phrase: + # inventory: + orchestration: + cm: ansible + roles: + - role: stor4nfv + phrase: post_k8s + inventory: + - localhost diff --git a/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh new file mode 100644 index 00000000..878f1542 --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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 +# ############################################################################# + +cd $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible + +sed -i 's/^workplace.*/workplace: \/root/g' group_vars/common.yml + +sed -i 's/^enabled_backend.*/enabled_backend: ceph/g' group_vars/osdsdock.yml + +sed -i 's/^ceph_pool_name.*/ceph_pool_name: "rbd"/g' group_vars/osdsdock.yml + +sed -i 's/^ceph_origin.*/ceph_origin: repository/g' group_vars/ceph/all.yml + +sed -i 's/^ceph_repository.*/ceph_repository: community/g' group_vars/ceph/all.yml + +sed -i 's/^ceph_stable_release.*/ceph_stable_release: luminous/g' group_vars/ceph/all.yml + +sed -i 's|^public_network.*|public_network: '"$1"'|g' group_vars/ceph/all.yml + +sed -i 's|^cluster_network.*|cluster_network: '"$2"'|g' group_vars/ceph/all.yml + +sed -i 's/^monitor_interface.*/monitor_interface: eth0/g' group_vars/ceph/all.yml + +sed -i 's/^devices:.*/devices: [\/dev\/loop0, \/dev\/loop1, \/dev\/loop2]/g' group_vars/ceph/osds.yml + +sed -i 's/^osd_scenario.*/osd_scenario: collocated/g' group_vars/ceph/osds.yml + +sed -i 's/^db_endpoint.*/db_endpoint: localhost:62379,localhost:62380/g' group_vars/osdsdb.yml + +sed -i 's/^etcd_port.*/etcd_port: 62379/g' group_vars/osdsdb.yml + +sed -i 's/^etcd_peer_port.*/etcd_peer_port: 62380/g' group_vars/osdsdb.yml diff --git a/plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh b/plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh new file mode 100644 index 00000000..b4a3a30a --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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 +# ############################################################################# + +add-apt-repository ppa:ansible/ansible + +apt-get update +apt-get install -y ansible +sleep 5 + +ansible --version + diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml new file mode 100644 index 00000000..353282f9 --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml @@ -0,0 +1,13 @@ +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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: opensds.yml + when: + - ansible_distribution == 'Ubuntu' + - stor4nfv is defined and stor4nfv == "Enable" diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml new file mode 100644 index 00000000..afd65bc7 --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml @@ -0,0 +1,84 @@ +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# 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: install prerequisites package + apt: + name: "{{ item }}" + state: present + with_items: + - make + - gcc + +- name: copy install_ansible script + remote_user: root + copy: + src: install_ansible.sh + dest: /opt/install_ansible.sh + mode: 0777 + +- name: install ansible + command: su -s /bin/sh -c "/opt/install_ansible.sh" + +- name: install ceph-ansible code + remote_user: root + shell: | + cd /opt; + git clone https://github.com/ceph/ceph-ansible.git + +- name: fetch stor4nfv source code + remote_user: root + shell: | + mkdir -p $HOME/gopath/src/github.com/stor4nfv && cd $HOME/gopath/src/github.com/stor4nfv; + git clone https://gerrit.opnfv.org/gerrit/stor4nfv.git + +- name: copy configure_vars script + remote_user: root + copy: + src: configure_vars.sh + dest: /opt/configure_vars.sh + mode: 0777 + +- name: configure variables for ceph, opensds + remote_user: root + shell: | + cd /opt; + ./configure_vars.sh {{ mgmt_cidr }} {{ external_cidr }} + +- name: render ceph inventory + remote_user: root + template: + src: ceph.hosts.j2 + dest: $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible/group_vars/ceph/ceph.hosts + +- name: render opensds inventory + remote_user: root + template: + src: opensds.hosts.j2 + dest: $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible/local.hosts + +- name: force to run the second etcd cluster + remote_user: root + lineinfile: + dest: $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible/roles/osdsdb/scenarios/etcd.yml + state: absent + regexp: 'when: service_etcd_status.rc != 0' + +- name: run playbook + remote_user: root + shell: | + cd $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible; + ansible-playbook site.yml -i local.hosts | tee /var/log/stor4nfv.log + register: stor4nfv_result + +- name: export opensds endpoint + remote_user: root + shell: | + export OPENSDS_ENDPOINT=http://127.0.0.1:50040 + when: stor4nfv_result|succeeded diff --git a/plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j2 b/plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j2 new file mode 100644 index 00000000..fda313d4 --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j2 @@ -0,0 +1,14 @@ +[mons] +{% for controller in hostvars[inventory_hostname]['groups']['kube_master'] %} +{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }} +{% endfor %} + +[osds] +{% for controller in hostvars[inventory_hostname]['groups']['storage_node'] %} +{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }} +{% endfor %} + +[mgrs] +{% for controller in hostvars[inventory_hostname]['groups']['kube_master'] %} +{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }} +{% endfor %} diff --git a/plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j2 b/plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j2 new file mode 100644 index 00000000..97068b90 --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j2 @@ -0,0 +1,9 @@ +[controllers] +{% for controller in hostvars[inventory_hostname]['groups']['storage_master'] %} +{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }} +{% endfor %} + +[docks] +{% for dock in hostvars[inventory_hostname]['groups']['storage_master'] %} +{{ dock }} ansible_ssh_host={{ hostvars[dock]['ansible_ssh_host'] }} +{% endfor %} diff --git a/util/docker-compose/roles/compass/tasks/main.yml b/util/docker-compose/roles/compass/tasks/main.yml index c7dba96b..d03a7bf2 100755 --- a/util/docker-compose/roles/compass/tasks/main.yml +++ b/util/docker-compose/roles/compass/tasks/main.yml @@ -19,7 +19,11 @@ {% for item in compass_images.results %} {% if "ansible_facts" in item %} {% set facts = item.ansible_facts %} - {% set _ = image_dict.update({facts.image_name: facts.image_repo}) %} + {% set image_name = facts.image_name %} + {% if "compass_tasks" in image_name %} + {% set image_name = "compass_tasks" %} + {% endif %} + {% set _ = image_dict.update({image_name: facts.image_repo}) %} {% endif %} {% endfor %} {% for key in image_dict %} @@ -95,6 +99,11 @@ "{{ docker_compose_dir }}"/ansible/$i done +- name: copy ansible plugins + copy: + src: "{{ compass_dir }}/deploy/ansible_plugins" + dest: "{{ docker_compose_dir }}" + - name: create run dir file: path: "{{ docker_compose_dir }}/ansible/run" @@ -123,16 +132,6 @@ tags: - redploy -- name: add ansible callback - shell: | - docker cp "{{ item }}" \ - compass-deck:/root/compass-deck/bin/ansible_callbacks - docker cp "{{ item }}" \ - compass-tasks:/opt/ansible_callbacks - with_items: - - "{{ compass_dir }}/deploy/status_callback.py" - - "{{ compass_dir }}/deploy/playbook_done.py" - - name: rm ansible run shell: | docker exec compass-tasks bash -c "rm -rf /var/ansible/run/*" diff --git a/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 b/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 index 7fc8ea3a..f7748634 100755 --- a/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 +++ b/util/docker-compose/roles/compass/templates/docker-compose.yml.j2 @@ -43,6 +43,7 @@ services: volumes: - {{ docker_compose_dir }}/compass_conf:/etc/compass - {{ docker_compose_dir }}/ansible:/var/ansible + - {{ docker_compose_dir }}/ansible_plugins:/opt/ansible_plugins command: - /usr/local/bin/start.sh {% endif %} |