Created
November 28, 2013 03:03
-
-
Save geowa4/7686681 to your computer and use it in GitHub Desktop.
Ansible playbook to provision some servers on Rackspace and generate a static hosts file to save for later. This is useful for creating a quick QA or development deployment with multiple groups. Also consider the "add_host" module for adding to your in-memory host configuration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[a] | |
{% for a in a_provision.instances %} | |
{{ a.rax_accessipv4 }} | |
{% endfor %} | |
[b] | |
{% for b in b_provision.instances %} | |
{{ b.rax_accessipv4 }} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: a - build request | |
local_action: | |
module: rax | |
username: username | |
api_key: key | |
name: test-a | |
count: 1 | |
flavor: 3 | |
image: a-image-id | |
files: | |
/root/.ssh/authorized_keys: ~/.ssh/id_rsa.pub | |
state: present | |
wait: yes | |
wait_timeout: 1000 | |
networks: | |
- private | |
- public | |
register: a_provision | |
- name: b - build request | |
local_action: | |
module: rax | |
username: username | |
api_key: key | |
name: test-b | |
flavor: 5 | |
image: b-image-id | |
files: | |
/root/.ssh/authorized_keys: ~/.ssh/id_rsa.pub | |
state: present | |
wait: yes | |
wait_timeout: 1000 | |
networks: | |
- private | |
- public | |
register: b_provision | |
- name: add new nodes to hosts configuration | |
template: 'src=hosts.j2 dest=provisioned_hosts' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment