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 python | |
import re | |
import sys | |
import time | |
import requests | |
URL = "http://releases.ubuntu.com/16.04/" | |
def t(): |
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
# multiprocessing_producer_consumer.py | |
# https://pymotw.com/3/multiprocessing/communication.html | |
import multiprocessing | |
import time | |
class Consumer(multiprocessing.Process): |
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
# https://pymotw.com/3/multiprocessing/communication.html | |
import multiprocessing | |
class MyFancyClass: | |
def __init__(self, name): | |
self.name = name |
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
import urlparse | |
import rethinkdb as r | |
class RethinkDBWrapper(object): | |
def __init__(self, settings): | |
''' init RethinkDBWrapper |
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 python | |
# -*- coding: utf-8 -*- | |
# | |
# Scrapy Spiders runner | |
# | |
# Based on: | |
# - http://kirankoduru.github.io/python/multiple-scrapy-spiders.html | |
# - https://github.com/kirankoduru/scrapy-programmatically | |
# | |
# updated by 2015-08-23 |
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
# Based on: | |
# - https://github.com/sprij/scrapy-rethinkdb | |
# | |
# updated by 2015-08-23 | |
import urlparse | |
import rethinkdb as r | |
from rethinkdb.ast import RqlQuery | |
class RethinkDBPipeline(object): |
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
You first need to install the Swarm plugin as mentioned https://wiki.jenkins-ci.org/display/JENKINS/Swarm+Plugin. | |
Then you can proceed with the client installation. | |
First create the jenkins slave working directory. | |
- name: Create Jenkins slave directory | |
file: path=${jenkins_home}/jenkins-slave state=directory owner=jenkins | |
Download the Swarm Client. |
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
We will put maven under /opt so we first need to create that directory. | |
- name: Create /opt directory | |
file: path=/opt state=directory | |
We then download the maven3 archive, this time it is more simple, we can directly use the get_url module. | |
- name: Download Maven3 | |
get_url: dest=/opt/maven3.tar.gz url=http://apache.proserve.nl/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz |
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
!! Creation | |
With the name module, the can easily handle users. | |
- name: Create jenkins user | |
user: name=jenkins comment="Jenkins slave user" home=${jenkins_home} shell=/bin/bash | |
The variable jenkins_home can be defined in one of the vars files. | |
!! Password less from Jenkins master |
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
To be able to make the java and jar executables accessible to anybody from anywhere, we need to set symbolic links (actually we just install an alternative). | |
- name: Set java link | |
action: command update-alternatives --install /usr/bin/java java ${jvm_folder}/jdk1.7.0/bin/java 1 | |
only_if: '${jdk_installed.changed}' | |
- name: Set jar link | |
action: command update-alternatives --install /usr/bin/jar jar ${jvm_folder}/jdk1.7.0/bin/jar 1 | |
only_if: '${jdk_installed.changed}' |
NewerOlder