Automation

Everyday humans evolve and try to make their job as simple as possible. Exactly, the main aim of ansible is to help programmers to automate their job.

App server setup

We all know that a lot of time is taken while setting up a app server, even after knowing the setup prerequisites like installation of packages and then verification takes up time.

Ansible is a great tool used in automation in many areas like software deployment, Configuration management, etc.

Steps of installing a app server

There are some major steps while setting up a app server:

  • Installation of packages like git, apache, mysql
    • We used to install these packages one by one,
      • sudo dnf install git
        sudo dnf install httpd
        #we need to allow apache through firewall
        sudo firewall-cmd --permanent --add-port=80/tcp
        sudo firewall-cmd --permanent --add-port=443/tcp
        # Reload
        sudo firewall-cmd --reload
        sudo dnf install mysql
        sudo dnf install python-devel
        sudo dnf install mysql-devel
  • Downloading the project from git
    • git clone https://github.com/username/yourrepo.git
  • Creating a virtual environment for the project and installation of the prerequisites inside the virtual lab
    • pip install virtualenv
      pip install mysql-python
  • Creating database
    • mysql> CREATE DATABASE TABLE;
      mysql> USE TABLE
        Database changed
      shell> mysql -h HOST -u user -p TABLE
      Enter password: ********
      
      
  • Transfer of files
  • Configuration of the server settings
    • chmod 777 file
      #installing the requirements of the virtual environment
      pip install -r requirements.txt