Ansible on vagrant

vagrant init centos/7; vagrant up --provider virtualbox

see below for more info :
https://atlas.hashicorp.com/centos/boxes/7

  • Install Ansible

sudo rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo yum -y install python-pip
sudo yum install gcc
sudo yum install python-devel
sudo pip install ansible

 

git – updating file in github

In the following post I will demonstrate how to update my github files :

so , lets init :

git config --global user.email "yanivaws@gmail.com"
git config --global user.name "yapale"
git config --global credential.helper cache --timeout=3600
git remote add origin  https://github.com/yapale/puppet_modules.git
git clone  https://github.com/yapale/puppet_modules.git
cd puppet_modules/
git status #Just to ensure that nothing is running

# On branch master
# Changes not staged for commit:
# (use “git add …” to update what will be committed)
# (use “git checkout — …” to discard changes in working directory)
#
# modified: yapale-vim/manifests/init.pp
#
no changes added to commit (use “git add” and/or “git commit -a”)

git add yapale-vim/manifests/init.pp
git status

# On branch master
# Changes to be committed:
# (use “git reset HEAD …” to unstage)
#
# modified: yapale-vim/manifests/init.pp
#

git commit -m "update for home dir"
git status

# On branch master
# Your branch is ahead of ‘origin/master’ by 1 commit.
# (use “git push” to publish your local commits)
#
#nothing to commit, working directory clean

git push -u origin master
git status

# On branch master
# nothing to commit, working directory clean

for more info:
http://stackoverflow.com/questions/5343068/is-there-a-way-to-skip-password-typing-when-using-https-github

Masterless puppet – puppet vim plugin

in order to run puppet module without root , use the following :

git clone https://github.com/yapale/puppet_modules

puppet apply --modulepath puppet_modules/ -e 'include yapale-vim'

now you can use the puppet vim plugin as below :

vim myclass.pp
type class or any puppet resource and click tab to auto complete
the relevant attributes.

another option to run masterless puppet with site.pp is explained here :
https://github.com/jordansissel/puppet-examples/tree/master/masterless

the magic of screen command

screen is excellent screen managment utility which will make the command line fans much more easier !

installation

installing is simple as running yum command :
yum install screen -y

using screens windows

Create ~./.screenrc file containing the below :

caption always "%{+b rk}%H%{gk} |%c %{yk}%d.%m.%Y | %72=Load: %l %{wk}"
hardstatus alwayslastline "%?%{yk}%-Lw%?%{wb}%n*%f %t%?(%u)%?%?%{yk}%+Lw%?"

for more information refer to :

https://www.debian-administration.org/article/560/An_introduction_to_the_visual_features_of_GNU_Screen

working with multiple windows :
screen
ctrl+A -> c : create new screen command window
switch to relevant screen:

ctrl+A -> <number>
or
ctrl+A -> ” ( and than select relevant window)

it will be looked like below :

screen2

using splitted screens

working with splitted screens :

screen
ctrl+A -> shift+S : create new screen session
ctrl+A -> tab :switch to next screen
ctrl+A -> c : create new screen
ctrl+A -> shift+| : create new horizontal screen
ctrl+A -> tab :switch to next screen
ctrl+A -> c : create new screen command window

ctrl+A -> shift+X : kill current screen
ctrl+A -> n : go to next screen

screen1

sharing screening

in order to share screen or to connect screen session from home use the below :

screen -S myshare
screen -ls
There are screens on:
24703.myshare (Attached)
4055.pts-9.centos7 (Attached)

open new putty window and run :
screen -x myshare #you can also use the number

for more information :
http://aperiodic.net/screen/quick_reference

http://www.kilobitspersecond.com/2014/02/10/understanding-gnu-screens-hardstatus-strings/

http://www.linuxjournal.com/article/10950 (refer to backtick numbering)

Changing timezone on centos

assuming you want to change your current timezone to Jerusalem
you need to follow the steps below :

1.
ensure that the city exist in the zoneinfo dir:
/usr/share/zoneinfo/Asia/Jerusalem

2.
Run the follwing commands:

# ls -l /etc/localtime # just to see current definition 
# example : /etc/localtime -&gt; ../usr/share/zoneinfo/America/New_York

sudo ln -sf /usr/share/zoneinfo/Asia/Jerusalem /etc/localtime
systemctl start  ntpd.service