aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/noheat/infra-openstack/ansible/roles
diff options
context:
space:
mode:
authorPawel Wieczorek <p.wieczorek2@samsung.com>2020-06-15 16:29:35 +0200
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-07-30 09:02:56 +0000
commita879e2a54e0641b692202d417021f1824032b123 (patch)
treebfd772a87544023cbe0315eebaa69d1fcaac6256 /deployment/noheat/infra-openstack/ansible/roles
parent3d9bd5abfcb9bf55e3dd1b53cb3b6bc4bd45c0d1 (diff)
Add Ansible roles for OpenStack network
This patch also adds Vagrant provisioners for creating and destroying OpenStack infrastructure. These are set to never run (unless explicitly called by the operator) because DevStack instance on a separate machine might not be ready to provide OpenStack API. This patch is based on previous work by: Krzysztof Opasiak <k.opasiak@samsung.com> Test harness is based on blog post [1] by: Chris Morgan <me@chrismorgan.info> [1] https://chrismorgan.info/blog/make-and-git-diff-test-harness Issue-ID: INT-1601 Change-Id: I031ca7a5a43cca0258dc0dc9e0339182c431898a Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Diffstat (limited to 'deployment/noheat/infra-openstack/ansible/roles')
-rw-r--r--deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/create_network.yml20
-rw-r--r--deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/main.yml4
-rw-r--r--deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/destroy_network.yml10
-rw-r--r--deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/main.yml4
4 files changed, 38 insertions, 0 deletions
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/create_network.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/create_network.yml
new file mode 100644
index 000000000..5d86858c1
--- /dev/null
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/create_network.yml
@@ -0,0 +1,20 @@
+---
+- name: "Create {{ net.name }} network"
+ os_network:
+ name: "{{ net.name }}"
+ state: present
+
+- name: "Create {{ net.name }} subnet"
+ os_subnet:
+ name: "{{ net.name }}_subnet"
+ network_name: "{{ net.name }}"
+ cidr: "{{ net.cidr }}"
+ state: present
+
+- name: "Create {{ net.name }} router"
+ os_router:
+ name: "{{ net.name }}_router"
+ network: public
+ interfaces:
+ - "{{ net.name }}_subnet"
+ state: present
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/main.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/main.yml
new file mode 100644
index 000000000..5c8af745f
--- /dev/null
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_network/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+- include: create_network.yml net={{ item }}
+ with_items:
+ - "{{ network }}"
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/destroy_network.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/destroy_network.yml
new file mode 100644
index 000000000..8f97d9507
--- /dev/null
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/destroy_network.yml
@@ -0,0 +1,10 @@
+---
+- name: "Destroy {{ net.name }} router"
+ os_router:
+ name: "{{ net.name }}_router"
+ state: absent
+
+- name: "Destroy {{ net.name }} network and its subnets"
+ os_network:
+ name: "{{ net.name }}"
+ state: absent
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/main.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/main.yml
new file mode 100644
index 000000000..1bfab0d00
--- /dev/null
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/destroy_devstack_network/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+- include: destroy_network.yml net={{ item }}
+ with_items:
+ - "{{ network }}"