From 5d2eb42f0a600fc4e262dabdee36e0440cdb2537 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 11 Jan 2018 10:59:38 +0100 Subject: [openstack] custom user commands for cloud-init Allow to specify additional user commands executed on all Nova servers provisioned via Heat. An example use case is installing and starting os-collect-config agents to put Nova servers under the configuration management driven via the host openstack cloud Heat services. This allows to integrate with another deployment tools like TripleO. Signed-off-by: Bogdan Dobrelya --- playbooks/openstack/advanced-configuration.md | 4 ++++ roles/openshift_openstack/defaults/main.yml | 2 ++ roles/openshift_openstack/templates/user_data.j2 | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/playbooks/openstack/advanced-configuration.md b/playbooks/openstack/advanced-configuration.md index e8f4cfc32..fee402b32 100644 --- a/playbooks/openstack/advanced-configuration.md +++ b/playbooks/openstack/advanced-configuration.md @@ -273,6 +273,10 @@ openshift_openstack_cluster_node_labels: mylabel: myvalue ``` +`openshift_openstack_provision_user_commands` allows users to execute +additional post-provisioning commands for all of the created Nova servers in +the Heat stack. It configures the `runcmd` directive via cloud-init. + The `openshift_openstack_nodes_to_remove` allows you to specify the numerical indexes of App nodes that should be removed; for example, ['0', '2'], diff --git a/roles/openshift_openstack/defaults/main.yml b/roles/openshift_openstack/defaults/main.yml index 2bdb81632..4e3b7939a 100644 --- a/roles/openshift_openstack/defaults/main.yml +++ b/roles/openshift_openstack/defaults/main.yml @@ -94,6 +94,8 @@ openshift_openstack_etcd_volume_size: 2 openshift_openstack_lb_volume_size: 5 openshift_openstack_ephemeral_volumes: false +# User commands for cloud-init executed on all Nova servers provisioned +openshift_openstack_provision_user_commands: [] # cloud-config openshift_openstack_disable_root: true diff --git a/roles/openshift_openstack/templates/user_data.j2 b/roles/openshift_openstack/templates/user_data.j2 index ccaa5d464..e8185edfb 100644 --- a/roles/openshift_openstack/templates/user_data.j2 +++ b/roles/openshift_openstack/templates/user_data.j2 @@ -11,3 +11,10 @@ write_files: permissions: 440 content: | Defaults:openshift !requiretty + +{% if openshift_openstack_provision_user_commands %} +runcmd: +{% for cmd in openshift_openstack_provision_user_commands %} + - {{ cmd }} +{% endfor %} +{% endif %} -- cgit v1.2.3