---
- debug: msg "Foo is " {{ foo }}
when: foo is defined
- debug: msg "Foo is " {{ foo }} when: php_packages is defined
- name: Install generic php
yum: name={{ item }} enablerepo=epel state=present
with_items:
- php
when: php_packages is not defined
- name: Install php and packages from php_packages
yum: name={{ item }} enablerepo=epel state=present
with_items: [ '{{ php_packages }}' ]
when: php_packages is definedPLAY [configure and deploy the webservers and application code] ****************
TASK [setup] *******************************************************************ok: [localhost]
TASK [test : debug] ************************************************************skipping: [localhost]
TASK [test : debug] ************************************************************skipping: [localhost]
TASK [test : Install generic php] **********************************************ok: [localhost] => (item=[u'php'])
TASK [test : Install php and packages from php_packages] ***********************fatal: [localhost]: FAILED! => {"failed": true, "msg": "ERROR! 'php_packages' is undefined"}
PLAY RECAP *********************************************************************localhost : ok=2 changed=0 unreachable=0 failed=1--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6aaa9fb5-dfa7-40f9-bbd5-5262e25152ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[vagrant@ansibleserver provisioning]$ ansible --version
ansible 1.9.4
configured module search path = /usr/share/ansible
[vagrant@ansibleserver provisioning]$ ansible-playbook -i host test.yml
PLAY [configure and deploy the webservers and application code] ***************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [test | debug msg "Foo is " {{ foo }}] **********************************
skipping: [localhost]
TASK: [test | debug msg "Foo is " {{ foo }}] **********************************
skipping: [localhost]
TASK: [test | Install generic php] ********************************************
changed: [localhost] => (item=php)
TASK: [test | Install php and packages from php_packages] *********************
skipping: [localhost]
PLAY RECAP ********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0