12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- ---
- - name: create resource group
- azure_rm_resourcegroup:
- name: "{{ openshift_azure_resource_group_name }}"
- location: "{{ openshift_azure_resource_location }}"
- tags:
- now: "{{ lookup('pipe', 'date +%s') }}"
- - name: create vnet
- azure_rm_virtualnetwork:
- name: vnet
- resource_group: "{{ openshift_azure_resource_group_name }}"
- address_prefixes:
- - 192.168.0.0/16
- - name: create subnet
- azure_rm_subnet:
- name: subnet
- resource_group: "{{ openshift_azure_resource_group_name }}"
- virtual_network: vnet
- address_prefix: 192.168.0.0/24
- - name: calculate input image
- command: az image list -g "{{ image_resource_group }}" --query "[?starts_with(name, '{{ image_prefix }}-') && tags.valid=='true'] | sort_by(@, &name) | [-1]"
- register: input_image
- - name: create vm
- command: >
- az vm create
- -n vm
- -g "{{ openshift_azure_resource_group_name }}"
- --size Standard_D4s_v3
- --image "{{ (input_image.stdout | from_json).id }}"
- --storage-sku Standard_LRS
- --admin-username cloud-user
- --ssh-dest-key-path /home/cloud-user/.ssh/authorized_keys
- --ssh-key-value "{{ openshift_azure_vm_ssh_public_key }}"
- {% if create_args is defined %}{{ create_args }}{% endif %}
- register: vm
- - name: add vm to inventory
- add_host:
- groups: nodes
- name: "{{ (vm.stdout | from_json).publicIpAddress }}"
- ansible_ssh_user: cloud-user
- ansible_become: True
|