-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c867dca
Showing
186 changed files
with
8,509 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Steps playbook performs | ||
|
||
- choose wheater to install from repository or tarball | ||
- Adding Service Scripts if it is tarball Installation | ||
- Starting ActiceMQ in Server | ||
|
||
yml files Involved | ||
|
||
apt.yml : | ||
|
||
- Repository Installation of activemq in server | ||
|
||
download.yml : | ||
|
||
- Download ActiveMQ tarball file | ||
- Extract the downloaded Package | ||
- Create user and group if not exist | ||
- Changing file Permissions | ||
|
||
service.yml : | ||
|
||
- Coping ActiveMQ service script to server | ||
- Enabling activemq service in default run levels | ||
|
||
start.yml : | ||
|
||
- To start ActiveMQ | ||
|
||
Variables : | ||
|
||
amq_install_mode = mode of installation(tarball or apt) | ||
|
||
amq_user = owner user of Installation directory | ||
|
||
amq_group = owner group of Installation directory | ||
|
||
amq_port = running port | ||
|
||
amq_install_dir = Installation directory | ||
|
||
amq_home_dir = ActiveMQ home directory | ||
|
||
amq_skip_checksum = true or false | ||
|
||
amq_url_prefix = URL of download space | ||
|
||
amq_version_major = Major version no | ||
|
||
amq_version_minor = Minor version no | ||
|
||
amq_version_patch = Patch version np | ||
|
||
amq_version = Exact ActiveMQ version | ||
|
||
amq_checksums = ActiveMQ checksum (List out all supported checksums here) | ||
|
||
amq_service = If you want amq as service give 'yes' | ||
|
||
|
||
|
||
---------------------test.yml--------------------- | ||
|
||
--- | ||
|
||
- name: Active-MQ installation | ||
|
||
hosts: amq | ||
|
||
remote_user: ubuntu | ||
|
||
become: yes | ||
|
||
become_method: sudo | ||
|
||
roles: | ||
- java-8 | ||
- amq | ||
|
||
-------------------------------------------------- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
#Default variable list for installing active-mq | ||
amq_install_mode: "tarball" | ||
amq_user: ubuntu | ||
amq_group: ubuntu | ||
amq_port: 8161 | ||
amq_install_dir: /opt | ||
amq_home_dir: "{{ amq_install_dir }}/apache-activemq-{{ amq_version }}" | ||
amq_skip_checksum: true | ||
amq_url_prefix: "http://archive.apache.org/dist/activemq" | ||
#Enter exact version to install | ||
amq_version_major: "5" | ||
amq_version_minor: "13" | ||
amq_version_patch: "4" | ||
amq_version: "{{ amq_version_major }}.{{ amq_version_minor }}.{{ amq_version_patch }}" | ||
#List out all supported checksums here. | ||
amq_checksums: | ||
- { version: "5.13.3" , checksum: "md5:05e4c36bc109a0dc3d0bab74ec202787" } | ||
- { version: "5.13.5" , checksum: "md5:07285ffcc6921ac87018af26f3718522" } | ||
amq_url: "{{ amq_url_prefix }}/{{ amq_version }}/apache-activemq-{{ amq_version }}-bin.tar.gz" | ||
|
||
#If you want amq as service give 'yes'. | ||
amq_service: "yes" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
#Handler for manual starting | ||
- name: start amq | ||
command: "{{ amq_home_dir }}/bin/activemq start" | ||
|
||
#Handler for starting service | ||
- name: Starting amq service | ||
service: | ||
name: activemq | ||
state: started | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Install latest activemq from apt-get | ||
apt: | ||
name: activemq | ||
state: present | ||
update_cache: yes | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
#To download activemq paackage | ||
- name: Downloading amq-{{ amq_version }} | ||
get_url: | ||
url: "{{ amq_url }}" | ||
dest: "{{ amq_install_dir }}/apache-activemq-{{ amq_version }}-bin.tar.gz" | ||
force: no | ||
# owner: "{{ amq_user }}" | ||
# group: "{{ amq_group }}" | ||
register: result | ||
until: result|success | ||
retries: 5 | ||
delay: 2 | ||
|
||
#Extracting the package | ||
- name: Extracting downloaded package | ||
unarchive: | ||
src: "{{ amq_install_dir }}/apache-activemq-{{ amq_version }}-bin.tar.gz" | ||
dest: "{{ amq_install_dir }}" | ||
remote_src: true | ||
|
||
- name: create user if not exist | ||
user: | ||
name: "{{ amq_user }}" | ||
state: present | ||
|
||
- name: Create user group if not exist | ||
group: name={{ amq_group }} state=present | ||
|
||
#File permissions | ||
- name: Changing file permissions | ||
file: | ||
path: "{{ amq_install_dir }}/apache-activemq-{{ amq_version }}" | ||
owner: "{{ amq_user }}" | ||
group: "{{ amq_group }}" | ||
recurse: yes | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Including required tasks | ||
- include: apt.yml | ||
when: amq_install_mode == "apt" | ||
|
||
- include: download.yml | ||
when: amq_install_mode == "tarball" | ||
|
||
- include: service.yml | ||
when: amq_service == "yes" and amq_install_mode == "tarball" | ||
|
||
- include: start.yml | ||
when: amq_service == "no" and amq_install_mode == "tarball" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
#Creating activemq as service | ||
- name: Creating activemq service script | ||
copy: | ||
src: "{{ amq_home_dir }}/bin/env" | ||
dest: /etc/default/activemq | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
|
||
#Enter username value in 'env' file | ||
#- name: Add username in env file | ||
# command: sed -i '~s/^ACTIVEMQ_USER=""/ACTIVEMQ_USER="ubuntu"/' /etc/default/activemq | ||
#- name: Adding username to run activemq | ||
# lineinfile: | ||
# name: /etc/default/activemq | ||
# regexp: 'ACTIVEMQ_USER=" "' | ||
# line: 'ACTIVEMQ_USER="{{ amq_user }}"' | ||
|
||
|
||
- name: Copying env script to /etc/default | ||
template: | ||
src: env.j2 | ||
dest: /etc/default/activemq | ||
owner: "{{ amq_user }}" | ||
group: "{{ amq_group }}" | ||
mode: 0644 | ||
|
||
#Create a link from activemq /etc/init.d | ||
- name: Creating link to Init.d | ||
file: | ||
src: "{{ amq_home_dir }}/bin/activemq" | ||
dest: "/etc/init.d/activemq" | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
state: link | ||
|
||
#Enable activemq service in default run levels | ||
- name: Enabling activemq service in defualt run levels | ||
command: update-rc.d activemq defaults | ||
notify: Starting amq service |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- stat: path={{ amq_install_dir }}/apache-activemq-{{ amq_version }} | ||
register: result | ||
|
||
- debug: msg="Path exists and a directory" | ||
notify: start amq |
Oops, something went wrong.