Saturday, February 10, 2024

Install Maven using Ansible Role on Ubuntu - Install Maven on Ubuntu using Ansible Role

Ansible Role for installing Maven on Ubuntu

cd ~/roles

sudo vi aws-infra-role/tasks/installMaven.yml

    - name: Install Maven using Ansible
      become: yes
      apt:
        name: "{{ packages }}"
        state: present
      vars:
        packages:
           - maven

Modify Ansible main playbook

sudo vi aws-infra-role/setup-jenkins.yml
---
# This Playbook creates infra in aws cloud

- hosts: My_Group
  gather_facts: False
  tags: jenkins creation

  tasks:
  - include: tasks/installJava11.yml
  - include: tasks/installMaven.yml

Execute Ansible Role
ansible-playbook aws-infra-role/setup-jenkins.yml

This should install Maven on the  target node.

No comments:

Post a Comment

How to Setup AquaSec Trivy Vulnerability Scanner | How to install AquaSec Trivy Scanner on Linux OS | Security Scanning Tool | DevSecOps Tutorials

What is Trivy? open-source security scanner tool developed by Aqua Security.  Used for vulnerability scanning in such as  container images  ...