aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/ceph-config/tasks
diff options
context:
space:
mode:
authorgrakiss <grakiss.wanglei@huawei.com>2016-01-13 14:59:11 +0800
committerJustin chi <chigang@huawei.com>2016-01-30 03:34:26 +0000
commit951cec74b7b8cef5db2f2bda7375653fedaedbf8 (patch)
tree219fdc31014836b059597bd6439dadbe6c6cb59b /deploy/adapters/ansible/roles/ceph-config/tasks
parentffcccb6b50fe7e5954188b44f6666f7ac3dee3da (diff)
deploy CEPH nodes parallelly
JIRA:COMPASS-264 - do not use ceph-deploy - do not need centeral node to deploy ceph Change-Id: I0f9c459060a2fccbad73a323697ec23ea2115410 Signed-off-by: grakiss <grakiss.wanglei@huawei.com> (cherry picked from commit 2616357bbf1d5cfc1f7e3923e12b8adfc5627fc6)
Diffstat (limited to 'deploy/adapters/ansible/roles/ceph-config/tasks')
-rwxr-xr-xdeploy/adapters/ansible/roles/ceph-config/tasks/create_config.yml59
-rwxr-xr-xdeploy/adapters/ansible/roles/ceph-config/tasks/main.yml5
2 files changed, 64 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/ceph-config/tasks/create_config.yml b/deploy/adapters/ansible/roles/ceph-config/tasks/create_config.yml
new file mode 100755
index 00000000..0822239e
--- /dev/null
+++ b/deploy/adapters/ansible/roles/ceph-config/tasks/create_config.yml
@@ -0,0 +1,59 @@
+- name: gen ceph fsid
+ shell: uuidgen
+ register: ceph_fsid
+ run_once: true
+
+- name: gen ceph conf
+ local_action:
+ module: "template"
+ src: "ceph.j2"
+ dest: "/tmp/ceph.conf"
+ run_once: true
+
+- name: "make directory for ceph config file"
+ file: path="/etc/ceph" state="directory"
+
+- name: copy ceph conf to dest mon node
+ copy: src="/tmp/ceph.conf" dest="/etc/ceph/ceph.conf"
+
+- name: install ceph-related packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - ceph
+
+- name: gen create monmap script
+ local_action: template src="create_monmap.j2" dest="/tmp/create_monmap.sh" mode=0755
+ run_once: true
+
+- name: create monmap
+ script: /tmp/create_monmap.sh
+ when: inventory_hostname in groups['ceph_mon']
+
+- name: create mon.keyring
+ shell: "ceph-authtool --create-keyring /tmp/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'"
+ when: inventory_hostname == groups['ceph_mon'][0]
+
+- name: create admin.keyring
+ shell: "ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow'"
+ when: inventory_hostname == groups['ceph_mon'][0]
+
+- name: Add the client.admin key to the ceph.mon.keyring
+ shell: "ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring"
+ when: inventory_hostname == groups['ceph_mon'][0]
+
+- name: fetch mon.keyring to local
+ fetch: src="/tmp/ceph.mon.keyring" dest="/tmp/ceph.mon.keyring" flat=yes
+ when: inventory_hostname == groups['ceph_mon'][0]
+
+- name: fetch client.admin.keyring to local
+ fetch: src="/etc/ceph/ceph.client.admin.keyring" dest="/tmp/ceph.client.admin.keyring" flat=yes
+ when: inventory_hostname == groups['ceph_mon'][0]
+
+- name: copy mon.keyring to remote nodes
+ copy: src="/tmp/ceph.mon.keyring" dest="/tmp/ceph.mon.keyring"
+
+- name: copy admin.keyring to remote nodes
+ copy: src="/tmp/ceph.client.admin.keyring" dest="/etc/ceph/ceph.client.admin.keyring"
+
+
+- meta: flush_handlers
diff --git a/deploy/adapters/ansible/roles/ceph-config/tasks/main.yml b/deploy/adapters/ansible/roles/ceph-config/tasks/main.yml
new file mode 100755
index 00000000..3512dfb8
--- /dev/null
+++ b/deploy/adapters/ansible/roles/ceph-config/tasks/main.yml
@@ -0,0 +1,5 @@
+- include: create_config.yml
+ tags:
+ - ceph_config
+ - ceph_deploy
+ - ceph_mon