• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install, and Uninstall Apache in Windows by using Ansible Playbook on Oracle Linux 8.5

  • 00:56 cat /etc/os-release
  • 01:13 yum list ansible
  • 01:30 yum list python3
  • 01:45 pip3 list | grep pywinrm
  • 02:09 vim /etc/ansible/hosts
  • 02:34 vi install.yml
  • 03:25 ansible-playbook install.yml --syntax-check
  • 03:40 ansible-playbook install.yml
  • 04:39 vi uninstall.yml
  • 05:04 ansible-playbook uninstall.yml --syntax-check
  • 05:20 ansible-playbook uninstall.yml
{{postValue.id}}

To Install, Uninstall Apache by using Ansible Playbook on Oracle Linux 8.5

Introduction

Ansible can be used for managing cloud provisioning, configuration management, application deployment, and many such IT requirements. Windows Installer, also known as Microsoft installer or MSI, is a kind of installer developed by Microsoft for use in the Microsoft operating system. win_get_url downloads files from HTTP, HTTPS, or FTP to node win_package installs or uninstalls a package in either an MSI or EXE format.

Procedure:

Master Server Requirements: ansible python3-pip pywinrm (python package)

Windows Requirements: powershell 3+ Dot net 4

Installation Procedure:

Step 1: Check the OS version by using the below command

[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"
ID_LIKE="fedora"

Step 2: Check the availability of Ansible package, python3-pip package by using the below command

[root@linuxhelp ~]# yum list ansible
ansible.noarch                        2.9.27-1.el8                         @ol8_developer_EPEL
Available Packages
ansible.src                           2.9.27-1.el8                         ol8_developer_EPEL 

[root@linuxhelp ~]# yum list python3
Last metadata expiration check: 1:28:13 ago on Sun 11 Sep 2022 03:22:41 PM IST.
Available Packages
python3.src                         3.6.8-45.0.1.el8                         ol8_baseos_latest
python3.src                         3.6.8-45.0.1.el8                         ol8_appstream    

[root@linuxhelp ~]# pip3 list | grep pywinrm
pywinrm (0.4.3)

Step 3: Create inventory for Windows node system by using the below command

 [root@linuxhelp ~]# vim /etc/ansible/hosts
[windows]
192.168.6.51

[windows:vars]
ansible_user=Admin
ansible_password=Linuxc#4
ansible_port=5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

Step 4: Create a playbook for downloading and installing Apache by using the below command

root@linuxhelp:~# vi install.yml
---
- name: Installing Apache MSI
  hosts: windows

  tasks:
    - name: Download the Apache installer
      win_get_url:
        url: https://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.25-win32-x86-no_ssl.msi
        dest: C:\Ansible\httpd-2.2.25-win32-x86-no_ssl.msi

    - name: Install MSI
      win_package:
        path: C:\Ansible\httpd-2.2.25-win32-x86-no_ssl.msi
        state: present

Step 5: Check the syntax of the install.yml ansible playbook by using the below command

root@linuxhelp:~# ansible-playbook install.yml --syntax-check

playbook: install.yml

Step 6: Run the install.yml playbook by using the below command

[root@linuxhelp ~]# ansible-playbook install.yml 

PLAY [Installing Apache MSI] *****************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************
ok: [192.168.6.51]

TASK [Download the Apache installer] *********************************************************************************************
changed: [192.168.6.51]

TASK [Install MSI] ***************************************************************************************************************
changed: [192.168.6.51]

PLAY RECAP ***********************************************************************************************************************
192.168.6.51               : ok=3    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0  

Step 7: Create playbook for Uninstalling Apache in Windows by using the below command

root@linuxhelp:~# vi uninstall.yml
---
  
- name: UnInstalling Apache MSI

  hosts: windows

  tasks:

    - name: UnInstall MSI

      win_package:

        path: C:\Ansible\httpd-2.2.25-win32-x86-no_ssl.msi

        state: absent

Step 8: Check the syntax of the uninstall.yml ansible playbook by using the below command

root@linuxhelp:~# ansible-playbook uninstall.yml --syntax-check
playbook: uninstall.yml

Step 9: Run the uninstall.yml playbook by using the below command

root@linuxhelp:~# ansible-playbook uninstall.yml 
PLAY [UnInstalling Apache MSI] ***************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************
ok: [192.168.6.51]

TASK [UnInstall MSI] *************************************************************************************************************
changed: [192.168.6.51]

PLAY RECAP ***********************************************************************************************************************
192.168.6.51               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Conclusion

We have reached the end of this article. In this guide, we have walked you through the steps required to Install Uninstall Apache by using Ansible Playbook on Oracle Linux 8.5. Your feedback is much welcome.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What does MSI mean in Windows?

A

MSI is known as Microsoft Installer

Q

What is the difference between an exe and an MSI?

A

MSI is an installer file that installs your program on the executing system. Setup.exe is an application (executable file) that has msi file(s) as one of the resources

Q

How to uninstall any application in the host machine using Ansible?

A

you can use status=absent in the Ansible playbook to uninstall any application.

Q

What are the cons of Ansible?

A

Ansible disadvantages include debugging, performance, complex data structures, and control flow.

Q

What is Ansible best for?

A

Ansible automates and simplifies repetitive, complex, and tedious operations.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.