Commit 82cae226 authored by Visay Keo's avatar Visay Keo

[FEATURE] Allow setting of php path on remote

parent ab7d42b6
CHANGELOG
=========
3.0-dev
---------
3.0.1
-----
- [FEATURE] Allow setting of php path on remote
- [BUGFIX] Use eval to execute shell from string
- [IMP] Group ansible params into variable
......
......@@ -52,6 +52,7 @@ bin/syncontent -u=demo-014-007 -h=10.10.10.37 -p=/home/user/neosbox
- `-h` | `--remote-host` : Set the hostname or IP address of the remote server (__Default__: `10.10.10.27`)
- `-p` | `--remote-path` : Set path to the document root on the remote server (__Default__: `/home/<remote-user>/public_html`)
- `-t` | `--ansible-tags`: Set the specific task you want run. See available sysc tasks section for details
- `--remote-php` : Set the path to php on the remote server
- `-v` : Set the verbosity of ansible output. You can also set more verbose by adding more `v` like `-vvvvv`
- `--dry-run` : Force to display the command to execute but won't run them. Useful for debugging when you want
to see the full ansible command and maybe execute them directly for better error hints
......@@ -75,11 +76,12 @@ Packages
└── README.md
```
You can also overwrite the default value of `--remote-host` and `--remote-path` by setting it in the created master file.
You can also overwrite the default value of `--remote-host`, `--remote-path` and `--remote-php` by setting it in the created master file.
```Packages/Libraries/visay/syncontent/config/master/demo-014-007
--remote-host=10.10.10.37
--remote-path=/home/user/neosbox
--remote-php=/opt/php-versions/php55/bin/php
```
With this file and its content, you can now execute the content sync with just:
......
......@@ -2,7 +2,7 @@
# tasks file for database
- name: Read remote database info (FLOW_CONTEXT=Production)
shell: FLOW_CONTEXT=Production ./flow configuration:show --type Settings --path TYPO3.Flow.persistence.backendOptions chdir="{{ remote_path }}"
shell: FLOW_CONTEXT=Production {{ remote_php | default('') }} ./flow configuration:show --type Settings --path TYPO3.Flow.persistence.backendOptions chdir="{{ remote_path }}"
register: db_info
- name: Get remote database host
......
......@@ -33,6 +33,10 @@ do
ANSIBLE_TAGS="--tags=${ARGS#*=}"
shift
;;
--remote-php=*)
REMOTE_PHP="${ARGS#*=}"
shift
;;
-v*)
VERBOSE_LEVEL="${ARGS}"
shift
......@@ -124,6 +128,23 @@ if [ -z "${REMOTE_PATH}" ]; then
fi
fi
# If remote php is not set in argument, check for it in the configuration file
if [ -z "${REMOTE_PHP}" ]; then
if [ -f "${MASTER_FILE}" ]; then
IFS=$'\n'
for LINE in `cat ${MASTER_FILE}`
do
LINE=${LINE//[[:blank:]]/}
case ${LINE} in
--remote-php=*)
REMOTE_PHP="${LINE#*=}"
shift
;;
esac
done
fi
fi
# If remote path is not defined anywhere, set a standard value
if [ -z "${REMOTE_PATH}" ]; then
REMOTE_PATH="/home/${REMOTE_USER}/public_html"
......@@ -152,6 +173,9 @@ fi
# Prepare all parameters for ansible extra vars
ANSIBLE_EXTRA_VARS="stage=${STAGE} ssh_user=${REMOTE_USER} local_path=${ROOT_DIR} remote_path=${REMOTE_PATH} local_flow_context=${FLOW_CONTEXT}"
if [ -n "${REMOTE_PHP}" ]; then
ANSIBLE_EXTRA_VARS="${ANSIBLE_EXTRA_VARS} remote_php=${REMOTE_PHP}"
fi
echo -e ${GREEN}"ENVIRONMENT SUMMARY:"${NC}
echo "====================="
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment