From cb16f959b788e6b0335e32bf5508b2af5795aff0 Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Thu, 15 Oct 2015 17:37:48 +0200 Subject: [PATCH] Add initial support for creating volumes For some services it may be desirable to have instances using cinder volumes, this change allows to define that in the infra_config.yml inventory and the provision_infra_servers will create them. A follow-up patch will attach the volumes defined on each instance. Change-Id: I28d187569655fbbc45cec0bce771ce8adab1f4dd --- infra_config.yml.sample | 5 +++++ roles/provision_infra_servers/tasks/main.yml | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/infra_config.yml.sample b/infra_config.yml.sample index 4c9abfc..945b044 100644 --- a/infra_config.yml.sample +++ b/infra_config.yml.sample @@ -28,6 +28,11 @@ infra_servers: net_name: your_neutron_network security_groups: "default,webserver" infra_type: gerrit + volumes: + - name: gerrit_volume + size: 40 + - name: gerrit_volume2 + size: 60 - name: nodepool image: 9d25fe2d-cf31-4b05-8c58-f238ec78e633 flavor: standard.small diff --git a/roles/provision_infra_servers/tasks/main.yml b/roles/provision_infra_servers/tasks/main.yml index 2abeace..47bd9b1 100644 --- a/roles/provision_infra_servers/tasks/main.yml +++ b/roles/provision_infra_servers/tasks/main.yml @@ -16,3 +16,13 @@ group: infra infra_type: "{{ item.infra_type }}" with_items: infra_servers + +- name: Create OpenStack volumes + os_volume: + state: present + cloud: "{{item.os_client_config_cloud | default(os_client_config_cloud) }}" + display_name: "{{ item.1.name }}" + size: "{{ item.1.size }}" + with_subelements: + - infra_servers + - volumes