Wednesday, August 8, 2018

AWK

Hello Kids,

There is something useful when playing with linux, yep awk command.

here some clue for playing with awk command

awk [option] '/patter/ {action}' [input file]


-F spesify field spearator default space     : awk -F: '{print $1}' /etc/passwd
/patter/ regex pattern                                 : awk -F: '/root/ {print $1}' /etc/passwd

Tuesday, August 7, 2018

Ansible Ad-Hoc Command

Hi Kids,

Ansible could play in two mechanism :
  1. using ad-hoc command, useful for simple command
  2. using playbook, more complicated
First you have to install it form here

Here is some clue to starting Ansible :

HOST
  • config host ini /etc/ansible/hosts or using -i inverntory.ini
  • ansible_user=root default using ssh user
  • ansible_ssh_common_args='-o StrictHostKeyChecking=no' for disable from known host
  • ansible_ssh_private_key_file: "/home/ansible/.ssh/id_rsa"
  • [group]
    • [group:children] include from above group
    • [group:vars] var for ansible
Ad-Hoc COMMAND 

ansible -i inventory -m module -a "argument" 


Ping
ansible servers -m ping -i inventory.ini -b{ecome}

Systemctl
ansible all -m systemd -a "name=nginx state=started" -i inventory.ini -s

YUM
ansible loc -m yum -a "name=nginx state=present update_cache=true" -i inventory.ini -s
ansible loc -m yum -a "name=nginx state=absent" -i inventory.ini -b