Category Archives: Linux

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

Install MariaDB 10 on CentOS/RHEL 7

Scenario: How to install MariaDB on CentOS/RHEL 7

Steps:
1) Create MariaDB 10 repository.
# vi /etc/yum.repos.d/MariaDB.repo

On CentOS 7

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1
On RHEL 7

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

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 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