Ansible Core Yum Update RHEL

Scenario: Patching run yum update using Ansible to RHEL 6/7 remote machine
System: RHEL 7, Ansible 2.6 (Callback and ansible log is active)
Remote System: RHEL 6/7 (not using ssh key), same root password, PermitRootLogin yes

Example yum update host group devservers, here my steps:
1) Empty ansible log.
# cat /dev/null > /var/log/ansible.log

2) Input hosts devservers in /etc/ansible/hosts
# vi /etc/ansible/hosts

[devservers]
192.168.99.18
192.168.99.19

Continue reading

Bash script to get list of local users on Linux

Scenario: How to get the list of normal users and System users in Linux.
System : CentOS/RHEL 6/7

Steps:
1) Login as local users (work without login to root), example I login as bachem.
2) Create the bash script file with file name listusers.sh
$ vi /home/bachem/listusers.sh
Continue reading

How to add sudo user on CentOS 7

Scenario: add sudo user on CentOS 7
System: CentOS 7

Steps to Create a New Sudo User
– Log in to your server as the root user.
– Use the adduser command to add a new user to your system,example add user with username bachem.

[root@horse ~]# useradd bachem
[root@horse ~]# passwd bachem
Changing password for user bachem.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@horse ~]#

Continue reading

Using Ansible Callback

Scenario: Set up Ansible callback to monitor running task on remote machine.
Ansible system: CentOS 7, Ansible 2.6
Remote machines:
Both have same root password
1. CentOS 7, ip address: 192.168.99.18
2. CentOS 6, ip address: 192.168.99.19

I set up callback plugins to see running ansible-playbook task on remote machine and it is fun and useful.
To set up callback, edit /etc/ansible/ansible.cfg and change the value to minimal.

# vi /etc/ansible/ansible.cfg

stdout_callback = minimal

Continue reading

Install Openfiler

Scenario: Installing Openfiler at sda 40GB size.

System: Openfiler ESA 2.99.1

Steps:
– Download Openfiler iso from here.
– Booting from Openfiler iso/DVD.
– Select Graphical Mode press Enter.
– Click Next.
– Select Keyboard -> Click Next then select Yes to initialize drive,erasing ALL DATA.
– Continue click Next if using default Openfiler partition table. I setup LVM for /var and swap for easy increase the space in the future.
Continue reading

Install Ansible Core on CentOS 7

System: CentOS 7, Ansible-2.6.0

Step 1 — Installing Ansible
To begin exploring Ansible as a means of managing our various servers, we need to install the Ansible software on at least one machine.

To get Ansible for CentOS 7, first ensure that the CentOS 7 EPEL repository is installed:
# yum install epel-release

Install Ansible
# yum install ansible
Continue reading