---
- name: "Start Pi-hole"
  docker_container:
    name: pihole
    state: started
    pull: "{{ pihole_pull }}"
    restart_policy: "unless-stopped"
    keep_volumes: yes
    image: "pihole/pihole:{{ pihole_version }}"
    ports: "{{ pihole_ports }}"
    dns_opts: "{{ pihole_dns_opts }}"
    env: "{{ pihole_env }}"
    volumes:
      - "pihole-etc-storage:/etc/pihole/"
      - "pihole-dnsmasq-storage:/etc/dnsmasq.d/"

---
- name: "Pull Pi-hole"
  docker_image:
    name: "pihole/pihole:{{ pihole_version }}"
    source: pull

- name: "Stop/disable systemd-resolved"
  systemd:
    name: "systemd-resolved.service"
    state: stopped
    enabled: no
  become: yes
  when: ansible_distribution == "Ubuntu"

- name: "Setup resolv.conf"
  copy:
    dest: /etc/resolv.conf
    content: |
      nameserver {{ ansible_default_ipv4.gateway }}
  become: yes
  when: ansible_distribution == "Ubuntu"

- name: "Start Pi-hole"
  docker_container:
    name: pihole
    state: started
    pull: "{{ pihole_pull }}"
    restart_policy: "unless-stopped"
    keep_volumes: yes
    image: "pihole/pihole:{{ pihole_version }}"
    ports: "{{ pihole_ports }}"
    dns_opts: "{{ pihole_dns_opts }}"
    env: "{{ pihole_env }}"
    volumes:
      - "pihole-etc-storage:/etc/pihole/"
      - "pihole-dnsmasq-storage:/etc/dnsmasq.d/"
    capabilities:
      - sys_nice

Update pihole docker role to work around resolved issues.
Update pihole docker role to work around resolved issues.
