diff options
author | John O Loughlin <john.oloughlin@intel.com> | 2018-02-15 18:24:52 +0000 |
---|---|---|
committer | John O'Loughlin <john.oloughlin@intel.com> | 2018-03-06 08:52:20 +0000 |
commit | 33189462c6fd60496ae1afec093fb9803d23a18b (patch) | |
tree | 141775861de3e39dcf5aa8f706c150b8acd8b931 /ansible/roles/infra_check_requirements/tasks | |
parent | 44f31bf01c787501d0c077730d4b76bb02a3faaf (diff) |
Allow VMs to access internet
Add option to the config file for default network.
Check to see if 1 default network is defined.
Enable nat on all defined networks.
Add default gateway to VM
JIRA: YARDSTICK-1016
Change-Id: Ie943a7c7b4f1a9673774cf8fedaba0af352cd7f4
Signed-off-by: John O Loughlin <john.oloughlin@intel.com>
Diffstat (limited to 'ansible/roles/infra_check_requirements/tasks')
-rw-r--r-- | ansible/roles/infra_check_requirements/tasks/main.yml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ansible/roles/infra_check_requirements/tasks/main.yml b/ansible/roles/infra_check_requirements/tasks/main.yml index 8d05bbdb7..a11bc56a1 100644 --- a/ansible/roles/infra_check_requirements/tasks/main.yml +++ b/ansible/roles/infra_check_requirements/tasks/main.yml @@ -34,6 +34,22 @@ msg: "Failed, not enough CPU, required: {{ vcpu_t }}, available {{ ansible_processor_vcpus }}" when: ansible_processor_vcpus < vcpu_t|int +- name: Define default network counter + set_fact: + num_default_network_detected: 0 + +- name: Increment counter for every default network detected + set_fact: + num_default_network_detected: "{{ num_default_network_detected|int + 1 }}" + when: + - item.default_gateway is defined + - item.default_gateway == True + with_items: "{{infra_deploy_vars.networks}}" + +- name: Fail if more than 1 or 0 default networks + fail: + msg: "Failed, there must be 1 default network: {{ num_default_network_detected }} detected" + when: num_default_network_detected|int != 1 - name: Fail if not enough Disk space set_fact: |