Skip to content

Instantly share code, notes, and snippets.

@nicholaskuechler
nicholaskuechler / gist:72ae99ef1acc85a712fe
Created Jan 9, 2015
ansible playbook output - create rackspace cloud server, add dns entries, and install packages using roles
View gist:72ae99ef1acc85a712fe
(rackspace)nick@mbp: ~/ansible-rackspace-servers$ ansible-playbook -i venv-inventory.yml build-cloud-server.yml
PLAY [Create a Rackspace Cloud Server] ****************************************
TASK: [Rackspace cloud server build request] **********************************
ok: [localhost -> 127.0.0.1]
TASK: [Add new cloud server to host group] ************************************
ok: [localhost -> 127.0.0.1] => (item={u'status': u'ACTIVE', u'rax_name': u'admin.enhancedtest.net', u'rax_metadata': {}, u'rax_progress': 100, u'rax_os-dcf_diskconfig': u'MANUAL', u'rax_human_id': u'adminenhancedtestnet', u'rax_addresses': {u'public': [{u'version': 6, u'addr': u'2001:4800:7818:104:be76:4eff:fe05:3c58'}, {u'version': 4, u'addr': u'104.130.158.89'}], u'private': [{u'version': 4, u'addr': u'10.209.36.188'}]}, u'rax_image': {u'id': u'0766e5df-d60a-4100-ae8c-07f27ec0148f', u'links': [{u'href': u'https://dfw.servers.api.rackspacecloud.com/HIDDEN/images/0766e5df-d60a-4100-ae8c-07f27ec0148f', u'rel': u'bookmark'}]}, u'rax_
@nicholaskuechler
nicholaskuechler / gist:d2562ef1c780cdeffe14
Created Jan 9, 2015
ansible playbook output - create cloud server and add dns entries - second run
View gist:d2562ef1c780cdeffe14
PLAY [Create a Rackspace Cloud Server] ****************************************
TASK: [Rackspace cloud server build request] **********************************
ok: [localhost -> 127.0.0.1]
TASK: [Add new cloud server to host group] ************************************
ok: [localhost -> 127.0.0.1] => (item={u'status': u'ACTIVE', u'rax_name': u'admin.enhancedtest.net', u'rax_metadata': {}, u'rax_progress': 100, u'rax_os-dcf_diskconfig': u'MANUAL', u'rax_human_id': u'adminenhancedtestnet', u'rax_addresses': {u'public': [{u'version': 6, u'addr': u'2001:4800:7818:104:be76:4eff:fe05:3c58'}, {u'version': 4, u'addr': u'104.130.158.89'}], u'private': [{u'version': 4, u'addr': u'10.209.36.188'}]}, u'rax_image': {u'id': u'0766e5df-d60a-4100-ae8c-07f27ec0148f', u'links': [{u'href': u'https://dfw.servers.api.rackspacecloud.com/HIDDEN/images/0766e5df-d60a-4100-ae8c-07f27ec0148f', u'rel': u'bookmark'}]}, u'rax_user_id': u'HIDDEN', u'rax_links': [{u'href': u'https://dfw.servers.api.rackspacecloud.com/v2/HIDDEN/servers/0221
@nicholaskuechler
nicholaskuechler / gist:f6a01223252b89dea959
Created Jan 9, 2015
ansible playbook output - create cloud server and add dns entries
View gist:f6a01223252b89dea959
PLAY [Create a Rackspace Cloud Server] ****************************************
TASK: [Rackspace cloud server build request] **********************************
ok: [localhost -> 127.0.0.1]
TASK: [Add new cloud server to host group] ************************************
ok: [localhost -> 127.0.0.1] => (item={u'status': u'ACTIVE', u'rax_name': u'admin.enhancedtest.net', u'rax_metadata': {}, u'rax_progress': 100, u'rax_os-dcf_diskconfig': u'MANUAL', u'rax_human_id': u'adminenhancedtestnet', u'rax_addresses': {u'public': [{u'version': 6, u'addr': u'2001:4800:7818:104:be76:4eff:fe05:3c58'}, {u'version': 4, u'addr': u'104.130.158.89'}], u'private': [{u'version': 4, u'addr': u'10.209.36.188'}]}, u'rax_image': {u'id': u'0766e5df-d60a-4100-ae8c-07f27ec0148f', u'links': [{u'href': u'https://dfw.servers.api.rackspacecloud.com/HIDDEN/images/0766e5df-d60a-4100-ae8c-07f27ec0148f', u'rel': u'bookmark'}]}, u'rax_user_id': u'HIDDEN', u'rax_links': [{u'href': u'https://dfw.servers.api.rackspacecloud.com/v2/HIDDEN/servers/0221
@nicholaskuechler
nicholaskuechler / gist:85aa9e21998bea87a3c5
Created Jan 9, 2015
Output from ansible playbook to build a Rackspace Cloud Server
View gist:85aa9e21998bea87a3c5
(rackspace)nick@mbp: ~/ansible-rackspace-servers$ ansible-playbook -i virtualenv-inventory.yml build-cloud-server.yml -vvvv
PLAY [Create a Rackspace Cloud Server] ****************************************
TASK: [Rackspace cloud server build request] **********************************
<127.0.0.1> REMOTE_MODULE rax flavor=performance1-1 credentials=/Users/nick/.rackspace_cloud_credentials image=0766e5df-d60a-4100-ae8c-07f27ec0148f state=present region=DFW name=admin.enhancedtest.net
<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1420388644.87-43356630392997 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1420388644.87-43356630392997 && echo $HOME/.ansible/tmp/ansible-tmp-1420388644.87-43356630392997']
<127.0.0.1> PUT /var/folders/rk/mr3kdp7s0xndgkd8p20_wdkc0000gn/T/tmpXID16W TO /Users/nick/.ansible/tmp/ansible-tmp-1420388644.87-43356630392997/rax
<127.0.0.1> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /Users/nick/virtualenvs/rackspace/bin/python /Users/nick/.ansible
@nicholaskuechler
nicholaskuechler / gist:8f4812226c6a908dbc9a
Created Jan 4, 2015
pip install ansible inside of a virtualenv
View gist:8f4812226c6a908dbc9a
(rackspace_cloud)nick@mbp: ~/virtualenvs$ pip install ansible
Downloading/unpacking ansible
Downloading ansible-1.8.2.tar.gz (754kB): 754kB downloaded
Running setup.py (path:/Users/nick/virtualenvs/rackspace_cloud/build/ansible/setup.py) egg_info for package ansible
no previously-included directories found matching 'lib/ansible/modules/core/.git'
no previously-included directories found matching 'lib/ansible/modules/extras/.git'
Downloading/unpacking paramiko (from ansible)
Downloading paramiko-1.15.2-py2.py3-none-any.whl (165kB): 165kB downloaded
Downloading/unpacking jinja2 (from ansible)
@nicholaskuechler
nicholaskuechler / gist:603ee13bd74944866650
Created Jan 4, 2015
pip install pyrax inside of a virtualenv
View gist:603ee13bd74944866650
(rackspace_cloud)nick@mbp: ~/virtualenvs$ pip install pyrax
Downloading/unpacking pyrax
Downloading pyrax-1.9.3-py2.py3-none-any.whl (338kB): 338kB downloaded
Downloading/unpacking six>=1.5.2 (from pyrax)
Downloading six-1.9.0-py2.py3-none-any.whl
Downloading/unpacking requests>=2.2.1 (from pyrax)
Downloading requests-2.5.1-py2.py3-none-any.whl (464kB): 464kB downloaded
Downloading/unpacking keyring (from pyrax)
Downloading keyring-4.0.zip (83kB): 83kB downloaded
Running setup.py (path:/Users/nick/virtualenvs/rackspace_cloud/build/keyring/setup.py) egg_info for package keyring
@nicholaskuechler
nicholaskuechler / gist:6827654
Created Oct 4, 2013
Ansible - run command on a single host (10.20.30.40)
View gist:6827654
#!/usr/bin/python
import ansible.runner
import sys
# construct the ansible runner and execute on all hosts
results = ansible.runner.Runner(
host_list=['10.20.30.40'],
pattern='*',
forks=10,
View gist:6147588
# my virtualenvs are in ~/virtualenvs - you may need to adjust for your environment
cd ~/virtualenvs
virtualenv pelican-sprint-test
cd pelican-sprint-test
. bin/activate
mkdir ~/virtualenvs/pelican-sprint-test/src
cd ~/virtualenvs/pelican-sprint-test/src
git clone https://github.com/getpelican/pelican
cd pelican
pip install -r dev_requirements.txt
View gist:4734961
[customerlon]
NOVA_URL=https://lon.identity.api.rackspacecloud.com/v2.0/
NOVA_VERSION=1.1
NOVA_RAX_AUTH=1
NOVA_SERVICE_NAME=cloudServersOpenStack
NOVA_USERNAME=Username_here
NOVA_PASSWORD=API_key_here
NOVA_PROJECT_ID=DDI_number_here
NOVA_REGION_NAME=LON
@nicholaskuechler
nicholaskuechler / gist:3353575
Created Aug 14, 2012
slicehost - add a new zone via api with ruby
View gist:3353575
require 'activeresource'
API_PASSWORD = 'API_KEY_HERE'
class Zone < ActiveResource::Base
self.site = "https://#{API_PASSWORD}@api.slicehost.com/"
end
zone = Zone.new(:origin => 'myexample483727329784397.com', :ttl => 3000)
zone.save
You can’t perform that action at this time.