I wrote an ansible playbook which is supposed to install a tool called kafkacat.
Most of the tasks in the playbook work, all but one (the most important one).
I'm compiling the tool from source and I've successfully installed it manually using the steps I'm building in ansible.
The relevant portion of the playbook is:
- name: Install kafkacat (configure)
command: chdir={{ kafkacat_installdir }} {{ kafkacat_installdir }}/configure --enable-json --enable-static
sudo: yes
- name: Install kafkacat (make)
command: chdir={{ kafkacat_installdir }} make
environment:
CPPFLAGS: ' -Itmp-bootstrap/usr/local/include'
STATIC_LIB_yajl: ' tmp-bootstrap/usr/local/lib/libyajl_s.a'
STATIC_LIB_rdkafka: ' tmp-bootstrap/usr/local/lib/librdkafka.a'
LIBS: ' -lpthread -lrt '
sudo: yes
- name: Install kafkacat (make install)
command: chdir={{ kafkacat_installdir }} make install
sudo: yes
It is required for the "make" process to work, to know the exports I've specified in the task but for some reason it seems like the values are not exported properly and it causes the playbook to fail:
failed: [kafka-1] => {"changed": true, "cmd": ["make"], "delta": "0:00:00.422669", "end": "2016-04-25 15:10:16.085697", "rc": 2, "start": "2016-04-25 15:10:15.663028", "warnings": []}
stderr: /usr/bin/ld: cannot find -lyajl
/usr/bin/ld: cannot find -lyajl
collect2: error: ld returned 1 exit status
make: *** [kafkacat] Error 1
stdout: gcc -MD -MP -Itmp-bootstrap/usr/local/include -g -O2 -Wall -Wfloat-equal -Wpointer-arith -g -O2 -Wall -Wfloat-equal -Wpointer-arith -c kafkacat.c -o kafkacat.o
gcc -MD -MP -Itmp-bootstrap/usr/local/include -g -O2 -Wall -Wfloat-equal -Wpointer-arith -g -O2 -Wall -Wfloat-equal -Wpointer-arith -c format.c -o format.o
gcc -MD -MP -Itmp-bootstrap/usr/local/include -g -O2 -Wall -Wfloat-equal -Wpointer-arith -g -O2 -Wall -Wfloat-equal -Wpointer-arith -c json.c -o json.o
The reason why -lyajl is not found is because the export is not working.
I've also tried doing something like this:
- name: Install kafkacat (configure)
command: chdir={{ kafkacat_installdir }} CPFLAGS='CPPFLAGS= -Itmp-bootstrap/usr/local/include' STATIC_LIB_yajl='tmp-bootstrap/usr/local/lib/libyajl_s.a' STATIC_LIB_rdkafka='tmp-bootstrap/usr/local/lib/librdkafka.a' LIBS=' -lpthread -lrt' {{ kafkacat_installdir }}/configure --enable-json --enable-static
Your help is much appreciated and thanks in advance,