--- # see: https://docs.docker.com/engine/storage/drivers/zfs-driver/ # see: https://github.com/portainer/portainer # # Archlinux: only if your target is meant to frequently build docker images # see: https://stackoverflow.com/a/78352698 - name: Uninstall docker when: uninstall_docker | lower in ['yes', 'y'] block: - name: Include uninstall tasks ansible.builtin.include_tasks: uninstall.yml - name: Skip docker installation ansible.builtin.meta: end_play - name: Install docker ansible.builtin.package: name: docker - name: Enable the service ansible.builtin.service: name: "docker" enabled: true state: started - ansible.builtin.command: cmd: whoami no_log: true become: false register: main_user - ansible.builtin.set_fact: main_user: "{{ main_user.stdout }}" no_log: true - name: Create projects directory ansible.builtin.file: path: "{{ docker_projects_dir }}" state: directory owner: "{{ main_user }}" group: "{{ main_user }}" - name: Allow user to use docker ansible.builtin.user: name: "{{ main_user }}" groups: docker append: true register: docker_group - name: Inform the user that user needs to logout and login again ansible.builtin.debug: msg: "Please logout and login again to make sure the user is added to the docker group" when: docker_group.changed