From 6bc7e08cc5d80941c80e8d36d3a2b1373f147a05 Mon Sep 17 00:00:00 2001 From: leonwang Date: Thu, 15 Mar 2018 08:25:05 +0000 Subject: Merge nbp installation into opensds ansible script In this update, the nbp-ansible is removed from stor4nfv repo and all code has been merged into ansible repo. Besides, the latest update reduce a lot of work to download and build opensds source code. And some installation docs are also updated. Remove license statement for the moment. Change-Id: Ib8504d96e2d41e1c3ab7e0c94689111679d56abd Signed-off-by: leonwang --- ci/ansible/roles/osdsdock/scenarios/ceph.yml | 151 ++++++++++++++------------- 1 file changed, 77 insertions(+), 74 deletions(-) mode change 100755 => 100644 ci/ansible/roles/osdsdock/scenarios/ceph.yml (limited to 'ci/ansible/roles/osdsdock/scenarios/ceph.yml') diff --git a/ci/ansible/roles/osdsdock/scenarios/ceph.yml b/ci/ansible/roles/osdsdock/scenarios/ceph.yml old mode 100755 new mode 100644 index 2b6196c..b844a29 --- a/ci/ansible/roles/osdsdock/scenarios/ceph.yml +++ b/ci/ansible/roles/osdsdock/scenarios/ceph.yml @@ -1,74 +1,77 @@ ---- -- name: install ceph-common external package when ceph backend enabled - apt: - name: ceph-common - when: enabled_backend == "ceph" - -- name: copy opensds ceph backend file if specify ceph backend - copy: - src: ../../../group_vars/ceph/ceph.yaml - dest: "{{ ceph_config_path }}" - -- name: check for ceph-ansible source code existed - stat: - path: /opt/ceph-ansible - ignore_errors: yes - register: cephansibleexisted - -- name: download ceph-ansible source code - git: - repo: https://github.com/ceph/ceph-ansible.git - dest: /opt/ceph-ansible - when: - - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false - -- name: copy ceph inventory host into ceph-ansible directory - copy: - src: ../../../group_vars/ceph/ceph.hosts - dest: /opt/ceph-ansible/ceph.hosts - -- name: copy ceph all.yml file into ceph-ansible group_vars directory - copy: - src: ../../../group_vars/ceph/all.yml - dest: /opt/ceph-ansible/group_vars/all.yml - -- name: copy ceph osds.yml file into ceph-ansible group_vars directory - copy: - src: ../../../group_vars/ceph/osds.yml - dest: /opt/ceph-ansible/group_vars/osds.yml - -- name: copy site.yml.sample to site.yml in ceph-ansible - copy: - src: /opt/ceph-ansible/site.yml.sample - dest: /opt/ceph-ansible/site.yml - -- name: ping all hosts - shell: ansible all -m ping -i ceph.hosts - become: true - args: - chdir: /opt/ceph-ansible - -- name: run ceph-ansible playbook - shell: ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log - become: true - args: - chdir: /opt/ceph-ansible - -#- name: Check if ceph osd is running -# shell: ps aux | grep ceph-osd | grep -v grep -# ignore_errors: false -# changed_when: false -# register: service_ceph_osd_status - -- name: Check if ceph mon is running - shell: ps aux | grep ceph-mon | grep -v grep - ignore_errors: false - changed_when: false - register: service_ceph_mon_status - -- name: Create a pool and initialize it. - shell: ceph osd pool create {{ ceph_pool_name }} 100 && ceph osd pool set {{ ceph_pool_name }} size 1 - ignore_errors: yes - changed_when: false - register: ceph_init_pool - when: service_ceph_mon_status.rc == 0 # and service_ceph_osd_status.rc == 0 +--- +- name: install ceph-common external package when ceph backend enabled + apt: + name: "{{ item }}" + state: present + with_items: + - ceph-common + when: enabled_backend == "ceph" + +- name: copy opensds ceph backend file if specify ceph backend + copy: + src: ../../../group_vars/ceph/ceph.yaml + dest: "{{ ceph_config_path }}" + +- name: check for ceph-ansible source code existed + stat: + path: /opt/ceph-ansible + ignore_errors: yes + register: cephansibleexisted + +- name: download ceph-ansible source code + git: + repo: https://github.com/ceph/ceph-ansible.git + dest: /opt/ceph-ansible + when: + - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false + +- name: copy ceph inventory host into ceph-ansible directory + copy: + src: ../../../group_vars/ceph/ceph.hosts + dest: /opt/ceph-ansible/ceph.hosts + +- name: copy ceph all.yml file into ceph-ansible group_vars directory + copy: + src: ../../../group_vars/ceph/all.yml + dest: /opt/ceph-ansible/group_vars/all.yml + +- name: copy ceph osds.yml file into ceph-ansible group_vars directory + copy: + src: ../../../group_vars/ceph/osds.yml + dest: /opt/ceph-ansible/group_vars/osds.yml + +- name: copy site.yml.sample to site.yml in ceph-ansible + copy: + src: /opt/ceph-ansible/site.yml.sample + dest: /opt/ceph-ansible/site.yml + +- name: ping all hosts + shell: ansible all -m ping -i ceph.hosts + become: true + args: + chdir: /opt/ceph-ansible + +- name: run ceph-ansible playbook + shell: ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log + become: true + args: + chdir: /opt/ceph-ansible + +#- name: Check if ceph osd is running +# shell: ps aux | grep ceph-osd | grep -v grep +# ignore_errors: false +# changed_when: false +# register: service_ceph_osd_status + +- name: Check if ceph mon is running + shell: ps aux | grep ceph-mon | grep -v grep + ignore_errors: false + changed_when: false + register: service_ceph_mon_status + +- name: Create specified pools and initialize them with default pool size. + shell: ceph osd pool create {{ item }} 100 && ceph osd pool set {{ item }} size 1 + ignore_errors: yes + changed_when: false + with_items: "{{ ceph_pools }}" + when: service_ceph_mon_status.rc == 0 # and service_ceph_osd_status.rc == 0 -- cgit 1.2.3-korg