Skip to content

Instantly share code, notes, and snippets.

@alainlompo
Last active February 25, 2022 02:19
Show Gist options
  • Save alainlompo/59b76e1cddd2f86e47e76112ecacc87e to your computer and use it in GitHub Desktop.
Save alainlompo/59b76e1cddd2f86e47e76112ecacc87e to your computer and use it in GitHub Desktop.
sample ansible playbook for installing maven
################################################################
# Ansible playbook for maven installation #
# ##############################################################
#
---
- hosts: all
become: true
tasks:
- name: download apache maven
get_url: url=https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz dest=/tmp/apache-maven-3.8.4-bin.tar.gz
- name: untar maven
shell: chdir=/tmp creates=/opt/apache-maven-3.8.4 tar -zxf apache-maven-3.8.4-bin.tar.gz -C /opt
- name: add maven to PATH
shell: cat /etc/profile | grep "/opt/apache-maven-3.8.4/bin" || echo "PATH=/opt/apache-maven-3.8.4/bin:$PATH" >> /etc/profile
- name: copy settings.xml
copy:
src: /opt/ansible/install-maven/settings.xml
dest: /opt/apache-maven-3.8.4/conf/settings.xml
mode: 0666
backup: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment