How to Configure RAID Array Using Intel Rapid Storage Technology | Raid Setup | Raid

Tags: raid, raid 10, raid 6, raid 1, raid configuration, raid controller,hardware raid, check raid, mdadm status, mdadm, mdadm assemble, raid 0, raid degraded, raid disk,  raid in linux, what is raid, software raid, types of raid, raid setup, raid array, intel rapid storage technology, intel raid, 






Server  Preparation with RAID1 Steps:  

  1. BIOS Settings
  2. RAID1 Configuration
  3. OS Installation
  4. Network and Grub Configuration
  5. Verify RAID Status

1) Open BIOS Utility using  “DEL” , its depend on Server  BIOS

Go to Advanced → SATA Configuration


Press  Enter on SATA Mode Selection and Change Value AHCI to RAID



Now RAID is Enabled - Save and Exit the BIOS Utility

2)
RAID1 Configuration

  1. Reboot Server and Press Ctrl + i for RAID Configuration Utility


Note: Before Create RAID,  Check Disk and size, here 2 disk and both are Non-RAID Disk

Press “Create RAID Volume”


Name: Volume0   ---> Press Enter
RAID Level          ---> Select RAID1 with the Help of up/down arrow of Keyboard and press Enter after Raid1 select
Disks                    ---> Press Enter
Strip Size             ---> N/A
Capacity              ---> Press Enter

Not Press Enter on “Create Volume” it will ask you “Are you sure you want to create this volume ? Press Y


After Creating both Disk will be Member of RAID1 , following Screenshot


Now RAID1 Created and server is Ready to Install CentOS using bootable Pendrive.

3 )

Install CentOS 7

  1. Insert Bootable Pendrive of CentOS 7 and Boot from Pendrive


Press “Install CentOS7”


Press “Continue”


Press “Installation Destination”


Select “BIOS RAID set (mirror)” and Press Done

To method of Partition

Select Automatically Configure Partitioning  --> Done

OR

I Will Configure Partitioning  - As you wish

  1. Creating Partition = /boot
Press ( + ) and add boot partition

Mount Point = /boot
Desired Capacity = 500 MB

Press “Add Mount Point”

Note : /boot partition device type should be  “Standard”



Creating ( swap, log and / ) Partition with Adding LVM

Again Press ( + ) and create a swap partition

Mount Point = swap
Desired Capacity = 5000 MB



Press “Add mount Point”

Device Type = LVM

Volume Group = Select “Create new volume group” from drug down menu


Type Volume group name = linuxtopic

Press the Save button to create swap


Create /var/log Partition,

Again Press ( + ) and create a log partition

Mount Point = /var/log
Desired Capacity = 35000 MB




Final Create / partition

Again Press ( + ) and create a swap partition

Mount Point = /
Desired Capacity =  leave blank for whole space


Verify All Partition and there Space ( similar )

/boot  = 500MB
Swap = 5GB
/var/log = 35 GB
/   = All Space


Now Press “Done”


Press Accept Changes

Create Root Password : server

Press “Done”



After installation it will reboot

how to check raid status in linux  ?

Check Raid Status of new prepared server

cat  /proc/mdstat


Current is building it will take up to 30 - 60 min, please keep server online and check after 1 hour, status look like



Thanks

End of this Raid Configuration using Intel Rapid Storage Technology 
 tutorial,  we need your support so i request you to please comment if something missed by me, share and like this post.

www.linuxtopic.com






Working with Ansible Roles | Ansible Roles Structure | Linuxtopic

ansible roles, ansible roles example, ansible roles tutorial, ansible tutorial, ansible, devops tools, ansible playbook, create ansible roles, ansible global variable, ansible tasks, linuxtopic
Tags: ansible roles, ansible roles example, ansible roles tutorial, ansible tutorial, ansible, devops tools, ansible playbook, create ansible roles, ansible global variable, ansible tasks, linuxtopic






Ansible Roles: Ansible Roles are independent and small function files that used in ansible playbooks. We can say that roles it is a collections of variables, tasks, modules, files and templates.

Ansible Roles help us to break or divided big playbook in to the small files.

Creating Role : By default roles directory locate in ansible configuration directory. Below default path of ansible configuration directory is /etc/anisble

Step 1:


