- name: Create rancher directory file: path: "{{ appdata_path }}/rancher" state: directory owner: "{{ main_username }}" mode: "{{ docker_compose_directory_mask }}" become: true - name: Install rancher compose file template: src: files/docker-compose.yml dest: "{{ appdata_path }}/rancher/docker-compose.yml" mode: "{{ docker_compose_file_mask }}" owner: "{{ main_username }}" validate: docker-compose -f %s config register: compose_file become: true - name: Cycle rancher container docker_compose: project_src: "{{ appdata_path }}/rancher" pull: true remove_orphans: true remove_volumes: true state: "{{ item }}" when: compose_file.changed loop: - absent - present