Skip to content

Commit 139104b

Browse files
committed
Use the environment name as the VM prefix
To make it possible to have several independent environments at the same time, use a custom prefix for the VMs on each environment instead of the default 'playbooks' value (which is the name of the directory). Signed-off-by: Xavi Hernandez <[email protected]>
1 parent f236baa commit 139104b

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

playbooks/roles/local.defaults/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
variant: "{{ (backend | default('xfs') | split('.'))[1] | default('default') }}"
1414
max_memory: "{{ ansible_memfree_mb }}"
1515
max_cpu: "{{ ansible_processor_nproc }}"
16+
vm_prefix: "{{ lookup('env', 'SITE_NAME') | default('site', true) }}"
1617

1718
- name: Load configuration
1819
include_vars:

playbooks/roles/local.defaults/templates/config.yml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ config:
1616
name: "{{ be }}"
1717
variant: "{{ variant }}"
1818

19+
vm_prefix: "{{ vm_prefix }}_"
20+
1921
data: {{ environments[be].data | default({}) }}
2022

2123
paths: {{ paths }}

playbooks/roles/provisioner.vagrant/templates/Vagrantfile.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Vagrant.configure("2") do |config|
1919
# taken from:
2020
# https://github.com/heketi/heketi/pull/1008
2121
v.cpu_mode = 'host-passthrough'
22+
23+
v.default_prefix = '{{ config.vm_prefix }}'
2224
end
2325
{% for host in data.hosts %}
2426
{%- set node = config.nodes[host] %}

0 commit comments

Comments
 (0)