aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
blob: fb0dc67d953af2940f22512357162bfe8cefbc73 (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
60
61
62
63
64
65
66
67
68
69
70
71
#############################################################################
# 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"
    - inventory_hostname == groups['utility_all'][0]

- 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"
    - inventory_hostname == groups['utility_all'][0]

- 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 }}"
  when:
    - public_net_info.enable == "True"
    - inventory_hostname == groups['utility_all'][0]

- 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 }}"
  when:
    - inventory_hostname == groups['utility_all'][0]


- name: fetch openrc
  fetch:
    src: /root/openrc
    dest: /opt/openrc
    flat: "yes"
  when:
    - inventory_hostname == groups['utility_all'][0]

- name: fetch haproxy.cert
  fetch:
    src: /etc/ssl/certs/haproxy.cert
    dest: /opt/os_cacert
    flat: "yes"
  when:
    - inventory_hostname == groups['network_hosts'][0]