In Your example, apache.yml is tasklist, but not playbook
In depends on desired architecture, You can do one of:
1. Convert apache.yml to role. Then define tasks in roles/apache/tasks/mail.yml and variables in roles/apache/defaults/mail.yml (vars in defaults can be overriden when role applied)
play.yml :
---
- hosts: localhost
connection: local
sudo: false
roles:
- apache
roles/apache/defaults/main.yml :
---
url: czxcxz
roles/apache/tasks/main.yml :
---
- name: Download apache
shell: wget {{url}}
2. Set vars in play.yml playbook
play.yml :
---
- hosts: localhost
connection: local
sudo: false
vars:
url: czxcxz
tasks:
- include: apache.yml
apache.yml :
- name: Download apache
shell: wget {{url}}
3. Make apache.yml complete playbook and import it in play.yml as playbook
play.yml :
---
- name: Configure Apache
import_playbook: apache.yml
apache.yml :
---
- name: Configure Apache
hosts: localhost
connection: local
sudo: false
vars:
url: czxcxz
tasks:
- name: Download apache
shell: wget {{url}}
4. Import variables from separate file
play.yml :
---
- hosts: localhost
tasks:
- include: apache.yml
apache.yml :
---
- name: Import apache vars
# Static import var-file with single var look ugly
include_vars: apache-vars.yml
- name: Download apache
shell: wget {{ url }}
apache-vars.yml :
---
url: http://example.com/apache
5. Consider put variables to host_var or group_var
host_vars/localhost.yml :
or
host_vars/localhost/apache.yml :
---
url: http://example.com/apache