Answers: <p>I commited the fix to the Github repo. The problem was that a role was included recursively.</p>
  
  <p>I split up the roles a bit to fix it.
  Also discovered a lot of other issues with repeated task executions (not all of the fixed yet because I'm still learning how to structure my ansible tasks)</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-04-11T09:05:12.003Z
Answers: 2020-04-11T09:05:12.003Z
Answers: dfsg76
Body: <p>I wrote some roles for my home lab to setup a GlusterFS cluster.</p>
  
  <p>But when I run it on my 2 nodes, some tasks get executed over and over again and it seems that it never ends.</p>
  
  <p>Here is the log output (I cut it off at some point and also removed a lot of the * characters)</p>
  
  <pre><code> ✘ user@pc  ~/ansible   feature/role-gluster  ansible-playbook -i inventories/playground/hosts.yaml site.yml -K
  BECOME password: 
  
  PLAY [storageservers] ******************
  
  TASK [Gathering Facts] *****************
  ok: [node2]
  ok: [node1]
  
  TASK [include_role : gluster-node] *****
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  changed: [node2]
  changed: [node1]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  changed: [node1]
  changed: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node : Update apt-get repo and cache] ***
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node : Upgrade all apt packages] ********
  changed: [node2]
  
  changed: [node1]
  
  TASK [gluster-node : Install GlusterFS] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node : Enable GlusterFS on Boot] ********
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node : Probe GlusterFS Nodes] *
  changed: [node1] =&gt; (item=node1)
  changed: [node2] =&gt; (item=node1)
  changed: [node1] =&gt; (item=node2)
  changed: [node2] =&gt; (item=node2)
  
  TASK [gluster-node : Ensure Gluster brick and mount directories exist.] 
  changed: [node1] =&gt; (item=/data1)
  changed: [node2] =&gt; (item=/data1)
  changed: [node1] =&gt; (item=/gluster_volume1)
  changed: [node2] =&gt; (item=/gluster_volume1)
  
  TASK [gluster-node : Configure Gluster volume.] *******
  changed: [node1]
  
  TASK [gluster-node : Ensure Gluster volume is mounted.] *************
  changed: [node1]
  changed: [node2]
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create default partitioning] *****
  
  TASK [Create gluster volume for partition 1] 
  
  TASK [include_role : gluster-node] *****
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Update apt-get repo and cache] ***
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Upgrade all apt packages] ********
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Install GlusterFS] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Enable GlusterFS on Boot] ********
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Probe GlusterFS Nodes] *
  changed: [node1] =&gt; (item=node1)
  changed: [node2] =&gt; (item=node1)
  changed: [node2] =&gt; (item=node2)
  changed: [node1] =&gt; (item=node2)
  
  TASK [gluster-node : Ensure Gluster brick and mount directories exist.] 
  ok: [node1] =&gt; (item=/data1)
  ok: [node2] =&gt; (item=/data1)
  ok: [node1] =&gt; (item=/gluster_volume1)
  ok: [node2] =&gt; (item=/gluster_volume1)
  
  TASK [gluster-node : Configure Gluster volume.] *******
  ok: [node1]
  
  TASK [gluster-node : Ensure Gluster volume is mounted.] *************
  ok: [node1]
  ok: [node2]
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create default partitioning] *****
  
  TASK [Create gluster volume for partition 1] 
  
  TASK [include_role : gluster-node] *****
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node2]
  ok: [node1]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Update apt-get repo and cache] ***
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Upgrade all apt packages] ********
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Install GlusterFS] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Enable GlusterFS on Boot] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Probe GlusterFS Nodes] 
  changed: [node1] =&gt; (item=node1)
  changed: [node2] =&gt; (item=node1)
  changed: [node1] =&gt; (item=node2)
  changed: [node2] =&gt; (item=node2)
  
  TASK [gluster-node : Ensure Gluster brick and mount directories exist.] 
  ok: [node1] =&gt; (item=/data1)
  ok: [node2] =&gt; (item=/data1)
  ok: [node1] =&gt; (item=/gluster_volume1)
  ok: [node2] =&gt; (item=/gluster_volume1)
  
  TASK [gluster-node : Configure Gluster volume.] 
  ok: [node1]
  
  
  ^C [ERROR]: User interrupted execution
  
  </code></pre>
  
  <p>I placed all the code here:
  <a href="https://github.com/CodingSpiderFox/ansible-loop-problem" rel="nofollow noreferrer">https://github.com/CodingSpiderFox/ansible-loop-problem</a></p>
  