To Create “roles” directory, we can choose any name of roles directory, here we create linuxtopic roles under the ansible configuration directory. 
cd /etc/ansbile
mkdir -p /etc/ansible/roles/linuxtopic
This roles directory is set of other directories that will help us separate the different sections of the playbook.
Following default ansible roles directory structure

defaults
files
handlers
meta
tasks
templates
tests
vars


  • default : used for default variable
  • files & templates : it contains a files/scripts to be transferred on configuring hosts for this role. 
  • handlers: All handlers that were in your playbook previously can now be added into this directory.
  • meta: This directory can contain files that establish role dependencies. You can list roles that must be applied before the current role can work correctly.
  • templates: You can place all files that use variables to substitute information during creation in this directory.
  • tasks: This directory contains all of the tasks that would normally be in a playbook. These can reference files and templates contained in their respective directories without using a path.
  • vars: Variables for the roles can be specified in this directory and used in your configuration files.
To create directory structure under ansible roles directory
cd /etc/ansible/roles/linuxtopic/
mkdir tasks
To write a task in playbook

We will create a main.yml file in tasks directory, In this example we will copy file/script from source to destination using copy module and update dns entry in resolv.conf, following main.yml playbook
vi tasks/main.yml
---
# We can define all task


- name: Copy Script
  copy: src=script.sh dest=/usr/local/bin/script.sh mode=755


- name: Update resolve Entry
  template: src=resolv.conf.j2 dest=/tmp/resolv.conf
ansible roles, ansible roles example, ansible roles tutorial, ansible tutorial, ansible, devops tools, ansible playbook, create ansible roles, ansible global variable, ansible tasks, linuxtopic
Ansible Roles
How to use copy module Click Here…..

In first task We use copy module and define src=script.sh, src= is source path and script.sh is file, files/scripts read from files directory, so we will create a files directory under ansible roles/linuxtopic
mkdir files
touch files/script.sh
ll files/script.sh


In second task we use template module, so we will create a template file under templates directory, we use variables in this Jinja2 template. We will replace this template to resolv.conf of the hosts.
mkdir templates
vi templates/resolv.conf.j2


Here  
resolv.conf.j2 is Jinja2 template
{{ dns }} = variable, we define in vars/main.yml


To create vars directory for variables
mkdir vars
vi vars/main.yml
---
# variables file for linuxtopic
 dns: 8.8.8.8



Our basic ansible roles directory structure has been finished, following tree of linuxtopic roles
tree


Now we will create a playbook to execute roles.

How to add hosts in Ansible Inventory Click Here..

We will go to anisble configuration directory and create a yaml file to run our roles/tasks.
cd /etc/ansible
vi roles-main.yml
---
- hosts: all
  gather_facts: false

  roles:
    - {role: 'linuxtopic', tags: 'linuxtopic'}



We define role name with tags name

To run ansible playbook
ansible-playbook -l 127.0.0.1 roles-main.yml
To run ansible playbook with --tags
ansible-playbook -l 127.0.0.1 --tags "linuxtopic" roles-main.yml


Verify :



We successfully sync script.sh and replace value in resolv.conf


Ansible Conditionals When File or Directory Exist | How to Use Condition in Ansible

conditional in ansible, ansible when, when statement, ansible tutorial, ansible playbook, ansible, jobs, ansible roles, ansible facts, ansible debug, when:, conditional statement, ansible create directory,
tags : conditional in ansible, ansible when, when statement, ansible tutorial, ansible playbook, ansible, jobs, ansible roles, ansible facts, ansible debug, when:, conditional statement, ansible create directory,





conditional is used to change a ansible play behavior based on there facts/variable. we can control which tasks/roles will be run or skipped on there targeted hosts/nodes with the help of when statement


We create a condition_file.yml playbook. You can choose  choose any suitable name

To Create condition playbook,

cd  /etc/ansible

vi condition_file.yml

---
- hosts: all
  gather_facts: false


  tasks:
  - name: Check File exists or not
    stat: path=/tmp/check.txt
    register: status


  - debug: var=status

conditional in ansible, ansible when, when statement, ansible tutorial, ansible playbook, ansible, jobs, ansible roles, ansible facts, ansible debug, when:, conditional statement, ansible create directory,
Ansible Conditional - File exist

We used stat module with define the path where we want to check file.

To run playbook

