Last active
February 25, 2022 02:19
-
-
Save alainlompo/59b76e1cddd2f86e47e76112ecacc87e to your computer and use it in GitHub Desktop.
sample ansible playbook for installing maven
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
# 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