Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
#!/usr/bin/python | |
''' Not my script, found on the Internet, and rediscovered on my hard drive | |
''' | |
import sys | |
def cidr_to_regex(cidr): | |
ip, prefix = cidr.split('/') | |
base = 0 | |
for val in map(int, ip.split('.')): |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# This script to install Kubernetes will get executed after we have provisioned the box | |
$script = <<-SCRIPT | |
# Install kubernetes | |
apt-get update && apt-get install -y apt-transport-https | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list |
Let's say you have a SysV Init Script
named foo
Copy the file to /etc/init.d/foo
Enable the SysV service: chkconfig --add foo
Enable the SysV service: chkconfig foo on
Start the service: service foo start
. After this, systemd-sysv-generator will generate this file /run/systemd/generator.late/foo.service
, copy this file to /etc/systemd/system
by running: cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service
Edit /etc/systemd/system/foo.service
by running systemctl edit foo.service
, add in the following line to foo.servie
(this makes the service installable)
[Install]