2014-09-05 03:14:11 +08:00
|
|
|
---
|
2015-07-17 00:42:12 +08:00
|
|
|
- name: generate monitor initial keyring
|
|
|
|
local_action: >
|
2015-07-17 21:26:38 +08:00
|
|
|
shell python -c "import os ; import struct ; import time; import base64 ; key = os.urandom(16) ; header = struct.pack('<hiih',1,int(time.time()),0,len(key)) ; print base64.b64encode(header + key)" | tee fetch/monitor_keyring.conf
|
2015-07-17 20:06:25 +08:00
|
|
|
creates=fetch/monitor_keyring.conf
|
|
|
|
register: monitor_keyring
|
2015-07-17 00:42:12 +08:00
|
|
|
sudo: false
|
2015-07-18 00:08:24 +08:00
|
|
|
when: monitor_secret != 'AQAWqilTCDh7CBAAawXt6kyTgLFCxSvJhTEmuw=='
|
2015-07-17 00:42:12 +08:00
|
|
|
|
|
|
|
- name: read monitor initial keyring if it already exists
|
|
|
|
local_action: >
|
2015-07-17 20:06:25 +08:00
|
|
|
command cat fetch/monitor_keyring.conf
|
|
|
|
removes=fetch/monitor_keyring.conf
|
2015-07-17 00:42:12 +08:00
|
|
|
changed_when: false
|
2015-07-17 20:06:25 +08:00
|
|
|
register: monitor_keyring
|
2015-07-17 00:42:12 +08:00
|
|
|
sudo: false
|
2015-07-18 00:08:24 +08:00
|
|
|
when: monitor_secret != 'AQAWqilTCDh7CBAAawXt6kyTgLFCxSvJhTEmuw=='
|
2015-07-17 00:42:12 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: create monitor initial keyring
|
2015-03-19 19:21:29 +08:00
|
|
|
command: >
|
2015-07-17 00:42:12 +08:00
|
|
|
ceph-authtool /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} --create-keyring --name=mon. --add-key={{ monitor_secret }} --cap mon 'allow *'
|
2015-03-19 19:21:29 +08:00
|
|
|
creates=/var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
2014-09-05 03:14:11 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: set initial monitor key permissions
|
2014-09-05 03:14:11 +08:00
|
|
|
file: >
|
2014-11-14 22:03:50 +08:00
|
|
|
path=/var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
|
|
|
mode=0600
|
2014-09-05 03:14:11 +08:00
|
|
|
owner=root
|
|
|
|
group=root
|
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: create monitor directory
|
2014-09-05 03:14:11 +08:00
|
|
|
file: >
|
|
|
|
path=/var/lib/ceph/mon/ceph-{{ ansible_hostname }}
|
|
|
|
state=directory
|
|
|
|
owner=root
|
|
|
|
group=root
|
2015-06-08 23:33:56 +08:00
|
|
|
mode=0755
|
2014-09-05 03:14:11 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: ceph monitor mkfs
|
2015-03-19 19:21:29 +08:00
|
|
|
command: >
|
|
|
|
ceph-mon --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
|
|
|
creates=/var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring
|