- hosts: docker tasks: - name: "Creating An yum repo for docker..... " yum_repository: name: "docker" description: "repo for DOcker" baseurl: "https://download.docker.com/linux/centos/7/x86_64/stable/" gpgcheck: no - name: "Installing Docker ....." package: name: "docker-ce-18.09.1-3.el7.x86_64" state: present - name: "Satarting Docker Service ....." service: name: "docker" state: started - name: "docker_image module need an python module i.e. docker-py ..." pip: name: docker-py - name: "Pulling Image httpd ....." docker_image: name: httpd source: pull - name: "Copying the html file (page) ...." copy: dest: "~/index.html" content: "Hii This page is Hosted From the HTTPD docker image !!" - name: "Lunching the docker image i.e. httpd ...." community.general.docker_container: name: webOS image: httpd ports: - "888:80" state: started - name: "lets allow firewall for the port which we have routed for to the docker webserver !!" firewalld: port: "888/tcp" state: enabled permanent: yes immediate: yes