|
|
@ -94,19 +94,23 @@ notes:
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
# Create a server
|
|
|
|
- name: Build a Cloud Server
|
|
|
|
- local_action:
|
|
|
|
gather_facts: False
|
|
|
|
module: rax
|
|
|
|
|
|
|
|
credentials: ~/.raxpub
|
|
|
|
tasks:
|
|
|
|
service: cloudservers
|
|
|
|
- name: Server build request
|
|
|
|
name: rax-test1
|
|
|
|
local_action:
|
|
|
|
flavor: 5
|
|
|
|
module: rax
|
|
|
|
image: b11d9567-e412-4255-96b9-bd63ab23bcfe
|
|
|
|
credentials: ~/.raxpub
|
|
|
|
files:
|
|
|
|
service: cloudservers
|
|
|
|
/root/.ssh/authorized_keys: /home/localuser/.ssh/id_rsa.pub
|
|
|
|
name: rax-test1
|
|
|
|
/root/test.txt: /home/localuser/test.txt
|
|
|
|
flavor: 5
|
|
|
|
wait: yes
|
|
|
|
image: b11d9567-e412-4255-96b9-bd63ab23bcfe
|
|
|
|
state: present
|
|
|
|
files:
|
|
|
|
|
|
|
|
/root/.ssh/authorized_keys: /home/localuser/.ssh/id_rsa.pub
|
|
|
|
|
|
|
|
/root/test.txt: /home/localuser/test.txt
|
|
|
|
|
|
|
|
wait: yes
|
|
|
|
|
|
|
|
state: present
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
@ -196,7 +200,7 @@ def cloudservers(module, state, name, flavor, image, meta, key_name, files,
|
|
|
|
# See if we can find a server that matches our credentials
|
|
|
|
# See if we can find a server that matches our credentials
|
|
|
|
for server in servers:
|
|
|
|
for server in servers:
|
|
|
|
if server.name == name:
|
|
|
|
if server.name == name:
|
|
|
|
if server.flavor['id'] == flavor and \
|
|
|
|
if int(server.flavor['id']) == int(flavor) and \
|
|
|
|
server.image['id'] == image and \
|
|
|
|
server.image['id'] == image and \
|
|
|
|
server.metadata == meta:
|
|
|
|
server.metadata == meta:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|