From c6d9fcbffa0146ef968be0594b4c1afe98c3ee57 Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Tue, 22 Aug 2017 15:52:21 +0800 Subject: Merge ceph info roles Change-Id: I83be70cf24be2a9da0a0f82e44810b1e9ff2b3b8 Signed-off-by: Yujun Zhang --- resources/ansible_roles/ceph-info/meta/main.yml | 14 +++++++ resources/ansible_roles/ceph-info/tasks/cache.yml | 34 +++++++++++++++++ resources/ansible_roles/ceph-info/tasks/disk.yml | 43 ++++++++++++++++++++++ resources/ansible_roles/ceph-info/tasks/main.yml | 14 +++++++ .../ansible_roles/ceph-info/tasks/network.yml | 37 +++++++++++++++++++ 5 files changed, 142 insertions(+) create mode 100644 resources/ansible_roles/ceph-info/meta/main.yml create mode 100644 resources/ansible_roles/ceph-info/tasks/cache.yml create mode 100644 resources/ansible_roles/ceph-info/tasks/disk.yml create mode 100644 resources/ansible_roles/ceph-info/tasks/main.yml create mode 100644 resources/ansible_roles/ceph-info/tasks/network.yml (limited to 'resources/ansible_roles/ceph-info') diff --git a/resources/ansible_roles/ceph-info/meta/main.yml b/resources/ansible_roles/ceph-info/meta/main.yml new file mode 100644 index 00000000..9b18b279 --- /dev/null +++ b/resources/ansible_roles/ceph-info/meta/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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 +############################################################################## + +--- + +allow_duplicates: yes +dependencies: +- { role: qtip-common, basename: ceph-info } diff --git a/resources/ansible_roles/ceph-info/tasks/cache.yml b/resources/ansible_roles/ceph-info/tasks/cache.yml new file mode 100644 index 00000000..7e29a325 --- /dev/null +++ b/resources/ansible_roles/ceph-info/tasks/cache.yml @@ -0,0 +1,34 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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 +############################################################################## + +- fetch: + src: /etc/ceph/ceph.conf + dest: "{{ qtip_results }}/sysinfo-{{ inventory_hostname }}/" + flat: yes + +- name: collect ceph catch info from ceph.conf + set_fact: {"{{ item }}":"{{ lookup('ini', '{{ item }} section=client default='' file={{ qtip_results }}/sysinfo-{{ inventory_hostname }}/ceph.conf') }}"} + with_items: + - rbd_cache + - rbd_cache_max_dirty + - rdb_cache_size + delegate_to: localhost + ignore_errors: True + register: result + +- name: saving output to log + copy: + content: "{{ item }} {{ item.stdout }}" + dest: "{{ logfile }}" + when: result|succeeded + delegate_to: localhost + with_items: + - rbd_cache + - rbd_cache_max_dirty + - rdb_cache_size diff --git a/resources/ansible_roles/ceph-info/tasks/disk.yml b/resources/ansible_roles/ceph-info/tasks/disk.yml new file mode 100644 index 00000000..6bb88e69 --- /dev/null +++ b/resources/ansible_roles/ceph-info/tasks/disk.yml @@ -0,0 +1,43 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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: get ceph disk information + become: true + command: ceph-disk list + register: ceph_disk_out + +- name: saving output to log + copy: + content: "{{ ceph_disk_out.stdout }}" + dest: "{{ logfile }}" + delegate_to: localhost + +- name: get ceph journal information + become: true + shell: lsblk -d -o name,rota |awk '{if ($2 == 0) printf "%s SSD \n",$1 }' + register: ceph_journal_out + +- name: append + lineinfile: + dest: "{{ logfile }}" + line: "{{ ceph_journal_out.stdout }}" + insertafter: EOF + delegate_to: localhost + +- name: get ceph report + become: true + command: ceph report + register: ceph_report_out + +- name: saving ceph report to log + copy: + content: "{{ ceph_report_out.stdout }}" + dest: "{{ output }}/ceph_report.json" + delegate_to: localhost diff --git a/resources/ansible_roles/ceph-info/tasks/main.yml b/resources/ansible_roles/ceph-info/tasks/main.yml new file mode 100644 index 00000000..04cc859c --- /dev/null +++ b/resources/ansible_roles/ceph-info/tasks/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +- include: cache.yml +- include: disk.yml +- include: network.yml diff --git a/resources/ansible_roles/ceph-info/tasks/network.yml b/resources/ansible_roles/ceph-info/tasks/network.yml new file mode 100644 index 00000000..d5319c55 --- /dev/null +++ b/resources/ansible_roles/ceph-info/tasks/network.yml @@ -0,0 +1,37 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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: get system network info + shell: netstat -nr |grep "U" | awk '{printf "interface %s network %s mask %s \n",$8,$1, $3 }' + register: ceph_network_out + +- name: saving output to log + copy: + content: "{{ ceph_network_out.stdout }}" + dest: "{{ logfile }}" + delegate_to: localhost + +- fetch: + src: /etc/ceph/ceph.conf + dest: "{{ qtip_results }}/sysinfo-{{ inventory_hostname }}/" + flat: yes + +- name: collect ceph system info from ceph.conf + set_fact: {"{{ item }}":"{{ lookup('ini', '{{ item }} section=global default='' file={{ qtip_results }}/sysinfo-{{ inventory_hostname }}/ceph.conf') }}"} + with_items: + - cluster_network + delegate_to: localhost + +- name: append + lineinfile: + dest: "{{ logfile }}" + line: "cluster_network {{ cluster_network }}" + insertafter: EOF + delegate_to: localhost -- cgit 1.2.3-korg