aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
blob: 4e2da1e059fede0e6a11b0de1faf0d209c6b40fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
- name: create external net
  shell: |
    . /root/openrc;
    openstack network create --external \
    --provider-physical-network {{ public_net_info.provider_network }} \
    --provider-network-type {{ public_net_info.type }}  {{ public_net_info.network }};
  when:
    - public_net_info.enable == "True"
    - public_net_info.type == "flat"

- name: create external net
  shell: |
    . /root/openrc;
    openstack network create --external \
    --network-segment {{ public_net_info.segment_id }} \
    --provider-physical-network {{ public_net_info.provider_network }} \
    --provider-network-type {{ public_net_info.type }}  {{ public_net_info.network }};
  when:
    - public_net_info.enable == "True"
    - public_net_info.type == "vlan"

- name: create external subnet
  shell: |
    . /root/openrc;
    openstack subnet create --network "{{ public_net_info.network }}" \
    --allocation-pool \
    start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }} \
    --gateway "{{ public_net_info.external_gw }}" \
    --subnet-range "{{ public_net_info.floating_ip_cidr }}" \
    "{{ public_net_info.subnet }}"

- name: create openstack flavors
  shell: |
    . /root/openrc;
    openstack flavor create {{ item.name }} \
    --id {{ item.id }} --ram {{ item.ram }} \
    --disk {{ item.disk }} --vcpus {{ item.vcpus }} || true
  with_items: "{{ flavors }}"

- name: fetch openrc
  fetch:
    src: /root/openrc
    dest: /opt/openrc
    flat: "yes"

- name: fetch haproxy.cert
  fetch:
    src: /etc/ssl/certs/haproxy.cert
    dest: /opt/os_cacert
    flat: "yes"