Installing Docker Engine in Fedora 25 via Ansible

Docker is an open source container platform. The container encapsulating everything it needs including libraries, code, system tools, runtime etc.

From Docker site

Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

I have tried the script in Fedora 25. But it should work fine in Fedora 24 also.

For the manual steps refer

Ansible script for Docker Engine

- hosts: docker_server
  become: true
  - name: install python modules.
      name: python2
      state: present

  - name: Install python-dnf module
      name: python-dnf
      state: present

  - name: Remove existing unofficial Docker packages
      name: "{{ item }}"
      state: absent
      - docker
      - docker-common
      - container-selinux
      - docker-selinux

  - name: Install dnf-plugins-core to manage DNF repository
      name:  dnf-plugins-core
      state: present

  - name: Add docker repo
    shell:  'dnf config-manager \
      --add-repo \'

  - name: Update dnf package index
     name: docker-engine
     state: latest

  - name: Start docker service
      state: started
      name: docker

To verify the docker installation was successful run the following command after the script is run.

sudo docker run hello-world