Skip to content

Instantly share code, notes, and snippets.

View anokun7's full-sized avatar
🎯
Focusing

Anoop Kumar anokun7

🎯
Focusing
View GitHub Profile
@anokun7
anokun7 / blog.pp
Last active August 29, 2015 14:05
blog.pp & saat.pp
define profiles::blog (
$docroot = '/opt/wordpress',
$port = '80',
$vhost_name = $title
){
class { 'wordpress':
wp_owner => 'wordpress',
wp_group => 'wordpress',
install_dir => $docroot
}
@anokun7
anokun7 / gist:21bd21d2a59084166540
Last active August 29, 2015 14:11
3.3.2 agent install failing with PYCURL / NSS: client certificate not found (nickname not specified) errors
download entire site:
wget --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla http://www.site.com
## pe-agent update:
### Put this in site.pp
node 'master.puppetlabs.vm' {
notify { "Hello dear master": }
}
@anokun7
anokun7 / Beaker DSL Challenge (1 of 2)
Created January 9, 2015 07:24
Beaker Demo - Write your own tests (Anoop Kumar's submission)
require 'spec_helper_acceptance'
describe "file content tests" do
step "Create file with content"
hosts.each do |host|
# confine :except, :platform => 'windows'
content = "foo\nfoo\nfoo\n"
the_file = "/tmp/demo.txt"
create_remote_file host, the_file, content
@anokun7
anokun7 / gist:cf835c4ab667b034c221
Created April 15, 2015 20:29
Generate UUID on Linux
cat /proc/sys/kernel/random/uuid
This can be used in creating Puppet node groups.
/usr/local/bin/docker -d -D -g /var/lib/docker -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 --label provider=virtualbox -s aufs
-d is deprecated
@anokun7
anokun7 / gist:180346d8c4bf4a56d8f0
Created August 21, 2015 17:54
To expose a port on a running container
# Run this on the docker host (of course)
# Here I am exposing port 8080 on the container whose IPAddress is 172.17.0.113
#> as port 8888 on the docker host
# To get the container's IPAddress, use `docker inspect <containerid> | grep IPAddress
# To get the docker host's ip address and ssh into it, use:
# `docker-machine ssh $(docker-machine ls -q)`
iptables -t nat -A DOCKER -p tcp --dport 8888 -j DNAT --to-destination 172.17.0.113:8080
While running the following command, you may see this error:
`docker push anoop/webapp`
To fix this, run
`docker images`
Get the image id of the repository that you want to push.
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
web_web latest 4b81006810f8 2 hours ago 348.6 MB
Debian / Ubuntu: /etc/default/docker
To restart (Ubuntu 14): service docker restart
CentOS: /etc/sysconfig/docker
To restart (on Centos 7.1): sudo systemctl restart docker.service
Windows:
@anokun7
anokun7 / gist:805f2c74189757dea00e
Created August 26, 2015 21:57
Docker Trusted Registry - Initial login
DTR uses SSL certificates in addition to a login/password to login.
The steps to use openssl to create a self-signed certificate as below:
1. First create a private key (myserver.key) and a certificate signing request (server.csr)
openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csr
2. Finally create the SSL certificate (server.crt) using the csr and private key just created:
openssl x509 -req -days 365 -in server.csr -signkey myserver.key -out server.crt
export PS1='\[\e[4;32m\]\!\[\e[m\] \[\e[0;31m\]\[\e[47m\]\u\[\e[m\] \[\e[1;37m\]\w\[\e[m\] \[\e[0;93m\][$?]\[\e[m\] \[\e[1;31m\]\$ \[\e[m\]\[\e[m\]\[\e[0;32m\]'
eg:
517 anoop ~ [0] $ cat aa
cat: aa: No such file or directory
518 anoop ~ [1] $