- hosts: topside
  become: yes
  become_method: sudo
  vars:
    proxy:
      http_proxy: http://192.168.88.3:3128
      https_proxy: http://192.168.88.3:3128
  tasks:
    - set_fact:
          ssh_connection_ip: "{{ ansible_env['SSH_CONNECTION'].split()[2] }}"
    - set_fact:
          ssh_interface: "{{ item }}"
      when: hostvars[inventory_hostname]['ansible_' ~ item]['ipv4']['address'] == ssh_connection_ip
      with_items: ansible_interfaces
    - name: Install htop
      apt: name=htop state=latest
      environment: "{{proxy}}"
    - name: Install Java 8 Runtime
      apt: name=openjdk-8-jre state=latest
      tags: java
      environment: "{{proxy}}"
    - name: Install DHCP Server
      apt: name=isc-dhcp-server state=latest
      environment: "{{proxy}}"
    - name: Configure DHCP Service
      template: src=files/services/isc-dhcp-server dest=/etc/default/isc-dhcp-server mode=644 owner=root group=root
    - name: Configure DHCP Server
      copy: src=files/conf/dhcpd.conf dest=/etc/dhcp/dhcpd.conf mode=644 owner=root group=root
      notify: Restart DHCP Server
  handlers:
    - name: Restart DHCP Server
      service: name=isc-dhcp-server state=restarted

- hosts: topside
  become: yes
  become_method: sudo
  vars:
    proxy:
      http_proxy: http://192.168.88.3:3128
      https_proxy: http://192.168.88.3:3128
  tasks:
    - set_fact:
          ssh_connection_ip: "{{ ansible_env['SSH_CONNECTION'].split()[2] }}"
    - set_fact:
          ssh_interface: "{{ item }}"
      when: "{{ hostvars[inventory_hostname]['ansible_' ~ item]['ipv4']['address'] == ssh_connection_ip }}"
      with_items: "{{ ansible_interfaces }}"
    - name: Install htop
      apt: name=htop state=latest
      environment: "{{proxy}}"
    - name: Install Java 8 Runtime
      apt: name=openjdk-8-jre state=latest
      tags: java
      environment: "{{proxy}}"
    - name: Install DHCP Server
      apt: name=isc-dhcp-server state=latest
      environment: "{{proxy}}"
    - name: Configure DHCP Service
      template: src=files/services/isc-dhcp-server dest=/etc/default/isc-dhcp-server mode=644 owner=root group=root
    - name: Configure DHCP Server
      copy: src=files/conf/dhcpd.conf dest=/etc/dhcp/dhcpd.conf mode=644 owner=root group=root
      notify: Restart DHCP Server
  handlers:
    - name: Restart DHCP Server
      service: name=isc-dhcp-server state=restarted

Use full jinja2 variable syntax
ansible: Use full jinja2 variable syntax

Fixes the following deprecation warning:

> [DEPRECATION WARNING]: Using bare variables is deprecated. Update your
> playbooks so that the environment value uses the full variable syntax
> (`'{{ansible_interfaces}}'`). This feature will be removed in a future
> release. Deprecation warnings can be disabled by setting
> `deprecation_warnings=False` in ansible.cfg.
