ansible '*' -m shell -p uptime
pypi.dfw.openstack.org:
image_name: Ubuntu 12.04.4
flavor_ram: 2048
region: DFW
cloud: rackspace
volumes:
- size: 200
mount: /srv
pypi.region-b.geo-1.openstack.org:
image_name: Ubuntu 12.04.4
flavor_ram: 2048
region: region-b.geo-1
cloud: hp
volumes:
- size: 200
mount: /srv
pypi:
image_name: Ubuntu 12.04.4
flavor_ram: 2048
volumes:
- size: 200
mount: /srv
hosts:
pypi.dfw:
region: DFW
pypi.iad:
region: IAD
pypi.ord:
region: ORD
pypi.region-b.geo-1:
cloud: hp
---
- name: Launch Node
os_compute:
cloud: "{{ cloud }}"
region_name: "{{ region_name }}"
name: "{{ name }}"
image_name: "{{ image_name }}"
flavor_ram: "{{ flavor_ram }}"
flavor_include: "{{ flavor_include }}"
meta:
group: "{{ group }}"
key_name: "{{ launch_keypair }}"
register: node
- name: Create volumes
os_volume:
cloud: "{{ cloud }}"
size: "{{ item.size }}"
display_name: "{{ item.display_name }}"
with_items: volumes
- name: Attach volumes
os_compute_volume:
cloud: "{{ cloud }}"
server_id: "{{ node.id }}"
volume_name: "{{ item.display_name }}"
with_items: volumes
register: attached_volumes
- debug: var=attached_volumes
- name: Re-request server to get up to date metadata after the volume loop
os_compute_facts:
cloud: "{{ cloud }}"
name: "{{ name }}"
when: attached_volumes.changed
- name: Wait for SSH to work
wait_for: host={{ node.openstack.interface_ip }} port=22
when: node.changed == True
- name: Add SSH host key to known hosts
shell: ssh-keyscan "{{ node.openstack.interface_ip|quote }}" >> ~/.ssh/known_hosts
when: node.changed == True
- name: Add all instance public IPs to host group
add_host:
name: "{{ node.openstack.interface_ip }}"
groups: "{{ provision_group }}"
openstack: "{{ node.openstack }}"
when: attached_volumes|length == 0
- name: Add all instance public IPs to host and volumes group
add_host:
name: "{{ node.openstack.interface_ip }}"
groups: "{{ provision_group }},hasvolumes"
openstack: "{{ node.openstack }}"
when: attached_volumes|length != 0
"pypi.dfw.openstack.org": {
"ansible_ssh_host": "23.253.237.8",
"openstack": {
"HUMAN_ID": true,
"NAME_ATTR": "name",
"OS-DCF:diskConfig": "MANUAL",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
"accessIPv4": "23.253.237.8",
"accessIPv6": "2001:4800:7817:104:d256:7a33:5187:7e1b",
"addresses": {
"private": [
{
"addr": "10.208.195.50",
"version": 4
}
],
"public": [
{
"addr": "23.253.237.8",
"version": 4
},
{
"addr": "2001:4800:7817:104:d256:7a33:5187:7e1b",
"version": 6
}
]
},
"cloud": "rax",
"config_drive": "",
"created": "2014-09-05T15:32:14Z",
"flavor": {
"id": "performance1-4",
"links": [
{
"href": "https://dfw.servers.api.rackspacecloud.com/610275/flavors/performance1-4",
"rel": "bookmark"
}
],
"name": "4 GB Performance"
},
"hostId": "adb603d4566efe0392756c76dab38ffcba22099368837c7973321e77",
"human_id": "pypidfwopenstackorg",
"id": "de672205-9245-46b6-b3df-489ccf9e0c17",
"image": {
"id": "928e709d-35f0-47eb-b296-d18e1b0a76b7",
"links": [
{
"href": "https://dfw.servers.api.rackspacecloud.com/610275/images/928e709d-35f0-47eb-b296-d18e1b0a76b7",
"rel": "bookmark"
}
]
},
"interface_ip": "23.253.237.8",
"key_name": "launch-node-root",
"links": [
{
"href": "https://dfw.servers.api.rackspacecloud.com/v2/610275/servers/de672205-9245-46b6-b3df-489ccf9e0c17",
"rel": "self"
},
{
"href": "https://dfw.servers.api.rackspacecloud.com/610275/servers/de672205-9245-46b6-b3df-489ccf9e0c17",
"rel": "bookmark"
}
],
"metadata": {},
"name": "pypi.dfw.openstack.org",
"networks": {
"private": [
"10.208.195.50"
],
"public": [
"23.253.237.8",
"2001:4800:7817:104:d256:7a33:5187:7e1b"
]
},
"progress": 100,
"region": "DFW",
"status": "ACTIVE",
"tenant_id": "610275",
"updated": "2014-09-05T15:32:49Z",
"user_id": "156284",
"volumes": [
{
"HUMAN_ID": false,
"NAME_ATTR": "name",
"attachments": [
{
"device": "/dev/xvdb",
"host_name": null,
"id": "c6f5229c-1cc0-47c4-aab7-60db1f6cf8e8",
"server_id": "de672205-9245-46b6-b3df-489ccf9e0c17",
"volume_id": "c6f5229c-1cc0-47c4-aab7-60db1f6cf8e8"
}
],
"availability_zone": "nova",
"bootable": "false",
"created_at": "2014-09-05T14:37:42.000000",
"device": "/dev/xvdb",
"display_description": null,
"display_name": "pypi.dfw.openstack.org/main01",
"human_id": null,
"id": "c6f5229c-1cc0-47c4-aab7-60db1f6cf8e8",
"metadata": {
"readonly": "False",
"storage-node": "1845027a-5e07-47a1-9572-3eea4716f726"
},
"os-vol-tenant-attr:tenant_id": "610275",
"size": 200,
"snapshot_id": null,
"source_volid": null,
"status": "in-use",
"volume_type": "SATA"
}
]
}
},
ansible can just pass secrets to puppet apply as parameters
but that's another talk