Skip to content

Instantly share code, notes, and snippets.

@silverskyvicto
Created June 23, 2019 08:43
Show Gist options
  • Save silverskyvicto/a5f8816de5012c2ca52edf62c92c7555 to your computer and use it in GitHub Desktop.
Save silverskyvicto/a5f8816de5012c2ca52edf62c92c7555 to your computer and use it in GitHub Desktop.
- name: Install Apache Maven
hosts: {{server}}
become: yes
tasks:
- name: Download Maven tar.gz file with check (sha512)
get_url:
url: http://ftp.jaist.ac.jp/pub/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
dest: /root
checksum: sha512:b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544
- name: Unarchive a Maven tar.gz file
unarchive:
src: /root/apache-maven-3.6.1-bin.tar.gz
dest: /opt
remote_src: yes
- name: Rename directory
command: mv /opt/apache-maven-3.6.1 /opt/maven
- name: Delete Maven tar.gz
file:
path: /root/apache-maven-3.6.1-bin.tar.gz
state: absent
- name: Add a line to a file if the file does not exist, without passing regexp
lineinfile:
path: /etc/profile
line: export PATH=/opt/maven/bin:$PATH
- name: source profile
shell: source /etc/profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment