Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for java upgrade and no installation #32

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
10 changes: 8 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
apache_mirror: http://apache.mirrors.tds.net
kafka_hosts: "{{ansible_fqdn}}:9092"
kafka_version: 0.8.1.1
kafka_version: 0.10.2.0
kafka_branch: 2.11
kafka_url: "https://nexus.ncrsmb.com/repository/momentum-infrastructure/kafka_{{kafka_branch}}/{{kafka_version}}/"
run_mode: Deploy
skip_install: False

Expand All @@ -20,9 +22,13 @@ kafka_log_segment_bytes: "{{kafka_log_retention_bytes}}"
kafka_log_cleanup_interval_mins: 1
kafka_heap_opts: "-Xmx1G -Xms1G"
kafka_tarball_location: /root
kafka_tarball_name: "kafka_2.9.2-{{kafka_version}}.tgz"
kafka_staging_dir: ./tarballs
kafka_tarball_name: "kafka_{{kafka_branch}}-{{kafka_version}}.tgz"
java_version: "7"
monasca_wait_for_period: 30
monasca_log_level: WARN
zookeeper_connection_timeout_ms: 1000000

jmx_port: 9999

verify: True
6 changes: 3 additions & 3 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
user: name={{kafka_user}} system=yes group={{kafka_group}}

- name: Uncompress the kafka tar
unarchive: copy=no creates=/opt/kafka_2.9.2-{{kafka_version}} dest=/opt src="{{ kafka_tarball_location }}/{{ kafka_tarball_name }}"
unarchive: copy=no creates=/opt/kafka_{{kafka_branch}}-{{kafka_version}} owner={{kafka_user}} group={{kafka_group}} dest=/opt src="{{ kafka_tarball_location }}/{{ kafka_tarball_name }}"

- name: Link /opt/kafka to the right version
file: path=/opt/kafka state=link src=/opt/kafka_2.9.2-{{kafka_version}}
file: path=/opt/kafka state=link src=/opt/kafka_{{kafka_branch}}-{{kafka_version}}

- name: Overwrite the start script so the Java Opts can be changed if Kafka 0.8.1.1
lineinfile: dest=/opt/kafka_2.9.2-{{kafka_version}}/bin/kafka-server-start.sh regexp="^export KAFKA_HEAP_OPTS=" line="export KAFKA_HEAP_OPTS=\"{{ kafka_heap_opts }}\""
lineinfile: dest=/opt/kafka_{{kafka_branch}}-{{kafka_version}}/bin/kafka-server-start.sh regexp="^export KAFKA_HEAP_OPTS=" line="export KAFKA_HEAP_OPTS=\"{{ kafka_heap_opts }}\""
notify:
- restart kafka
when: kafka_version == "0.8.1.1"
Expand Down
7 changes: 4 additions & 3 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- name: Install OpenJDK
apt: name=openjdk-7-jre-headless state=present
#- name: Install OpenJDK
# apt: name=openjdk-{{java_version}}-jre-headless state=present
# when: java_version != 'none'

- name: Fetch kafka binary package
get_url: dest="{{ kafka_tarball_location }}/{{ kafka_tarball_name }}" url="{{apache_mirror}}/kafka/{{kafka_version}}/{{kafka_tarball_name}}"
get_url: dest="{{ kafka_staging_dir }}/{{ kafka_tarball_name }}" url="{{kafka_url}}/{{kafka_tarball_name}}"
2 changes: 1 addition & 1 deletion templates/kafka.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ User=kafka
Group=kafka
LimitNOFILE=32768
Restart=on-failure
Environment="KAFKA_HEAP_OPTS={{ kafka_heap_opts }}"
Environment="KAFKA_HEAP_OPTS={{ kafka_heap_opts }}" "JMX_PORT={{ jmx_port }}"
ExecStart=/opt/kafka/bin/kafka-server-start.sh /etc/kafka/server.properties

[Install]
Expand Down