2 # Copyright 2020 British Telecommunications plc
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # Author: Antonio Marsico (antonio.marsico@bt.com)
17 - name: Launch OSM instances
19 cloud: "{{ cloud_name }}"
20 name: "{{ prefix }}-{{ item.name }}"
22 key_name: "{{ item.key }}"
23 nics: "{{ item.nics }}"
24 image: "{{ item.image }}"
25 flavor: "{{ item.flavor }}"
28 - "{{external_network_name}}_access"
29 with_items: "{{ servers }}"
31 when: setup_volume|bool == False
33 - name: Launch OSM instances with a volume
35 cloud: "{{ cloud_name }}"
36 name: "{{ prefix }}-{{ item.name }}"
38 key_name: "{{ item.key }}"
39 nics: "{{ item.nics }}"
40 image: "{{ item.image }}"
41 flavor: "{{ item.flavor }}"
46 - "{{external_network_name}}_access"
47 with_items: "{{ servers }}"
48 register: "os_hosts_with_volume"
49 when: setup_volume|bool == True
52 os_hosts: "{{ os_hosts_with_volume }}"
53 when: setup_volume|bool == True
55 - name: Add OSM host to the local Ansible inventory
57 name: "{{ item.openstack.accessIPv4 }}"
58 groups: "{{ item['item']['meta']['group'] }}"
59 ansible_private_key_file: "~/.ssh/{{ os_key_name }}"
60 ansible_user: "{{ item['item']['user'] }}"
61 with_items: "{{ os_hosts.results }}"