Skip to main content

How to install Apache using Ansible

How to install Apache using Ansible

Use the powerful ansible tool to install Apache on your local machine or you can install on any remote server as well.

1. Install Ansible Modules

[root@dev02 ~]# yum install ansible*
Oracle Linux 8 EPEL Packages for Development (x86_64)                                                                                                             1.5 kB/s | 2.5 kB     00:01
Oracle Linux 8 Gluster Appstream (x86_64)                                                                                                                         1.9 kB/s | 2.7 kB     00:01
Oracle Linux 8 Application Stream (x86_64)                                                                                                                        2.1 kB/s | 2.9 kB     00:01
Oracle Linux 8 Application Stream (x86_64)                                                                                                                        1.2 MB/s |  20 MB     00:16
Oracle Linux 8 BaseOS Latest (x86_64)                                                                                                                             1.9 kB/s | 2.7 kB     00:01
Oracle Linux 8 BaseOS Latest (x86_64)                                                                                                                             1.9 MB/s |  19 MB     00:10
Oracle Linux 8 Development Packages (x86_64)                                                                                                                      0.0  B/s |   0  B     00:18
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)                                                                                        0.0  B/s |   0  B     00:12
Failed to synchronize cache for repo 'ol8_developer', ignoring this repo.
Failed to synchronize cache for repo 'ol8_UEKR6', ignoring this repo.
Dependencies resolved.
==================================================================================================================================================================================================
 Package                                           Arch                                  Version                                          Repository                                         Size
==================================================================================================================================================================================================
Installing:
 ansible-doc                                       noarch                                2.9.5-1.el8                                      ol8_developer_EPEL                                 12 M
 ansible                                           noarch                                2.9.5-1.el8                                      ol8_developer_EPEL                                 17 M
 ansible-freeipa                                   noarch                                0.1.8-3.el8                                      ol8_appstream                                     182 k
Installing dependencies:
 sshpass                                           x86_64                                1.06-9.el8                                       ol8_developer_EPEL                                 28 k
 python3-babel                                     noarch                                2.5.1-5.el8                                      ol8_appstream                                     4.8 M
 python3-jinja2                                    noarch                                2.10.1-2.el8_0                                   ol8_appstream                                     538 k
 python3-jmespath                                  noarch                                0.9.0-11.el8                                     ol8_appstream                                      45 k
 python3-markupsafe                                x86_64                                0.23-19.el8                                      ol8_appstream                                      39 k

Transaction Summary
==================================================================================================================================================================================================
Install  8 Packages

Total download size: 34 M
Installed size: 455 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): sshpass-1.06-9.el8.x86_64.rpm                                                                                                                              4.7 kB/s |  28 kB     00:06
(2/8): python3-babel-2.5.1-5.el8.noarch.rpm                                                                                                                       203 kB/s | 4.8 MB     00:24
(3/8): python3-jinja2-2.10.1-2.el8_0.noarch.rpm                                                                                                                    70 kB/s | 538 kB     00:07
(4/8): ansible-freeipa-0.1.8-3.el8.noarch.rpm                                                                                                                      24 kB/s | 182 kB     00:07
(5/8): python3-jmespath-0.9.0-11.el8.noarch.rpm                                                                                                                    14 kB/s |  45 kB     00:03
(6/8): python3-markupsafe-0.23-19.el8.x86_64.rpm                                                                                                                   75 kB/s |  39 kB     00:00
(7/8): ansible-doc-2.9.5-1.el8.noarch.rpm                                                                                                                         147 kB/s |  12 MB     01:20
(8/8): ansible-2.9.5-1.el8.noarch.rpm                                                                                                                             165 kB/s |  17 MB     01:47
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                             329 kB/s |  34 MB     01:47
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                          1/1
  Installing       : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                     1/8
  Installing       : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                    2/8
  Installing       : python3-babel-2.5.1-5.el8.noarch                                                                                                                                         3/8
  Installing       : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                     4/8
  Installing       : sshpass-1.06-9.el8.x86_64                                                                                                                                                5/8
  Installing       : ansible-2.9.5-1.el8.noarch                                                                                                                                               6/8
  Installing       : ansible-freeipa-0.1.8-3.el8.noarch                                                                                                                                       7/8
  Installing       : ansible-doc-2.9.5-1.el8.noarch                                                                                                                                           8/8
  Running scriptlet: ansible-doc-2.9.5-1.el8.noarch                                                                                                                                           8/8
  Verifying        : ansible-doc-2.9.5-1.el8.noarch                                                                                                                                           1/8
  Verifying        : sshpass-1.06-9.el8.x86_64                                                                                                                                                2/8
  Verifying        : ansible-2.9.5-1.el8.noarch                                                                                                                                               3/8
  Verifying        : python3-babel-2.5.1-5.el8.noarch                                                                                                                                         4/8
  Verifying        : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                     5/8
  Verifying        : ansible-freeipa-0.1.8-3.el8.noarch                                                                                                                                       6/8
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                     7/8
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                    8/8

Installed:
  ansible-doc-2.9.5-1.el8.noarch           ansible-2.9.5-1.el8.noarch               ansible-freeipa-0.1.8-3.el8.noarch        sshpass-1.06-9.el8.x86_64     python3-babel-2.5.1-5.el8.noarch
  python3-jinja2-2.10.1-2.el8_0.noarch     python3-jmespath-0.9.0-11.el8.noarch     python3-markupsafe-0.23-19.el8.x86_64

