- hosts: datacenter name: Install docker1 become: true become_user: root gather_facts: no tasks: - name: Install docker ansible.builtin.apt: name: docker.io state: present - name: Install telnet ansible.builtin.apt: name: telnet state: present - name: Install net-tools ansible.builtin.apt: name: net-tools state: present - name: Install curl! ansible.builtin.apt: name: curl state: present - name: Install deps... ansible.builtin.apt: name: - python3-pip - python3-dev - name: Create a directory docker.service.d ansible.builtin.file: path: /etc/systemd/system/docker.service.d/ state: directory mode: '0755' - name: Creating a file with content copy: dest: "/etc/systemd/system/docker.service.d/override.conf" content: | [Service] ExecStart= ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 - name: Just force systemd to reread configs (2.4 and above) ansible.builtin.systemd_service: daemon_reload: true - name: Restart docker service ansible.builtin.service: name: docker.service state: restarted