ansible-playbook  condition_file.yml


check.txt file not available so it display  exists = false, we will use this value, we will create a file if the file does not exist, following example :

  - name: Create file if does not exist
    file:
     state: touch
     path: /tmp/check.txt
     owner: lokesh
     group: lokesh
     mode: 0755
    when: status.stat.exists == false

conditional in ansible, ansible when, when statement, ansible tutorial, ansible playbook, ansible, jobs, ansible roles, ansible facts, ansible debug, when:, conditional statement, ansible create directory,
Ansible Create Directory - Condition 

ansible-playbook -l 127.0.0.1 condition_file.yml


Our playbook executed now we will check file,


ls -l  /tmp/check.txt

Same playbook will work with directory,

---
- hosts: all
  gather_facts: false


  tasks:
  - name: Check directory exists or not
    stat: path=/var/lib/linuxtopic
    register: status


  - name: Create directory if does not exist
    file: state=directory path=/var/lib/linuxtopic owner=nobody group=lokesh mode=0775
    when: status.stat.exists == false


  - name: Update Permission
    file: state=directory path=/var/lib/linuxtopic owner=nobody group=lokesh mode=0775
    when: status.stat.exists == true


Thanks

End of this ansible conditional  tutorial,  we need your support so i request you to please comment if something missed by me, share and like this post.


www.linuxtopic.com

Ansible Tutorial - Ansible Jinja2 Templating

 ansible playbook, jinja2, jinja2 template, jinja2 tutorial, jinja2 template example, ansible template, ansible template example, ansible template tutorial, ansible template variables, ansible template default value, ansible playbook examples, ansible playbook tutorial, ansible tutorial for beginners, ansible tasks, ansible, ansible tutorial, ansible example, ansible facts, ansible linux, ansible best practices, ansible  variables, ansible variables list, ansible global variable
Ansible Template - Jinja2
ansible playbook, jinja2, jinja2 template, jinja2 tutorial, jinja2 template example, ansible template, ansible template example, ansible template tutorial, ansible template variables, ansible template default value, ansible playbook examples, ansible playbook tutorial, ansible tutorial for beginners, ansible tasks, ansible, ansible tutorial, ansible example, ansible facts, ansible linux, ansible best practices, ansible  variables, ansible variables list, ansible global variable


How to Update variables in Jinja2 templates ?

How to work in Ansible Jinja2 Template?

A Ansible template is a simple text file that contains your configuration parameters and replace dynamic values are given as variables. this template file use Jinja2 templating engine with .j2 extension. we can define variables in double curly braces like {{ variable_name }}



To Create Ansible Templating (Jinja2)
cd /etc/ansiblevi templete.j2
This is my website {{ website }} and it's running on {{ server }} since {{ year }}

 ansible playbook, jinja2, jinja2 template, jinja2 tutorial, jinja2 template example, ansible template, ansible template example, ansible template tutorial, ansible template variables, ansible template default value, ansible playbook examples, ansible playbook tutorial, ansible tutorial for beginners, ansible tasks, ansible, ansible tutorial, ansible example, ansible facts, ansible linux, ansible best practices, ansible  variables, ansible variables list, ansible global variable

In this template we are using three variables , define in playbook

To create ansible playbook with any suitable name as you wish
vi template.yml
- hosts: all
  gather_facts: false

  vars:
  - website: linuxtopic.com
  - server:  apache
  - year: 2015

  tasks:
  - name:  update configuration using templates
    template: src=template.j2  dest=/tmp/template mode=0755 owner=apache group=apache



To execute ansible playbook with template module - we execute it only localhost by -l option  
ansible-playbook -l 127.0.0.1 template.yml


To verify updated files, replace by jinja2 template
ll /tmp/template
cat /tmp/template



End of this ansible templating tutorial, We successfully replace files with variable value in our configuration file.  

Your support is must so Please Like, share and comment on this ansible Templating (Jinja2) artical.

Thanks,
www.linuxtopic.com


How to Get AWS Access Key and Secret Key | AWS Access Key | AWS Tutorial by Linuxtopic

tags: aws access key id, aws, aws cloud, aws access key, aws console, aws login, aws training, aws cloud computing, aws server, aws tutorial, aws security,aws ansibl, aws ec2, aws s3, amazon web services, amazon web server, cloud computing, cloud, aws iam

