Skip to content

Instantly share code, notes, and snippets.

@silverskyvicto
Last active June 24, 2019 14:17
Show Gist options
  • Save silverskyvicto/fb51bc157b6b597c4466acf299f565c9 to your computer and use it in GitHub Desktop.
Save silverskyvicto/fb51bc157b6b597c4466acf299f565c9 to your computer and use it in GitHub Desktop.
- name: Install ActiveMQ
hosts: {{server}}
become: yes
tasks:
- name: Find path for new JAVA home
shell: 'readlink -f /usr/bin/java | sed "s:bin/java::"'
register: java_home_path
- name: Set JAVA_HOME
lineinfile:
path: /etc/profile
line: JAVA_HOME={{java_home_path.stdout}}
create: yes
- name: source /etc/profile
shell: source /etc/profile
- name: Create execute user
user:
name: activemq
- name: Download ActiveMQ tar.gz file with check (sha512)
get_url:
url: http://www.apache.org/dyn/closer.cgi?filename=/activemq/5.15.9/apache-activemq-5.15.9-bin.tar.gz&action=download
dest: /root
checksum: sha512:35cae4258e38e47f9f81e785f547afc457fc331d2177bfc2391277ce24123be1196f10c670b61e30b43b7ab0db0628f3ff33f08660f235b7796d59ba922d444f
- name: Unarchive a ActiveMQ tar.gz file
unarchive:
src: /root/apache-activemq-5.15.9-bin.tar.gz
dest: /opt
remote_src: yes
- name: Create a symbolic link
file:
src: apache-activemq-5.15.9
dest: /opt/activemq
owner: activemq
group: activemq
state: link
- name: Recursively change ownership of a directory
file:
path: /opt/activemq
state: directory
recurse: yes
owner: activemq
group: activemq
- name: Create service file
copy:
src: ./files/activemq.service
dest: /usr/lib/systemd/system
- name: Delete ActiveMQ tar.gz
file:
path: /root/apache-activemq-5.15.9-bin.tar.gz
state: absent
- name: Daemon reload ActiveMQ Service
systemd:
daemon_reload: yes
- name: Start ActiveMQ Service
systemd:
name: activemq
state: started
enabled: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment