diff options
Diffstat (limited to 'plugins')
14 files changed, 249 insertions, 38 deletions
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml index 91ca514c..ecc67d29 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml @@ -10,12 +10,6 @@ name: networking-odl virtualenv: /openstack/venvs/neutron-{{ os_ver }} -- name: install neutron-lib - pip: - name: neutron-lib - version: 1.14.0 - virtualenv: /openstack/venvs/neutron-{{ os_ver }} - - name: configure vsctl for dhcp agent shell: | crudini --set /etc/neutron/dhcp_agent.ini OVS \ diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml index 7f80a36b..060abfc6 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml @@ -10,11 +10,5 @@ name: networking-odl virtualenv: /openstack/venvs/neutron-{{ os_ver }} -- name: install neutron-lib - pip: - name: neutron-lib - version: 1.14.0 - virtualenv: /openstack/venvs/neutron-{{ os_ver }} - - name: turn off neutron-server on control node service: name=neutron-server state=stopped diff --git a/plugins/stor4nfv/plugin.desc b/plugins/stor4nfv/plugin.desc index ae589a60..e0a1e690 100644 --- a/plugins/stor4nfv/plugin.desc +++ b/plugins/stor4nfv/plugin.desc @@ -43,3 +43,7 @@ plugin: phrase: post_k8s inventory: - localhost + - role: os-stor4nfv + phrase: post_openstack + inventory: + - localhost diff --git a/plugins/stor4nfv/roles/os-stor4nfv/files/install_ansible.sh b/plugins/stor4nfv/roles/os-stor4nfv/files/install_ansible.sh new file mode 100644 index 00000000..d921d4e2 --- /dev/null +++ b/plugins/stor4nfv/roles/os-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-2.4 + +apt-get update +apt-get install -y ansible +sleep 5 + +ansible --version + diff --git a/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh b/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.sh new file mode 100644 index 00000000..7d497598 --- /dev/null +++ b/plugins/stor4nfv/roles/os-stor4nfv/files/os_configure_vars.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 +# ############################################################################# + +cd $HOME/gopath/src/github.com/os-stor4nfv/stor4nfv/ci/ansible + +sed -i '/- osdsdock/s/^/#/g' site.yml + +sed -i '/- dashboard-installer/s/^/#/g' site.yml + +sed -i '/- nbp-installer/s/^/#/g' site.yml + +sed -i '/check_ansible_version/a \ ignore_errors: yes\' roles/common/tasks/main.yml + +# auth +sed -i 's/^opensds_auth_strategy.*/opensds_auth_strategy: noauth/g' group_vars/auth.yml + +# opensds_endpoint +sed -i 's/^opensds_endpoint.*/opensds_endpoint: http:\/\/'"$1"':50040/g' group_vars/common.yml diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/main.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/main.yml new file mode 100644 index 00000000..dbaa8d6b --- /dev/null +++ b/plugins/stor4nfv/roles/os-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: stor4nfv.yml + when: + - ansible_distribution == 'Ubuntu' + - stor4nfv is defined and stor4nfv == "Enable" diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml new file mode 100644 index 00000000..2d0f05cc --- /dev/null +++ b/plugins/stor4nfv/roles/os-stor4nfv/tasks/opensds.yml @@ -0,0 +1,72 @@ +# ############################################################################# +# 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: + - git + - gawk + - curl + - wget + - software-properties-common + +- 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" + ignore_errors: "true" + +- name: disable cinder + remote_user: root + shell: | + lxc-stop -n $(lxc-ls --line | grep cinder_api) + lxc-stop -n $(lxc-ls --line | grep cinder_scheduler) + ignore_errors: "true" + +- name: modify haproxy.cfg and restart haproxy + remote_user: root + shell: | + sed -i \ + '/frontend cinder_api-front/,/host1_cinder_api_container/ s/^/#/' /etc/haproxy/haproxy.cfg + systemctl restart haproxy + ignore_errors: "true" + +- name: fetch stor4nfv source code + remote_user: root + shell: | + mkdir -p $HOME/gopath/src/github.com/os-stor4nfv && cd $HOME/gopath/src/github.com/os-stor4nfv; + rm -rf stor4nfv; + git clone https://gerrit.opnfv.org/gerrit/stor4nfv.git + +- name: copy os_configure_vars script + remote_user: root + copy: + src: os_configure_vars.sh + dest: /opt/os_configure_vars.sh + mode: 0777 + +- name: configure variables for opensds + remote_user: root + shell: | + cd /opt; + ./os_configure_vars.sh {{ public_vip.ip }} + +- name: run playbook + remote_user: root + shell: | + cd $HOME/gopath/src/github.com/os-stor4nfv/stor4nfv/ci/ansible; + ansible-playbook site.yml -i local.hosts | tee /var/log/os-stor4nfv.log diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml new file mode 100644 index 00000000..c549566a --- /dev/null +++ b/plugins/stor4nfv/roles/os-stor4nfv/tasks/post-install.yml @@ -0,0 +1,78 @@ +# ############################################################################# +# 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: ensure opensds.conf exists + stat: + path: /etc/opensds/opensds.conf + ignore_errors: "true" + register: opensds_exists + +- name: configure ceph.yaml, opensds.conf + remote_user: root + shell: | + cd /root/gopath/src/github.com/os-stor4nfv/stor4nfv/ci/ansible + cp group_vars/ceph/ceph.yaml /etc/opensds/driver/ + + sed -i 's/^ enabled_backends.*/ enabled_backends: ceph/g' /etc/opensds/opensds.conf + + sudo cat >> /etc/opensds/opensds.conf << OPENSDS_GLOABL_CONFIG_DOC + + [ceph] + name = ceph + description = Ceph Test + driver_name = ceph + config_path = /etc/opensds/driver/ceph.yaml + OPENSDS_GLOABL_CONFIG_DOC + when: + - opensds_exists.stat.exists + +- name: copy ceph.conf from ceph-mon container + remote_user: root + shell: | + mkdir -p /etc/ceph + cp /proc/$(lxc-info -n $(lxc-ls --line | grep ceph-mon) -p -H)/root/etc/ceph/ceph.conf \ + /etc/ceph/ceph.conf + when: + - opensds_exists.stat.exists + +- name: ensure osdsdock exists + stat: + path: /opt/opensds-hotpot-linux-amd64/bin/osdsdock + ignore_errors: "true" + register: osdsdock_exists + +- name: start osdsdock daemon + remote_user: root + shell: | + /opt/opensds-hotpot-linux-amd64/bin/osdsdock -daemon + ignore_errors: "true" + when: + - osdsdock_exists.stat.exists + +- name: ensure osdsctl exists + stat: + path: /opt/opensds-hotpot-linux-amd64/bin/osdsctl + ignore_errors: "true" + register: osdsctl_exists + +- name: run cinder-compatible-api, create opensds default profile + remote_user: root + shell: | + cd $HOME/gopath/src/github.com/os-stor4nfv/stor4nfv/ci/ansible; + export OPENSDS_ENDPOINT=http://{{ public_vip.ip }}:50040; + export CINDER_ENDPOINT=http://{{ internal_vip.ip }}:8776/v3; + chmod +x ../bin/cindercompatibleapi; + ( ( nohup ../bin/cindercompatibleapi > /var/log/cindercompatibleapi.log 2>&1 ) & ); + cp /opt/opensds-hotpot-linux-amd64/bin/osdsctl /usr/local/bin; + export OPENSDS_AUTH_STRATEGY=noauth; + osdsctl profile create '{"name": "default", "description": "default policy"}' + ignore_errors: "true" + when: + - osdsctl_exists.stat.exists diff --git a/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml b/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml new file mode 100644 index 00000000..57bae793 --- /dev/null +++ b/plugins/stor4nfv/roles/os-stor4nfv/tasks/stor4nfv.yml @@ -0,0 +1,12 @@ +# ############################################################################# +# 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 + +- include: post-install.yml diff --git a/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh index a4fe44ea..112d9c84 100644 --- a/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh +++ b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh @@ -10,10 +10,6 @@ cd $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible -sed -i 's/^opensds_release.*/opensds_release: v0.1.5/g' group_vars/common.yml - -sed -i 's/^nbp_release.*/nbp_release: v0.1.0/g' group_vars/common.yml - sed -i 's/^container_enabled.*/container_enabled: false/g' group_vars/common.yml sed -i 's/^nbp_plugin_type.*/nbp_plugin_type: csi/g' group_vars/common.yml @@ -34,7 +30,9 @@ 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/^devices:.*/devices: [\/dev\/loop0, \/dev\/loop1, \/dev\/loop2]/g' group_vars/ceph/all.yml + +sed -i '/dev\/sda/s/^/#/g' group_vars/ceph/all.yml sed -i 's/^osd_scenario.*/osd_scenario: collocated/g' group_vars/ceph/osds.yml @@ -45,3 +43,9 @@ sed -i 's/^etcd_host.*/etcd_host: 127.0.0.1/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 + +sed -i 's/^opensds_auth_strategy.*/opensds_auth_strategy: noauth/g' group_vars/auth.yml + +sed -i '/check_ansible_version/a \ ignore_errors: yes\' roles/common/tasks/main.yml + +sed -i '/- dashboard-installer/s/^/#/g' site.yml diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml index 060c9cf1..7bc8ec06 100644 --- a/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml @@ -7,8 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 # ############################################################################# --- -- include: opensds.yml -- include: post-install.yml +- include: stor4nfv 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 index 3252fefb..e84ce0aa 100644 --- a/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml @@ -15,6 +15,7 @@ with_items: - make - gcc + - gawk - name: copy install_ansible script remote_user: root @@ -26,13 +27,6 @@ - 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; - [ -f ceph-ansible/requirements.txt ] && pip install -r ceph-ansible/requirements.txt - - name: fetch stor4nfv source code remote_user: root shell: | diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml index 182c0a68..017f377e 100644 --- a/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml @@ -31,6 +31,7 @@ become: true args: chdir: /opt/ceph-ansible + ignore_errors: "true" when: - ceph_ansible_exists.stat.exists is defined and ceph_ansible_exists.stat.exists @@ -43,26 +44,17 @@ - name: ensure osdsctl exists stat: - path: /opt/opensds-v0.1.5-linux-{{ imgarch }}/bin/osdsctl + path: /opt/opensds-hotpot-linux-{{ imgarch }}/bin/osdsctl ignore_errors: "true" register: osdsctl_exists -- name: ensure opensds csi directory exists - stat: - path: /opt/opensds-k8s-v0.1.0-linux-{{ imgarch }} - ignore_errors: "true" - register: csi_dir_exists - -- name: create opensds default profile, csi pods +- name: create opensds default profile remote_user: root shell: | - cp /opt/opensds-v0.1.5-linux-{{ imgarch }}/bin/osdsctl /usr/local/bin; + cp /opt/opensds-hotpot-linux-{{ imgarch }}/bin/osdsctl /usr/local/bin; export OPENSDS_ENDPOINT=http://{{ public_vip.ip }}:50040; export OPENSDS_AUTH_STRATEGY=noauth; osdsctl profile create '{"name": "default", "description": "default policy"}' - cd /opt/opensds-k8s-v0.1.0-linux-{{ imgarch }}; - kubectl create -f csi/deploy/kubernetes; ignore_errors: "true" when: - osdsctl_exists.stat.exists is defined and osdsctl_exists.stat.exists - - csi_dir_exists.stat.exists is defined and csi_dir_exists.stat.exists diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/stor4nfv.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/stor4nfv.yml new file mode 100644 index 00000000..57bae793 --- /dev/null +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/stor4nfv.yml @@ -0,0 +1,12 @@ +# ############################################################################# +# 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 + +- include: post-install.yml |