Requirements for CentOS:
- yum install pip
- pip install linode-python
- pip install chube
Template:
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
#### CentOS: yum install pip ; pip install linode-python ; pip install chube | |
#### | |
- hosts: localhost | |
connection: local | |
gather_facts: false | |
tasks: | |
- name: Create linode server | |
linode: | |
api_key: '---LINODE-API-KEY-HERE---' | |
name: linodeserver | |
plan: 1 #cheapest | |
datacenter: 6 #newmark NJ | |
distribution: 127 #centos 6.5 | |
password: '-AUX-PASSWORD-HERE' | |
ssh_pub_key: 'ssh-rsa AAAAB3NzaC----RSA HERE-----' | |
wait: yes | |
wait_timeout: 300 | |
state: present | |
register: linode | |
- name: Adding the new box to the dynamic inventory | |
add_host: hostname="{{ linode.instance.ipv4 }}" groupname=linodehosts | |
- name: Wait for SSH to come up | |
local_action: wait_for host="{{ linode.instance.ipv4 }}" port=22 delay=60 timeout=320 state=started | |
- name: Cooking the instance.... | |
hosts: linodehosts | |
user: root | |
gather_facts: true | |
roles: | |
- base |
This values are from the API:
plan: 1 #cheapest
datacenter: 6 #newmark NJ
distribution: 127 #centos 6.5
There are different values and you will need to ask them to the API so, to see full info of these three from Linode API (distributions IDs, datacenters and plans), you can run this nodejs script:
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
#!/usr/bin/env node | |
// sudo npm install linode-api -g | |
// Show distribution list & datacenter list & linode plans | |
var my_api_key = '---KEY-HERE-----'; | |
var client = new(require('linode-api').LinodeClient)(my_api_key); | |
client.call('avail.distributions', {}, function (err, res) { | |
if (err) throw err; | |
console.log(res); | |
}); | |
client.call('avail.datacenters', {}, function (err, res) { | |
if (err) throw err; | |
console.log(res); | |
}); | |
client.call('avail.linodeplans', {}, function (err, res) { | |
if (err) throw err; | |
console.log(res); | |
}); |
Dont forget the sudo npm install linode-api -g
:)
Fast Mode OFF!