diff --git a/README.md b/README.md index 129731e..7a88c09 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,13 @@ $ export MOLECULE_NO_LOG=False # not so verbose, helpful $ export MOLECULE_DEBUG=True # very verbose, last ditch effort ``` +You may also define a custom resource namespace by exposing the following +environment variables, for example in CI workflows: + +```bash +$ export RESOURCE_NAMESPACE=e121dc64ff615ccdfac71bb5c00296b9 # Ensure the value length is <= 32 +``` + ## Development ### Testing diff --git a/molecule_hetznercloud/playbooks/create.yml b/molecule_hetznercloud/playbooks/create.yml index ec5cf9a..b35c666 100644 --- a/molecule_hetznercloud/playbooks/create.yml +++ b/molecule_hetznercloud/playbooks/create.yml @@ -5,7 +5,7 @@ gather_facts: false no_log: "{{ molecule_no_log }}" vars: - resource_namespace: "{{ molecule_scenario_directory | md5 }}" + resource_namespace: "{{ lookup('ansible.builtin.env', 'RESOURCE_NAMESPACE') | default(molecule_scenario_directory | md5, true) }}" ssh_port: 22 ssh_user: root diff --git a/molecule_hetznercloud/playbooks/destroy.yml b/molecule_hetznercloud/playbooks/destroy.yml index 12c4250..f911e02 100644 --- a/molecule_hetznercloud/playbooks/destroy.yml +++ b/molecule_hetznercloud/playbooks/destroy.yml @@ -5,7 +5,7 @@ gather_facts: false no_log: "{{ molecule_no_log }}" vars: - resource_namespace: "{{ molecule_scenario_directory | md5 }}" + resource_namespace: "{{ lookup('ansible.builtin.env', 'RESOURCE_NAMESPACE') | default(molecule_scenario_directory | md5, true) }}" tasks: - name: Populate the instance config ansible.builtin.set_fact: