mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
961 B
YAML
30 lines
961 B
YAML
7 years ago
|
- name: Create random dns label
|
||
|
set_fact:
|
||
|
dns_label: "test{{ resource_group | hash('md5') | truncate(16, True, '') + (65535 | random | string) }}"
|
||
|
|
||
7 years ago
|
- name: Create Azure Deploy
|
||
|
azure_rm_deployment:
|
||
7 years ago
|
resource_group: "{{ resource_group }}"
|
||
|
location: "eastus"
|
||
7 years ago
|
template_link: 'https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-linux/azuredeploy.json'
|
||
7 years ago
|
deployment_name: "{{ dns_label }}"
|
||
7 years ago
|
parameters:
|
||
|
adminUsername:
|
||
7 years ago
|
value: chouseknecht
|
||
7 years ago
|
adminPassword:
|
||
|
value: password123!
|
||
|
dnsLabelPrefix:
|
||
7 years ago
|
value: "{{ dns_label }}"
|
||
7 years ago
|
ubuntuOSVersion:
|
||
7 years ago
|
value: "16.04.0-LTS"
|
||
7 years ago
|
register: output
|
||
|
|
||
|
- name: Add new instance to host group
|
||
|
add_host:
|
||
|
hostname: "{{ item.vm_name }}"
|
||
|
ansible_host: "{{ item['ips'][0].public_ip }}"
|
||
|
ansible_user: chouseknecht
|
||
|
ansible_ssh_pass: password123!
|
||
|
groupname: azure_vms
|
||
|
with_items: "{{ output.deployment.instances }}"
|