ceph-ansible/roles/ceph-mon/tasks/ceph_keys.yml

62 lines
1.7 KiB
YAML
Raw Normal View History

---
# NOTE (leseb): wait for mon discovery and quorum resolution
# the admin key is not instantaneously created so we have to wait a bit
- name: wait for client.admin key exists
2015-10-17 07:55:31 +08:00
wait_for:
path: /etc/ceph/{{ cluster }}.client.admin.keyring
when: cephx
- name: create ceph rest api keyring when mon is not containerized
command: ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring
2015-10-17 07:55:31 +08:00
args:
creates: /etc/ceph/{{ cluster }}.client.restapi.keyring
changed_when: false
when:
- cephx
- groups[restapi_group_name] is defined
- include: rbd_pool.yml
when: ceph_conf_overrides.global.osd_pool_default_pg_num is defined
- include: openstack_config.yml
when: openstack_config
- name: find ceph keys
shell: ls -1 /etc/ceph/*.keyring
changed_when: false
register: ceph_keys
always_run: true
when: cephx
- name: set keys permissions
2015-10-17 07:55:31 +08:00
file:
path: "{{ item }}"
mode: "{{ key_mode }}"
owner: "{{ key_owner }}"
group: "{{ key_group }}"
with_items:
- "{{ ceph_keys.stdout_lines }}"
when: cephx
- name: copy keys to the ansible server
2015-10-17 07:55:31 +08:00
fetch:
src: "{{ item }}"
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
flat: yes
run_once: true
with_items:
- "{{ ceph_keys.stdout_lines }}"
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
when: cephx
- name: drop in a motd script to report status when logging in
2015-10-17 07:55:31 +08:00
copy:
src: precise/92-ceph
dest: /etc/update-motd.d/92-ceph
owner: root
group: root
mode: 0755
when: ansible_distribution_release == 'precise'