Tags: <ansible><yaml><glusterfs>
Title: Ansible seems to execute infinite loop
UserDisplayName: dfsg76
ThreadText: # Ansible seems to execute infinite loop
  
  (Asked by: username_0 on 2020-04-10)
  
  I wrote some roles for my home lab to setup a GlusterFS cluster.
  
  But when I run it on my 2 nodes, some tasks get executed over and over again and it seems that it never ends.
  
  Here is the log output (I cut it off at some point and also removed a lot of the \* characters)
  
  ```
   ✘ user@pc  ~/ansible   feature/role-gluster  ansible-playbook -i inventories/playground/hosts.yaml site.yml -K
  BECOME password: 
  
  PLAY [storageservers] ******************
  
  TASK [Gathering Facts] *****************
  ok: [node2]
  ok: [node1]
  
  TASK [include_role : gluster-node] *****
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  changed: [node2]
  changed: [node1]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  changed: [node1]
  changed: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  changed: [node1]
  changed: [node2]
  
  TASK [gluster-node : Update apt-get repo and cache] ***
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node : Upgrade all apt packages] ********
  changed: [node2]
  
  changed: [node1]
  
  TASK [gluster-node : Install GlusterFS] 
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node : Enable GlusterFS on Boot] ********
  changed: [node2]
  changed: [node1]
  
  TASK [gluster-node : Probe GlusterFS Nodes] *
  changed: [node1] => (item=node1)
  changed: [node2] => (item=node1)
  changed: [node1] => (item=node2)
  changed: [node2] => (item=node2)
  
  TASK [gluster-node : Ensure Gluster brick and mount directories exist.] 
  changed: [node1] => (item=/data1)
  changed: [node2] => (item=/data1)
  changed: [node1] => (item=/gluster_volume1)
  changed: [node2] => (item=/gluster_volume1)
  
  TASK [gluster-node : Configure Gluster volume.] *******
  changed: [node1]
  
  TASK [gluster-node : Ensure Gluster volume is mounted.] *************
  changed: [node1]
  changed: [node2]
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create default partitioning] *****
  
  TASK [Create gluster volume for partition 1] 
  
  TASK [include_role : gluster-node] *****
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Update apt-get repo and cache] ***
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Upgrade all apt packages] ********
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Install GlusterFS] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Enable GlusterFS on Boot] ********
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Probe GlusterFS Nodes] *
  changed: [node1] => (item=node1)
  changed: [node2] => (item=node1)
  changed: [node2] => (item=node2)
  changed: [node1] => (item=node2)
  
  TASK [gluster-node : Ensure Gluster brick and mount directories exist.] 
  ok: [node1] => (item=/data1)
  ok: [node2] => (item=/data1)
  ok: [node1] => (item=/gluster_volume1)
  ok: [node2] => (item=/gluster_volume1)
  
  TASK [gluster-node : Configure Gluster volume.] *******
  ok: [node1]
  
  TASK [gluster-node : Ensure Gluster volume is mounted.] *************
  ok: [node1]
  ok: [node2]
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create default partitioning] *****
  
  TASK [Create gluster volume for partition 1] 
  
  TASK [include_role : gluster-node] *****
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [include_role : gluster-node-partition] 
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node2]
  ok: [node1]
  
  TASK [Create data1 partition] **********
  
  TASK [gluster-node-partition : Create data1 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data1 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data1 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data2 partition] **********
  
  TASK [gluster-node-partition : Create data2 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data2 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data2 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Mount data2 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [Create data3 partition] **********
  
  TASK [gluster-node-partition : Create data3 partition] 
  ok: [node2]
  ok: [node1]
  
  TASK [gluster-node-partition : Create filesystem on data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Create mount point for data3 partition] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node-partition : Mount data3 partition] *
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Update apt-get repo and cache] ***
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Upgrade all apt packages] ********
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Install GlusterFS] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Enable GlusterFS on Boot] 
  ok: [node1]
  ok: [node2]
  
  TASK [gluster-node : Probe GlusterFS Nodes] 
  changed: [node1] => (item=node1)
  changed: [node2] => (item=node1)
  changed: [node1] => (item=node2)
  changed: [node2] => (item=node2)
  
  TASK [gluster-node : Ensure Gluster brick and mount directories exist.] 
  ok: [node1] => (item=/data1)
  ok: [node2] => (item=/data1)
  ok: [node1] => (item=/gluster_volume1)
  ok: [node2] => (item=/gluster_volume1)
  
  TASK [gluster-node : Configure Gluster volume.] 
  ok: [node1]
  
  ^C [ERROR]: User interrupted execution
  
  ```
  
  I placed all the code here:
  <https://github.com/CodingSpiderFox/ansible-loop-problem>
  
  **Tags:** ansible, yaml, glusterfs
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-04-11. Score: 1
  
  I commited the fix to the Github repo. The problem was that a role was included recursively.
  
  I split up the roles a bit to fix it.
  Also discovered a lot of other issues with repeated task executions (not all of the fixed yet because I'm still learning how to structure my ansible tasks)
  
  
  ---
  
  