2014-09-05 03:14:11 +08:00
|
|
|
---
|
2015-07-17 00:42:12 +08:00
|
|
|
- name: generate monitor initial keyring
|
2015-10-17 07:55:31 +08:00
|
|
|
local_action: 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_directory }}/monitor_keyring.conf
|
2015-08-27 18:42:01 +08:00
|
|
|
creates={{ fetch_directory }}/monitor_keyring.conf
|
2015-07-17 20:06:25 +08:00
|
|
|
register: monitor_keyring
|
2016-02-04 19:36:46 +08:00
|
|
|
become: false
|
2015-07-17 00:42:12 +08:00
|
|
|
|
|
|
|
- name: read monitor initial keyring if it already exists
|
2015-10-17 07:55:31 +08:00
|
|
|
local_action: command cat {{ fetch_directory }}/monitor_keyring.conf
|
2015-08-27 18:42:01 +08:00
|
|
|
removes={{ fetch_directory }}/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
|
2016-02-04 19:36:46 +08:00
|
|
|
become: false
|
2015-07-17 00:42:12 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: create monitor initial keyring
|
2015-10-17 07:55:31 +08:00
|
|
|
command: ceph-authtool /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} --create-keyring --name=mon. --add-key={{ monitor_secret }} --cap mon 'allow *'
|
|
|
|
args:
|
|
|
|
creates: /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
2014-09-05 03:14:11 +08:00
|
|
|
|
2016-02-02 22:10:24 +08:00
|
|
|
- name: set initial monitor key permissions
|
2015-11-17 23:10:02 +08:00
|
|
|
file:
|
|
|
|
path: /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
2016-02-02 22:10:24 +08:00
|
|
|
mode: "{{ key_mode }}"
|
|
|
|
owner: "{{ key_owner }}"
|
|
|
|
group: "{{ key_group }}"
|
2015-11-17 23:10:02 +08:00
|
|
|
|
2016-02-02 22:10:24 +08:00
|
|
|
- name: create monitor directory
|
2015-11-17 23:10:02 +08:00
|
|
|
file:
|
|
|
|
path: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}
|
|
|
|
state: directory
|
2016-02-02 22:10:24 +08:00
|
|
|
owner: "{{ dir_owner }}"
|
|
|
|
group: "{{ dir_group }}"
|
|
|
|
mode: "{{ dir_mode }}"
|
2015-11-17 23:10:02 +08:00
|
|
|
|
|
|
|
- name: ceph monitor mkfs (for or after infernalis release)
|
|
|
|
command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
|
|
|
args:
|
|
|
|
creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring
|
2015-11-20 22:09:34 +08:00
|
|
|
when: is_ceph_infernalis
|
2014-09-05 03:14:11 +08:00
|
|
|
|
2015-11-17 23:10:02 +08:00
|
|
|
- name: ceph monitor mkfs (before infernalis release)
|
2015-10-17 07:55:31 +08:00
|
|
|
command: ceph-mon --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
|
|
|
args:
|
|
|
|
creates: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring
|
2015-11-20 22:09:34 +08:00
|
|
|
when: not is_ceph_infernalis
|