Chapters
30 Chapters
|
2:45:48
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.5.9
Subscribe to download the code!Compatible PHP versions: >=5.5.9
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
23.
Organizing with include
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This tutorial is built using an older version of Symfony, but the core concepts of Ansible are still valid. New versions of Ansible may contain some features that we don't use here.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.1.*", // v3.1.4
"doctrine/orm": "^2.5", // v2.7.2
"doctrine/doctrine-bundle": "^1.6", // 1.6.4
"doctrine/doctrine-cache-bundle": "^1.2", // 1.3.0
"symfony/swiftmailer-bundle": "^2.3", // v2.3.11
"symfony/monolog-bundle": "^2.8", // 2.11.1
"symfony/polyfill-apcu": "^1.0", // v1.2.0
"sensio/distribution-bundle": "^5.0", // v5.0.12
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.16
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"doctrine/doctrine-migrations-bundle": "^1.2", // v1.2.0
"snc/redis-bundle": "^2.0", // 2.0.0
"predis/predis": "^1.1", // v1.1.1
"composer/package-versions-deprecated": "^1.11" // 1.11.99
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.0.8
"symfony/phpunit-bridge": "^3.0", // v3.1.4
"doctrine/data-fixtures": "^1.1", // 1.3.3
"hautelook/alice-bundle": "^1.3" // v1.4.1
}
}
10 Comments
For those coming here from the future ;)
Make sure to pass the variable code_changed to the include file, otherwise you will get code_changed undefined errors.
# Bootstrap Symfony app
- include: ./includes/symfony-bootstrap.yml code_changed=code_changed
Hey Norman
Thanks for sharing this with others! Btw, what Ansible version do you use so that you can't access code_changed variable inside of included task?
Cheers!
Hey Victor,
Ansible version: 2.7.5.
I copied the code from the course code final folder actually. I only adjusted my paths and removed the AWS stuff.
Hey Norman,
Hm, it's weird. I just double checked and it works well for me, so I don't need to pass that extra "code_changed=code_changed". Hm, probably you mistype something, or you don't have this "set_fact" task before:
I also have the latest Ansible 2.7.5, so, I don't think we should tweak anything in this tutorial's code.
Anyway, I'm glad you found the correct solution for you.
Cheers!
Thanks for checking!
Seems like I messed up somewhere. Will check and get back to you if I find it :)
Hey Norman,
No problem, I'm glad it works for you. But I would be happy about your feedback ;)
Cheers!
Just a heads up: I'm getting "includes" deprecated notice, change to "import_tasks"
Hey gstanto ,
Thanks for letting us know! Yeah, "includes" is deprecated and will be removed in 2.8. Anyway, time to add a note about it.
Cheers!
include_tasks didn't play tasks with "-t deploy" tags (on ansible 2.5.1). In my case import_task did the job done.
Hey toporovvv ,
Ah, good point! It's probably exactly that subtle difference between include_tasks and import_tasks. And probably we need to use import_tasks in this screencast because we do want to filter by tags here. Thanks for letting us know, I'll tweak the note in order to suggest import_tasks instead.
Cheers!
"Houston: no signs of life"
Start the conversation!