  - name: Run the Loom task runner.
    docker_container:
      name: "{{taskrunner_container_name}}-{{task_attempt_id}}"
      image: "{{loom_docker_image}}"
      volumes:  "{{[ '/var/run/docker.sock'~':'~'/var/run/docker.sock', \
                 storage_root~':'~storage_root ]}}"
      api_version: auto
      network_mode: host
      command: /bin/bash -c 'loom-taskrunner --task_attempt_id {{task_attempt_id}} --master_url {{server_url}} --log_level {{log_level}} --log_file {{storage_root}}/loom_taskrunner-{{task_attempt_id}}.log}}'
      log_driver: fluentd
      log_options:
        fluentd-address: "{{server_url | regex_replace('^.*://(.+):.*$', '\\1')}}:{{fluentd_port}}"
        fluentd-async-connect: "true"
        tag: "loom.{%raw%}{{.Name}}.{{.ID}}{%endraw%}"

  - name: Run the Loom task runner.
    docker_container:
      name: "{{taskrunner_container_name}}-{{task_attempt_id}}"
      image: "{{loom_docker_image}}"
      volumes:  "{{[ '/var/run/docker.sock'~':'~'/var/run/docker.sock', \
                 storage_root~':'~storage_root ]}}"
      api_version: auto
      network_mode: host
      command: /bin/bash -c 'loom-taskrunner --task_attempt_id {{task_attempt_id}} --master_url {{server_url}} --log_level {{log_level}} --log_file {{storage_root}}/loom_taskrunner-{{task_attempt_id}}.log}}'
      log_driver: fluentd
      log_options:
        fluentd-address: "{{server_url | regex_replace('^.*://([^:]+)(?::.+)?$', '\\1')}}:{{fluentd_port}}"
        fluentd-async-connect: "true"
        tag: "loom.{%raw%}{{.Name}}.{{.ID}}{%endraw%}"

Update regex that extracts hostname/ip from server_url to handle urls without ports.
Update regex that extracts hostname/ip from server_url to handle urls without ports.
