aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-07-26 07:57:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-26 07:57:35 +0000
commitf24b65758d1a0986b77f5f041c32e543198d732f (patch)
tree86d7556524e2c98e9958c6567cba42fb2ee65252 /resources
parent5bd3241840ff2f2db64f7d5e139d05b011bae941 (diff)
parent9f286be42a4a81434d07e02dd75da9b6767119d2 (diff)
Merge "Add ceph-network-info role to get the cluster network info and interface network info from ceph nodes."
Diffstat (limited to 'resources')
-rw-r--r--resources/ansible_roles/ceph-network-info/meta/main.yml14
-rw-r--r--resources/ansible_roles/ceph-network-info/tasks/main.yml37
2 files changed, 51 insertions, 0 deletions
diff --git a/resources/ansible_roles/ceph-network-info/meta/main.yml b/resources/ansible_roles/ceph-network-info/meta/main.yml
new file mode 100644
index 00000000..4f5b88d4
--- /dev/null
+++ b/resources/ansible_roles/ceph-network-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-network-info }
diff --git a/resources/ansible_roles/ceph-network-info/tasks/main.yml b/resources/ansible_roles/ceph-network-info/tasks/main.yml
new file mode 100644
index 00000000..7216d1a5
--- /dev/null
+++ b/resources/ansible_roles/ceph-network-info/tasks/main.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