- name: Directories are present
  file:
    dest: "{{ item }}"
    state: directory
    owner: vagrant
  with_items: directories
  tags: [nginx]

- name: Container is running
  docker:
    image: nginx:alpine
    name: nginx
    state: running
    ports: "{{ ports }}"
    volumes: "{{ volumes }}"
  when: not log_to_syslog is defined
  tags: [nginx]

- name: Container is running
  docker:
    image: nginx:alpine
    name: nginx
    state: running
    ports: "{{ ports }}"
    volumes: "{{ volumes }}"
    log_driver: syslog
    log_opt:
      syslog-tag: nginx
  when: log_to_syslog is defined
  tags: [nginx]

- name: Files are present
  copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
  with_items: files
  register: result
  tags: [nginx]

- name: Container is reloaded
  shell: docker kill -s HUP nginx
  when: result|changed
  tags: [nginx]

- name: Info is sent to Consul
  uri:
    url: http://localhost:8500/v1/kv/proxy/ip
    method: PUT
    body: "{{ ip }}"
  ignore_errors: yes
  tags: [nginx]

- name: Directories are present
  file:
    dest: "{{ item }}"
    state: directory
    owner: vagrant
  with_items: directories
  tags: [nginx]

- name: Container is running
  docker:
    image: nginx:alpine
    name: nginx
    state: running
    ports: "{{ ports }}"
    volumes: "{{ volumes }}"
  when: not log_to_syslog is defined
  tags: [nginx]

- name: Container is running
  docker:
    image: nginx:alpine
    name: nginx
    state: running
    ports: "{{ ports }}"
    volumes: "{{ volumes }}"
    log_driver: syslog
    log_opt:
      tag: nginx
  when: log_to_syslog is defined
  tags: [nginx]

- name: Files are present
  copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
  with_items: files
  register: result
  tags: [nginx]

- name: Container is reloaded
  shell: docker kill -s HUP nginx
  when: result|changed
  tags: [nginx]

- name: Info is sent to Consul
  uri:
    url: http://localhost:8500/v1/kv/proxy/ip
    method: PUT
    body: "{{ ip }}"
  ignore_errors: yes
  tags: [nginx]

Fix issue with nginx ansible task to support Docker 1.12 (syslog-tag changed to tag)
Fix issue with nginx ansible task to support Docker 1.12 (syslog-tag changed to tag)