1)  Go to  https://aws.amazon.com  


2)  Login OR Sign Up if you do not have an AWS account

3) Go to account menu in upper-right  ( your account name ) and select “My Security Credentials”

aws access key id, aws, aws cloud, aws access key, aws console, aws login, aws training, aws cloud computing, aws server, aws tutorial, aws security,aws ansibl, aws ec2, aws s3, amazon web services, amazon web server, cloud computing, cloud
AWS Access Key
4) New window will appear, just click on  “Get Started With IAM Users”
aws access key id, aws, aws cloud, aws access key, aws console, aws login, aws training, aws cloud computing, aws server, aws tutorial, aws security,aws ansibl, aws ec2, aws s3, amazon web services, amazon web server, cloud computing, cloud, aws iam
AWS IAM Users

5) Press on “Add User” Button


6) Set User Details

User Name -
Access Type - Check as per requirement
Console Password -

7)  Add User tags :



8) Review All Details

9) Press on “Create User” button to create user


Now you can show your Secret Access ID and Key , it will use to access your AWS Account.



Thanks

End of this AWS Access Key Tutorial,  we need your support so i request you to please like and share  this post also comment if something missing by me  or  give me  a suggestion to make more easy/useful. 


www.linuxtopic.com



Working with Ansible conditionals | How to Use When Statement in Ansible | linuxtopic

conditional is used to change a ansible play behavior based on there facts/variable. we can control which tasks/roles will be run or skipped on there targeted hosts/nodes with the help of when statement

ansible "when statement" example : we will create a condition.yml playbook

To Create yml playbook file, choose any name

cd  /etc/ansiblevi condition.yml

---
- hosts: all


  tasks:
  - name: get uptime
    command: uptime
    when: ansible_facts['os_family'] == "Debian"
    register: uptime


  - debug: var=uptime.stdout

ansible playbook, Ansible Conditionals, ansible when, ansible playbook examples, ansible playbook tutorial, ansible tutorial for beginners, ansible tasks, ansible, ansible tutorial, ansible example, ansible facts, ansible linux, ansible best practices,ansible  variables, ansible variables list, ansible global variable

add  remote hosts on inventory  Click Here...

To run ansible playbook on hosts

ansible-playbook   condition.yml


We can see that, localhost is CentOS 7 so task has been skipped and 192.168.3.104 is Debian so task executed.

Again we update condition in playbook, we add change !=

---
- hosts: all


  tasks:
  - name: get uptime
    command: uptime
    when: ansible_facts['os_family'] != "Debian"
    register: uptime


  - debug: var=uptime.stdout

conditional in ansible, ansible when, when statement, ansible tutorial, ansible playbook, ansible, jobs, ansible roles, ansible facts, ansible debug, when:
Ansible Conditionals - When Statement 

Again we run playbook

ansible-playbook   condition.yml


Now  task has been executed on  CentOS 7 and skipped on Debian.

Method 2:

Now we will use ansible facts as variable like ansible_distribution, following playbook

---
- hosts: all


  tasks:
  - name:  echo distribution - CentOS
    command: echo CentOS-PC
    when: ansible_distribution == "CentOS"
    register: centos

We can use AND condition  with following examples

---
- hosts: all


  tasks:
  - name:  echo distribution - CentOS
    command: echo CentOS-PC
    when: ansible_distribution == "CentOS"  and ansible_architecture == "x86_64"
    register: centos


 - debug: var=uptime.stdout


ansible-playbook  condition.yml


Now we will add more condition with and statement, and use loop to display all results. Our final playbook is :

---
- hosts: all


  tasks:
  - name:  echo distribution - CentOS
    command: echo CentOS-PC
    when: ansible_distribution == "CentOS"  and ansible_architecture == "x86_64"
    register: centos


  - name:  echo distribution - Ubuntu
    command: echo Ubuntu-PC
    when: ansible_distribution == "Ubuntu"  and ansible_architecture == "x86_64"
    register: ubuntu


  - debug: var={{ item }}
    loop:
      - centos.stdout
      - ubuntu.stdout


Now we will execute ansible playbook

ansible-playbook  condition.yml


Thanks

End of this ansible conditionals  tutorial,  we need your support so i request you to please comment if something missed by me, share and like this post.


www.linuxtopic.com