aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-10-07 09:06:44 +0000
committerGerrit Code Review <review@openstack.org>2016-10-07 09:06:44 +0000
commit77a31346d0b5a2baa8ef30cc9fbcb1b8c13d7044 (patch)
tree124c010f4079751ed8a32813f61868fdca110e28 /ansible
parentb58147bcc0a98f694075b9593bffced1ab63bec0 (diff)
parent96318fed5aafff3d2a9315838cb7e7c0e76eb8f8 (diff)
downloadkolla-77a31346d0b5a2baa8ef30cc9fbcb1b8c13d7044.tar.gz
kolla-77a31346d0b5a2baa8ef30cc9fbcb1b8c13d7044.zip
Merge "Integrate gnocchi with ceph"
Diffstat (limited to 'ansible')
-rw-r--r--ansible/group_vars/all.yml8
-rw-r--r--ansible/roles/gnocchi/defaults/main.yml13
-rw-r--r--ansible/roles/gnocchi/tasks/ceph.yml45
-rw-r--r--ansible/roles/gnocchi/tasks/deploy.yml10
-rw-r--r--ansible/roles/gnocchi/tasks/external_ceph.yml30
-rw-r--r--ansible/roles/gnocchi/templates/gnocchi-api.json.j214
-rw-r--r--ansible/roles/gnocchi/templates/gnocchi-metricd.json.j214
-rw-r--r--ansible/roles/gnocchi/templates/gnocchi-statsd.json.j214
-rw-r--r--ansible/roles/gnocchi/templates/gnocchi.conf.j28
9 files changed, 153 insertions, 3 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 71f86f5d9..73e11047c 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -348,6 +348,13 @@ glance_backend_ceph: "{{ enable_ceph }}"
ceilometer_database_type: "mongodb"
+#################
+# Gnocchi options
+#################
+# Vaid options are [file, ceph]
+gnocchi_backend_storage: "{{ 'ceph' if enable_ceph|bool else 'file' }}"
+
+
#################################
# Cinder options
#################################
@@ -391,6 +398,7 @@ ceph_pool_type: "replicated"
ceph_cinder_pool_name: "volumes"
ceph_cinder_backup_pool_name: "backups"
ceph_glance_pool_name: "images"
+ceph_gnocchi_pool_name: "gnocchi"
ceph_nova_pool_name: "vms"
ceph_erasure_profile: "k=4 m=2 ruleset-failure-domain=host"
diff --git a/ansible/roles/gnocchi/defaults/main.yml b/ansible/roles/gnocchi/defaults/main.yml
index 3dacdee6b..cd80d1695 100644
--- a/ansible/roles/gnocchi/defaults/main.yml
+++ b/ansible/roles/gnocchi/defaults/main.yml
@@ -3,6 +3,19 @@ project_name: "gnocchi"
####################
+# Ceph
+####################
+ceph_gnocchi_pool_type: "{{ ceph_pool_type }}"
+ceph_gnocchi_cache_mode: "{{ ceph_cache_mode }}"
+
+# Due to Ansible issues on include, you cannot override these variables. Please
+# override the variables they reference instead.
+gnocchi_pool_name: "{{ ceph_gnocchi_pool_name }}"
+gnocchi_pool_type: "{{ ceph_gnocchi_pool_type }}"
+gnocchi_cache_mode: "{{ ceph_gnocchi_cache_mode }}"
+
+
+####################
# Database
####################
gnocchi_database_name: "gnocchi"
diff --git a/ansible/roles/gnocchi/tasks/ceph.yml b/ansible/roles/gnocchi/tasks/ceph.yml
new file mode 100644
index 000000000..e5c6d9a16
--- /dev/null
+++ b/ansible/roles/gnocchi/tasks/ceph.yml
@@ -0,0 +1,45 @@
+---
+- name: Ensuring config directory exists
+ file:
+ path: "{{ node_config_directory }}/{{ item }}"
+ state: "directory"
+ when: inventory_hostname in groups[item]
+ with_items:
+ - "gnocchi-api"
+ - "gnocchi-metricd"
+ - "gnocchi-statsd"
+
+- name: Copying over config(s)
+ template:
+ src: roles/ceph/templates/ceph.conf.j2
+ dest: "{{ node_config_directory }}/{{ item }}/ceph.conf"
+ when: inventory_hostname in groups[item]
+ with_items:
+ - "gnocchi-api"
+ - "gnocchi-metricd"
+ - "gnocchi-statsd"
+
+- include: ../../ceph_pools.yml
+ vars:
+ pool_name: "{{ gnocchi_pool_name }}"
+ pool_type: "{{ gnocchi_pool_type }}"
+ cache_mode: "{{ gnocchi_cache_mode }}"
+
+# TODO(SamYaple): Improve changed_when tests
+- name: Pulling cephx keyring
+ command: docker exec ceph_mon ceph auth get-or-create client.gnocchi mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool={{ ceph_gnocchi_pool_name }}, allow rwx pool={{ ceph_gnocchi_pool_name }}-cache'
+ register: cephx_key
+ delegate_to: "{{ groups['ceph-mon'][0] }}"
+ changed_when: False
+ run_once: True
+
+- name: Pushing cephx keyring
+ copy:
+ content: "{{ cephx_key.stdout }}\n\r"
+ dest: "{{ node_config_directory }}/{{ item }}/ceph.client.gnocchi.keyring"
+ mode: "0600"
+ when: inventory_hostname in groups[item]
+ with_items:
+ - "gnocchi-api"
+ - "gnocchi-metricd"
+ - "gnocchi-statsd"
diff --git a/ansible/roles/gnocchi/tasks/deploy.yml b/ansible/roles/gnocchi/tasks/deploy.yml
index df3d43d96..0fb27eca9 100644
--- a/ansible/roles/gnocchi/tasks/deploy.yml
+++ b/ansible/roles/gnocchi/tasks/deploy.yml
@@ -1,4 +1,14 @@
---
+- include: ceph.yml
+ when:
+ - enable_ceph|bool
+ - gnocchi_backend_storage == 'ceph'
+
+- include: external_ceph.yml
+ when:
+ - enable_ceph|bool == False
+ - gnocchi_backend_storage == 'ceph'
+
- include: register.yml
when: inventory_hostname in groups['gnocchi-api']
diff --git a/ansible/roles/gnocchi/tasks/external_ceph.yml b/ansible/roles/gnocchi/tasks/external_ceph.yml
new file mode 100644
index 000000000..623ed8007
--- /dev/null
+++ b/ansible/roles/gnocchi/tasks/external_ceph.yml
@@ -0,0 +1,30 @@
+---
+- name: Ensuring config directory exists
+ file:
+ path: "{{ node_config_directory }}/{{ item }}"
+ state: "directory"
+ when: inventory_hostname in groups[item]
+ with_items:
+ - "gnocchi-api"
+ - "gnocchi-metricd"
+ - "gnocchi-statsd"
+
+- name: Copy over ceph.conf file
+ copy:
+ src: "{{ node_custom_config }}/{{ item }}/ceph.conf"
+ dest: "{{ node_config_directory }}/{{ item }}/ceph.conf"
+ when: inventory_hostname in groups[item]
+ with_items:
+ - "gnocchi-api"
+ - "gnocchi-metricd"
+ - "gnocchi-statsd"
+
+- name: Copy over ceph gnocchi keyring
+ copy:
+ src: "{{ node_custom_config }}/{{ item }}/ceph.client.gnocchi.keyring"
+ dest: "{{ node_config_directory }}/{{ item }}/ceph.client.gnocchi.keryring"
+ when: inventory_hostname in groups[item]
+ with_items:
+ - "gnocchi-api"
+ - "gnocchi-metricd"
+ - "gnocchi-statsd"
diff --git a/ansible/roles/gnocchi/templates/gnocchi-api.json.j2 b/ansible/roles/gnocchi/templates/gnocchi-api.json.j2
index 2e5749f51..373cb2154 100644
--- a/ansible/roles/gnocchi/templates/gnocchi-api.json.j2
+++ b/ansible/roles/gnocchi/templates/gnocchi-api.json.j2
@@ -20,7 +20,19 @@
"dest": "/etc/{{ gnocchi_dir }}/wsgi-gnocchi.conf",
"owner": "gnocchi",
"perm": "0644"
- }
+ }{% if gnocchi_backend_storage == 'ceph' %},
+ {
+ "source": "{{ container_config_directory }}/ceph.conf",
+ "dest": "/etc/ceph/ceph.conf",
+ "owner": "gnocchi",
+ "perm": "0600"
+ },
+ {
+ "source": "{{ container_config_directory }}/ceph.client.gnocchi.keyring",
+ "dest": "/etc/ceph/ceph.client.gnocchi.keyring",
+ "owner": "gnocchi",
+ "perm": "0600"
+ }{% endif %}
]
}
diff --git a/ansible/roles/gnocchi/templates/gnocchi-metricd.json.j2 b/ansible/roles/gnocchi/templates/gnocchi-metricd.json.j2
index b4bfc3f29..1d41f8e79 100644
--- a/ansible/roles/gnocchi/templates/gnocchi-metricd.json.j2
+++ b/ansible/roles/gnocchi/templates/gnocchi-metricd.json.j2
@@ -6,6 +6,18 @@
"dest": "/etc/gnocchi/gnocchi.conf",
"owner": "gnocchi",
"perm": "0600"
- }
+ }{% if gnocchi_backend_storage == 'ceph' %},
+ {
+ "source": "{{ container_config_directory }}/ceph.conf",
+ "dest": "/etc/ceph/ceph.conf",
+ "owner": "gnocchi",
+ "perm": "0600"
+ },
+ {
+ "source": "{{ container_config_directory }}/ceph.client.gnocchi.keyring",
+ "dest": "/etc/ceph/ceph.client.gnocchi.keyring",
+ "owner": "gnocchi",
+ "perm": "0600"
+ }{% endif %}
]
}
diff --git a/ansible/roles/gnocchi/templates/gnocchi-statsd.json.j2 b/ansible/roles/gnocchi/templates/gnocchi-statsd.json.j2
index c2c07f9d1..141e05f7f 100644
--- a/ansible/roles/gnocchi/templates/gnocchi-statsd.json.j2
+++ b/ansible/roles/gnocchi/templates/gnocchi-statsd.json.j2
@@ -6,6 +6,18 @@
"dest": "/etc/gnocchi/gnocchi.conf",
"owner": "gnocchi",
"perm": "0600"
- }
+ }{% if gnocchi_backend_storage == 'ceph' %},
+ {
+ "source": "{{ container_config_directory }}/ceph.conf",
+ "dest": "/etc/ceph/ceph.conf",
+ "owner": "gnocchi",
+ "perm": "0600"
+ },
+ {
+ "source": "{{ container_config_directory }}/ceph.client.gnocchi.keyring",
+ "dest": "/etc/ceph/ceph.client.gnocchi.keyring",
+ "owner": "gnocchi",
+ "perm": "0600"
+ }{% endif %}
]
}
diff --git a/ansible/roles/gnocchi/templates/gnocchi.conf.j2 b/ansible/roles/gnocchi/templates/gnocchi.conf.j2
index 6493343b0..30d8e33c1 100644
--- a/ansible/roles/gnocchi/templates/gnocchi.conf.j2
+++ b/ansible/roles/gnocchi/templates/gnocchi.conf.j2
@@ -44,5 +44,13 @@ memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
[storage]
+{% if gnocchi_backend_storage == 'file' %}
driver = file
file_basepath = /var/lib/gnocchi
+{% elif gnocchi_backend_storage == 'ceph' %}
+driver = ceph
+ceph_pool = {{ gnocchi_pool_name }}
+ceph_username = gnocchi
+ceph_keyring = /etc/ceph/ceph.client.gnocchi.keyring
+ceph_conffile = /etc/ceph/ceph.conf
+{% endif %}