mailcow / mailcow-ansiblerole

The official ansible role to setup mailcow using Ansible
GNU General Public License v3.0
75 stars 49 forks source link

role not working with ansible 2.10.11 #16

Closed PaulLebmann closed 3 years ago

PaulLebmann commented 3 years ago

Hello,

thanks for making this role available!

It seems due to some changes in ansible docker_container_info and docker_compose are no longer builtin.

On Ubuntu 20.04 with ansible installed via the ppa, I had to install the collections community.docker and community.netcommon (since the filter ipaddr was not available) and apply the following changes:

 diff --git a/tasks/main.yml b/tasks/main.yml
 index 581fea0..cc5f130 100755
 --- a/tasks/main.yml
 +++ b/tasks/main.yml
 @@ -9,7 +9,7 @@
  - name: Install required pip packages
    become: yes
    pip:
 -    name: docker
 +    name: docker-compose
      state: present

  - name: Check if mailcow installation directory exists
 @@ -56,13 +56,13 @@

  - name: Check if mailcow is running
    become: yes
 -  docker_container_info:
 +  community.docker.docker_container_info:
      name: "{{ mailcow__docker_compose_project_name }}_nginx-mailcow_1"
    register: mailcow_running

  - name: Start mailcow stack
    become: yes
 -  docker_compose:
 +  community.docker.docker_compose:
      project_src: "{{ mailcow__install_path }}"
      project_name: "{{ mailcow__docker_compose_project_name }}"
      state: present

I also had to change the pip installation from docker to docker-compose since, although I installed docker-compose before running this role it complained that the pip package was missing. Installing docker-compose via pip seems to pull in docker as a dependency. Which seems to satisfy all dependencies for community.docker.docker_compose.

Since I am rather new to ansible I don't know if it is possible to modify the role in a way that it works for ansible 2.9 and 2.10 - therefore I choose to create just an issue and not a PR.

After installing the collections and applying the three changes the role worked as expected.

best regards,

Paul

ntimo commented 3 years ago

Thanks for reporting this :) Should be fixed