From 691f7c51469b5e0a24f25a59ff533caa7d769d8a Mon Sep 17 00:00:00 2001 From: jtudelag Date: Wed, 28 Feb 2018 18:53:57 +0100 Subject: [PATCH] Adds handy ceph aliases whe containerized installations. Same approach as openshift-ansible etcdctl: * https://github.com/openshift/openshift-ansible/blob/release-3.7/roles/etcd/tasks/auxiliary/drop_etcdctl.yml * https://github.com/openshift/openshift-ansible/blob/release-3.7/roles/etcd/etcdctl.sh --- .../purge-docker-cluster.yml | 4 ++++ .../docker/configure_ceph_command_aliases.yml | 8 ++++++++ roles/ceph-mon/tasks/docker/main.yml | 3 +++ roles/ceph-mon/templates/ceph-aliases.sh.j2 | 17 +++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 roles/ceph-mon/tasks/docker/configure_ceph_command_aliases.yml create mode 100644 roles/ceph-mon/templates/ceph-aliases.sh.j2 diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index cee8be7bf..8b31df9d4 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -469,6 +469,10 @@ tags: remove_img + - name: remove ceph aliases + file: + path: /etc/profile.d/ceph-aliases.sh + state: absent - name: remove installed packages diff --git a/roles/ceph-mon/tasks/docker/configure_ceph_command_aliases.yml b/roles/ceph-mon/tasks/docker/configure_ceph_command_aliases.yml new file mode 100644 index 000000000..dc7fc6efe --- /dev/null +++ b/roles/ceph-mon/tasks/docker/configure_ceph_command_aliases.yml @@ -0,0 +1,8 @@ +--- +- name: configure ceph profile.d aliases + template: + src: ceph-aliases.sh.j2 + dest: "/etc/profile.d/ceph-aliases.sh" + mode: 0755 + owner: root + group: root diff --git a/roles/ceph-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml index 97d2911fa..0c0bb15f7 100644 --- a/roles/ceph-mon/tasks/docker/main.yml +++ b/roles/ceph-mon/tasks/docker/main.yml @@ -6,6 +6,9 @@ - name: include start_docker_monitor.yml include: start_docker_monitor.yml +- name: include configure_ceph_command_aliases.yml + include: configure_ceph_command_aliases.yml + - name: wait for monitor socket to exist command: "{{ docker_exec_cmd }} sh -c 'stat /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok || stat /var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok'" register: monitor_socket diff --git a/roles/ceph-mon/templates/ceph-aliases.sh.j2 b/roles/ceph-mon/templates/ceph-aliases.sh.j2 new file mode 100644 index 000000000..4873233af --- /dev/null +++ b/roles/ceph-mon/templates/ceph-aliases.sh.j2 @@ -0,0 +1,17 @@ +#!/bin/bash +# Sets up handy aliases for ceph. +ceph() { + sudo {{ docker_exec_cmd }} ceph --cluster {{ cluster }} ${@} +} + +radosgw-admin() { + sudo {{ docker_exec_cmd }} radosgw-admin --cluster {{ cluster }} ${@} +} + +rados() { + sudo {{ docker_exec_cmd }} rados --cluster {{ cluster }} ${@} +} + +rbd() { + sudo {{ docker_exec_cmd }} rbd --cluster {{ cluster }} ${@} +}