Ad Widget

Collapse

Automating 2.4 Install

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slakevc
    Junior Member
    • Feb 2015
    • 2

    #1

    Automating 2.4 Install

    Hello, I'm having an issue installing version 2.4 on Ubuntu using a provisioner(ansible). I need to be able to remotely install the package/build from source and am unable to do so because of the debconf dialog that asks:

    Configure database for zabbix-server-mysql with dbconfig-common?

    A remote install hangs at that point.

    I've tried using the hacky fix: export DEBCONF_FRONTEND=noninteractive to turn off those dialogs globally but then the install just hangs. Is there any way around this?
  • slakevc
    Junior Member
    • Feb 2015
    • 2

    #2
    Figured it out

    Think I was just using the wrong source files. Anyway, here's my ansible playbook for building 2.4 in case it helps anyone, All of the files referenced by the 'copy' module were copied from a running server made with these instructions:https://www.zabbix.com/documentation...lation/install

    ---
    - name: Automate mysql password setup
    command: bash -c "sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password zabbix'"

    - name: Automate mysql password setup
    command: bash -c "sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password zabbix'"

    - name: install packages
    action: apt pkg={{ item }} state=installed
    with_items:
    - libsnmp-dev
    - apache2
    - build-essential
    - libxml2-dev
    - libcurl4-gnutls-dev
    - libmysqlclient-dev
    - php5
    - php5-mysql
    - php5-gd
    - mysql-server

    - name: Copy over Zabbix 2.4 source
    copy: src=zabbix-2.4.3.tar.gz dest=/tmp

    - name: Extract Zabbix source
    command: chdir=/tmp tar xvzf zabbix-2.4.3.tar.gz

    - name: Create zabbix group
    group: name=zabbix state=present

    - name: Create zabbix user
    user: createhome=no group=zabbix name=zabbix state=present

    - name: Move zabbix frontend into place
    command: chdir=/tmp/zabbix-2.4.3/ bash -c "mv frontends/php/* /var/www/"

    - name: Set up apache with zabbix entry
    copy: src=000-default.conf dest=/etc/apache2/sites-enabled/000-default.conf

    - name: Replace php apache php.ini file
    copy: src=php.ini dest=/etc/php5/apache2/php.ini

    - name: Create zabbix database
    command: mysql -h localhost -u root -pzabbix --execute='CREATE DATABASE zabbix character set utf8 collate utf8_bin'

    - name: Create zabbix mysql user
    command: mysql -h localhost -u root -pzabbix -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'"

    - name: Configure source
    command: chdir=/tmp/zabbix-2.4.3 bash -c './configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2'

    - name: Install zabbix
    command: chdir=/tmp/zabbix-2.4.3 bash -c 'make install'

    - name: Set up zabbix config
    copy: src=zabbix.conf.php dest=/var/www/conf/zabbix.conf.php

    - name: Set up zabbix config 2
    copy: src=zabbix_server.conf dest=/usr/local/etc/zabbix_server.conf

    - name: Import schema
    command: chdir=/tmp/zabbix-2.4.3/database/mysql bash -c "mysql -h localhost -u zabbix -pzabbix zabbix < schema.sql"

    - name: Import images
    command: chdir=/tmp/zabbix-2.4.3/database/mysql bash -c "mysql -h localhost -u zabbix -pzabbix zabbix < images.sql"

    - name: Import data
    command: chdir=/tmp/zabbix-2.4.3/database/mysql bash -c "mysql -h localhost -u zabbix -pzabbix zabbix < data.sql"

    - name: Restart mysql
    command: /etc/init.d/mysql restart

    - name: Start zabbix
    command: zabbix_server

    - name: Restart apache
    command: /etc/init.d/apache2 restart

    Comment

    Working...