main.yml 4.38 KB
Newer Older
1 2 3 4 5
---
# file: roles/activemq/vars/mail.yml

- name: get the activemq installation
  get_url: url={{ activemq_download_url }} dest=~/{{ activemq_archive_name }}
6
           sha256sum={{ activemq_archive_sha256_sum }}
7
  
8 9 10
- name: get the activemq rar archive
  get_url: url={{ activemq_rar_url }} dest=~/activemq-rar.rar
  
11
- name: extract activemq installation
12 13
  shell: tar -xf ~/"{{ activemq_archive_name }}" -C "{{ activemq_inst_directory }}"
         creates={{ activemq_inst_directory }}/{{ activemq_name }}/README.txt
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

- name: create the activemq group
  group: name="{{ activemq_group }}" state=present
  
- name: create the activemq user
  user: name="{{ activemq_user }}" group="{{ activemq_group }}" createhome=no state=present
  
- name: make the activemq user the owner of the activemq files
  file: path="{{ activemq_inst_directory }}/{{ activemq_name }}"
        owner="{{ activemq_user }}" group="{{ activemq_group }}"
        recurse=yes state=directory
        
- name: make a pretty symlink for activemq
  file: src="{{ activemq_inst_directory }}/{{ activemq_name }}"
        path="{{ activemq_inst_directory }}/{{ activemq_service_name }}"
        owner="{{ activemq_user }}" group="{{ activemq_group }}" state=link
  
31 32 33 34 35
- name: enable JMX
  lineinfile: dest=/opt/activemq/conf/activemq.xml backrefs=yes
              regexp='broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost"' 
              line='    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" useJmx="true">'

36
- name: enable the management console
Christopher Harm's avatar
Christopher Harm committed
37
  lineinfile: dest=/opt/activemq/conf/activemq.xml backrefs=yes
38
              regexp='managementContext createConnector="false"' 
39
              line='            <managementContext createConnector="true" rmiServerPort="1098" connectorPort="1099"/>'
40 41 42 43 44 45 46 47 48 49 50 51 52 53
  notify:
    - restart activemq
    
- name: create a symlink for the startup script
  file: src="{{ activemq_home_directory }}/bin/linux-x86-32/activemq"
        path="/etc/init.d/{{ activemq_service_name }}"
        state=link
        
- name: register the activemq startup script with chkconfig
  shell: chkconfig --add activemq creates=/etc/rc0.d/K20activemq
        
- name: configure chkconfig to run the activemq startup script at the correct run-levels
  shell: chkconfig --level 2345 activemq  on creates=/etc/rc2.d/S80activemq
  
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
- name: download the hawt.io war file
  get_url: url={{ hawtio_download_url }} dest=~/{{ hawtio_archive_name }}
           sha256sum={{ hawtio_archive_sha256_sum }}
  
- name: create the hawtio webapps directory
  file:
    path: "{{ activemq_home_directory }}/webapps/hawtio"
    state: directory
  
- name: extract the hawt.io war file
  unarchive: 
    src: "~/{{ hawtio_archive_name }}"
    remote_src: True
    dest: "{{ activemq_home_directory }}/webapps/hawtio"
    creates: "{{ activemq_home_directory }}/webapps/hawtio/manifest.json"

- name: override the hawtio auth defaults
  lineinfile: 
    dest: "{{ activemq_home_directory }}/bin/env"
    regexp: "^ACTIVEMQ_OPTS="
    insertafter: "#ACTIVEMQ_OPTS"
    line: "ACTIVEMQ_OPTS=\"$ACTIVEMQ_OPTS -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal\""

77 78
- name: make sure activemq is started
  service: name="{{ activemq_service_name }}" state="started"
79 80 81 82 83 84 85 86 87 88

- name: update facts file
  lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' create=true regexp='[activemq]' line='[activemq]'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_version' line='activemq_version={{ activemq_version }}'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_name' line='activemq_name={{ activemq_name }}'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_group' line='activemq_group={{ activemq_group }}'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_service_name' line='activemq_service_name={{ activemq_service_name }}'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_inst_directory' line='activemq_inst_directory={{ activemq_inst_directory }}'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_home_directory' line='activemq_home_directory={{ activemq_home_directory }}'"
- lineinfile: "dest='/etc/ansible/facts.d/build_vars.fact' regexp='activemq_rar_url' line='activemq_rar_url={{ activemq_rar_url }}'"
89 90