Simple tasks, where I want the "Remote git configuration" task to only be 
run when  apache2_configuration == 'git'

- debug:
    msg: "DEBUG: {{ apache2_configuration }}"
  tags: apache2-servers

- name: Remote git configuration
  import_tasks: remote-git.yml
  when: apache2_configuration == 'git'
  tags: apache2-servers

Running ansible, apache2_configuration is "role" but for some reason the 
import_tasks: remote-git-yml is being imported?

TASK [apache2-servers : debug] 
*************************************************
ok: [www.aws.comap.com] => {
    "msg": "DEBUG: role"
}

TASK [apache2-servers : XXXXXXXXX inside remote-git.yml] 
***********************

Trying with include: 

- debug:
    msg: "DEBUG: {{ apache2_configuration }}"
  tags: apache2-servers

- name: Remote git configuration
  include: remote-git.yml
  when: apache2_configuration == "git"
  tags: apache2-servers

TASK [apache2-servers : debug] 
*************************************************
ok: [www.aws.comap.com] => {
    "msg": "DEBUG: role"
}

TASK [apache2-servers : XXXXXXXXX inside remote-git.yml] 
***********************

I do not understand why import_tasks: or include: is importing/including 
remote-git.yml when apache2_configuration is not equal to git.

Any help?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/38b657c1-2383-443d-b9e6-e6a62993cec0%40googlegroups.com.

Reply via email to