Complete!
[root@dev02 ~]# which ansible
/usr/bin/ansible


2. Install Apache web Server using Ansible

[root@dev02 ansible]# ansible localhost -m yum -a "name=httpd state=latest"
localhost | CHANGED => {
    "ansible_facts": {
        "pkg_mgr": "dnf"
    },
    "changed": true,
    "msg": "",
    "rc": 0,
    "results": [
        "Installed: apr-util-1.6.1-6.el8.x86_64",
        "Installed: httpd-filesystem-2.4.37-21.0.1.module+el8.2.0+5576+c083ffcb.noarch",
        "Installed: apr-1.6.3-9.el8.x86_64",
        "Installed: httpd-2.4.37-21.0.1.module+el8.2.0+5576+c083ffcb.x86_64",
        "Installed: httpd-tools-2.4.37-21.0.1.module+el8.2.0+5576+c083ffcb.x86_64",
        "Installed: mod_http2-1.11.3-3.module+el8.2.0+5576+c083ffcb.x86_64"
    ]
}
[root@dev02 ansible]#


[root@dev02 ansible]#  which httpd
/usr/sbin/httpd

3. Just try to ping any server using ansible

[root@dev02 ansible]# ansible localhost -m ping
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
[root@dev02 ansible]#


Comments

  1. Thanks For Sharing Such Great Information, It's Really Nice And Informative.
    DevOps Training
    DevOps Online Training

    ReplyDelete
  2. Thanks for the interesting post, keep continue your good job.



    How to Install Docker on Ubuntu 20.04 Easily

    ReplyDelete

Post a Comment

Popular posts from this blog

12.1.0 Grid Installation on Solaris 11.3 fails with ASM failed to start

Issue Description  We faced one issue, while installing the GI 12.1.0.1.0 on Solaris 11.3  ASM failed to start. Check /u01/app/grid/cfgtoollogs/asmca/asmca-201202PM061908.log for details. 2020/12/02 18:19:17 CLSRSC-184: Configuration of ASM failed 2020/12/02 18:19:17 CLSRSC-258: Failed to configure and start ASM Died at /u01/app/12.1.0/grid_1/crs/install/crsinstall.pm line 1976. The command '/u01/app/12.1.0/grid_1/perl/bin/perl -I/u01/app/12.1.0/grid_1/perl/lib -I/u01/app/12.1.0/grid_1/crs/install /u01/app/12.1.0/grid_1/crs/install/rootcrs.pl ' execution failed This error is coming during root.sh execution on primary node. After checking the asmca logs, the error seen is as below: ========================== [main] [ 2020-12-02 17:00:49.575 AST ] [UsmcaLogger.logException:156] SEVERE:method oracle.sysman.assistants.usmca.backend.USMInstance:configureLocalASM [main] [ 2020-12-02 17:00:49.575 AST ] [UsmcaLogger.logException:157] ORA-27122: unable to protect memory [main] [ 2020-1...

Health Check Script

Oracle Database Health Check Script Run this script has sysdba user or any user having DBA Role Change the spool file patch to correct directory. In this example it is set to  /export/home/oraprod/ $ cat Health_Check_Script.sql set pagesize 1100 SET MARKUP HTML ON SPOOL ON spool /export/home/oraprod/health_check_new.html set feedback off set linesize 200; set pages 50 set lines 1000 set pages 70 set heading on PROMPT================================================================ prompt PROMPT PROMPT Daily_Monitoring Checkup Report prompt ================================================================================================================================================= PROMPT REPORT DATE select to_char(sysdate,'DD-MON-YYYY:HH:MI:SS') "Report Run Date" from dual; prompt DATABASE NAME PROMPT ============== select instance_name,host_name,version,status from gv$instance ,v$database a; PROMPT DATABASE INFO PROMPT =============...

12.2 Stage area creation fails with startCD/Disk1/rapidwiz/bin/../jre/Linux_x64/1.6.0/bin/java: No such file or directory

 12.2 Stage area creation fails with startCD/Disk1/rapidwiz/bin/../jre/Linux_x64/1.6.0/bin/java: No such file or directory While creating the stage area for 12.2 Installation, we face issue while running the buildstage.sh ....startCD/Disk1/rapidwiz/bin/../jre/Linux_x64/1.6.0/bin/java: No such file or directory Solution:  Please go to the path provided in the error log and check if the java is working fine with below command: java -version Generally this java is having some issues.   Install the jre 7 or jre 8 and copy the the jre at the same path by renaming old folder. It should work fine.  Now if your run the build command again, it should succeed.  Running command: /u01/soft/ebs/startCD/Disk1/rapidwiz/bin/../jre/Linux_x64/1.6.0/bin/java -classpath /u01/soft/ebs/startCD/Disk1/rapidwiz/bin/../jlib/emocmutl.jar:/u01/soft/ebs/startCD/Disk1/rapidwiz/bin/../jlib/ewt-3_4_22.jar:/u01/soft/ebs/startCD/Disk1/rapidwiz/bin/../jlib/share-1_1_18.jar:/u01/soft/ebs/star...