Skip to main content

Docker Install

---
- name: InstallDVWA
  hosts: webservers
  become: true
  tasks:

  - name: Uninstall apache httpd
    apt:
       name: apache2
       state: absent

  - name: docker.io
    apt:
       update_cache: yes
       name: docker.io
       state: present

  - name: Install pip3
    apt:
       name: python3-pip
       state: present

  - name: Install docker
    pip:
       name: docker
       state: present

  - name: Install DVWA docker container
    docker_container:
       name: dvwa
       image: cyberxsecurity/dvwa
       published_ports: 80:80
       restart_policy: unless-stopped
       state: started


  - name: Start Docker
    systemd:
       enabled: yes
       name: docker