X-Git-Url: http://git.indexdata.com/?p=lui-solr.git;a=blobdiff_plain;f=docker%2Fdocker-deploy.yml;fp=docker%2Fdocker-deploy.yml;h=ca0d4ab3590b151877c4818a0c926dcbdf32517d;hp=628095ac09718e836d23c719221de8f46dc5ef6c;hb=664635ceab85dcb4b9624bcce816a3da51e00b26;hpb=2cb8d225c210520bb19898f3302e88dc2f62b703 diff --git a/docker/docker-deploy.yml b/docker/docker-deploy.yml index 628095a..ca0d4ab 100644 --- a/docker/docker-deploy.yml +++ b/docker/docker-deploy.yml @@ -43,28 +43,21 @@ become: yes service: name=docker enabled=yes state=started - - name: Check for luinet network - command: docker network ls -f name=luinet -q - register: luinet - - - name: Create luinet network - command: docker network create luinet - when: luinet.stdout == "" - - name: Launch ZooKeeper + become: yes docker_container: name=zk1 image=jplock/zookeeper - - name: Get networks for ZooKeeper - shell: "docker inspect --format={% raw %}'{{json .NetworkSettings.Networks}}'{% endraw %} zk1" - register: zk1_networks + - name: Get contents of /solr path in ZooKeeper + become: yes + command: docker exec -t zk1 bin/zkCli.sh get /solr + register: zk1_solr - - name: Attach ZooKeeper to luinet network - command: docker network connect luinet zk1 - when: (zk1_networks.stdout|from_json).luinet is not defined + - name: Create /solr path in ZooKeeper + become: yes + command: docker exec -t zk1 bin/zkCli.sh create /solr [] + when: zk1_solr.stdout.find('Node does not exist') != -1 - - name: Detach ZooKeeper from bridge network - command: docker network disconnect bridge zk1 - when: (zk1_networks.stdout|from_json).bridge is defined +# Separate paths for setting up Solr nodes - hosts: dev roles: @@ -74,25 +67,41 @@ roles: - prod -- hosts: all +# Back to everyone +- hosts: all tasks: - - name: Get networks for Solr - shell: "docker inspect --format={% raw %}'{{json .NetworkSettings.Networks}}'{% endraw %} solr1" - register: solr1_networks - - - name: Attach Solr to luinet network - command: docker network connect luinet solr1 - when: (solr1_networks.stdout|from_json).luinet is not defined - - - name: Detach Solr from bridge network - command: docker network disconnect bridge solr1 - when: (solr1_networks.stdout|from_json).bridge is defined - - # - name: Create Solr container - # docker_container: - # name: solr1 - # tty: yes - # published_ports: 8983:8983 - # #volumes: /vagrant/conf/solr/solr-home:/opt/solr/server/solr - # command: bash -c '/opt/solr/bin/solr start -f -z zk1:2181' + - name: Launch Solr1 + become: yes + docker_container: + name: solr1 + image: lui-solr + tty: yes + published_ports: 8983:8983 + links: zk1:ZK1 + command: bash -c '/opt/solr/bin/solr start -f -z $ZK1_PORT_2181_TCP_ADDR:$ZK1_PORT_2181_TCP_PORT/solr' + + - name: Launch Solr2 + become: yes + docker_container: + name: solr2 + image: lui-solr + tty: yes + published_ports: 8984:8983 + links: zk1:ZK1 + command: bash -c '/opt/solr/bin/solr start -f -z $ZK1_PORT_2181_TCP_ADDR:$ZK1_PORT_2181_TCP_PORT/solr' + + ### HERE I AM ### + # wait for ZooKeeper to see all the solr nodes before proceeding + # look at Ansible until module + + - name: Check lui collection + become: yes + command: docker exec -t zk1 bin/zkCli.sh ls /solr/collections + register: lui_collection + + - name: Create lui collection + become: yes + command: docker exec -t solr1 bin/solr create -c lui -d /opt/solr/lui-solr -shards 2 + when: (lui_collection.stdout_lines|last).find('lui') == -1 +