diff options
author | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2020-06-15 16:29:35 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-07-30 09:02:56 +0000 |
commit | a879e2a54e0641b692202d417021f1824032b123 (patch) | |
tree | bfd772a87544023cbe0315eebaa69d1fcaac6256 /deployment/noheat/infra-openstack/ansible | |
parent | 3d9bd5abfcb9bf55e3dd1b53cb3b6bc4bd45c0d1 (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')
7 files changed, 56 insertions, 0 deletions
diff --git a/deployment/noheat/infra-openstack/ansible/create.yml b/deployment/noheat/infra-openstack/ansible/create.yml new file mode 100644 index 000000000..dd21271b2 --- /dev/null +++ b/deployment/noheat/infra-openstack/ansible/create.yml @@ -0,0 +1,7 @@ +--- +- name: Create infrastructure + hosts: localhost + connection: local + gather_facts: False + roles: + - openstack/create_devstack_network diff --git a/deployment/noheat/infra-openstack/ansible/destroy.yml b/deployment/noheat/infra-openstack/ansible/destroy.yml new file mode 100644 index 000000000..b63e07088 --- /dev/null +++ b/deployment/noheat/infra-openstack/ansible/destroy.yml @@ -0,0 +1,7 @@ +--- +- name: Destroy infrastructure + hosts: localhost + connection: local + gather_facts: False + roles: + - openstack/destroy_devstack_network diff --git a/deployment/noheat/infra-openstack/ansible/group_vars/all.yml b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml new file mode 100644 index 000000000..68497a0a5 --- /dev/null +++ b/deployment/noheat/infra-openstack/ansible/group_vars/all.yml @@ -0,0 +1,4 @@ +--- +network: + name: "onap_ci_lab" + cidr: "192.168.1.0/24" 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 }}" |