- hosts: localhost tasks: - name: Create network for docker sandboxes command: docker network create --driver bridge --subnet="{{ dockersand_subnet }}" dockersand-net - name: Get current domain name shell: hostname -d register: domainname - name: Create docker sandbox containers command: docker run -dh "dockersand{{ item }}.{{ domainname.stdout }}" \ --name "dockersand{{ item }}" \ --net=dockersand-net \ --volume=/shared:/shared \ "{{ dockersand_image }}" with_sequence: start="{{ dockersand_start }}" end="{{ dockersand_end }}"