Monday, March 15, 2021

Ansible - Installing software using ansible module yum on RHEL systems

 Installing software using ansible module yum

for ubuntu you have to use apt


lets see the syntax

$ anisble all -i myhosts \
- m \        # specify the module name
-a "" \        # specify arguement or key-value pair within double quotes
--become \    #
--forks=7        # speficy custom degree of parallism by using -f 7 or forks=7

we will use this syntax to run futher command rather than typing all command, we will specify the module and options everytime.

to download and install software on rhel7
google for ansible yum

go thorugh the documentation, you have so many arguements that you can pass to yum module

lets run it now
$ anisble all -i myhosts \
- m yum \    
-a "name=wget" \    
--become \    
--forks=7        

run from ansible control node.

it will install wget, Same way, you can run other packages such as http, mginx, jave-1.x.0-openjdk-devel

verify if java is installed

$ ansible all -i hosts -m command -a "java -version" --become --forks=7

it should return the value.


No comments:

Post a Comment

Git branch show detached HEAD

  Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03)   00 2. Run re-set hard $ git reset --hard 3. ...