--- - name: add https support apt: name: apt-transport-https cache_valid_time: 3600 update_cache: yes - name: add docker gpg key to apt keyring apt_key: id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 url: https://download.docker.com/linux/debian/gpg - apt_repository: repo: "deb https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable" state: present update_cache: yes when: ansible_distribution == "Debian" - name: install docker apt: name: docker-ce - name: add jenkins to the docker group user: name: "{{ jenkins_user }}" groups: docker append: yes