Created
April 7, 2016 12:24
-
-
Save paulchubatyy/63777a32d65e822d2afda6be6a86e58c to your computer and use it in GitHub Desktop.
How to generate Symfony's parameters.yml file with Ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit b73610f0e704700d75127e0f22da4038b1f47d20 | |
Author: Paul Chubatyy <[email protected]> | |
Date: Thu Mar 24 22:48:54 2016 +0200 | |
Add composer script to generate params from ansible | |
instead of parameters.yml.dist | |
diff --git a/composer.json b/composer.json | |
index 092503d..80582eb 100644 | |
--- a/composer.json | |
+++ b/composer.json | |
@@ -71,7 +71,7 @@ | |
"SymfonyStandard\\Composer::hookRootPackageInstall" | |
], | |
"post-install-cmd": [ | |
- "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", | |
+ "sh ansible/parameterhandler.sh", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", | |
@@ -81,7 +81,7 @@ | |
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap" | |
], | |
"post-update-cmd": [ | |
- "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", | |
+ "sh ansible/parameterhandler.sh", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", | |
@@ -89,7 +89,8 @@ | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", | |
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget", | |
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap" | |
- ] | |
+ ], | |
+ "makeparams": "sh ansible/parameterhandler.sh" | |
}, | |
"config": { | |
"bin-dir": "bin", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ ! -z "$SKIP_PARAM_GENERATION" ]; then | |
echo "Skipping parameters.yml generation because of environment variable SKIP_PARAM_GENERATION" | |
exit | |
fi | |
inventory=${SYMFONY_BUILD_ENV:-localhost} | |
# check if ansible exists | |
if hash ansible-playbook 2>/dev/null; then | |
echo "Generating parameters.yml for ${inventory}" | |
# run ansible playbook to generate parameters.yml | |
(cd ansible && ansible-playbook -i inventories/${inventory} params.yml --connection local) | |
else | |
echo "Please install Ansible before running me" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: jenkins | |
connection: local | |
tasks: | |
- name: Generate parameters.yml in local installation | |
template: | |
src: parameters.yml | |
dest: ../app/config/parameters.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment