Allow mysql_config_include_files to contain raw content #551
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In some cases, specifying a known src path in
mysql_config_include_files
is not possible / complicated and it may be much cleaner to provide raw file content to be sent. In that case, we need to use theansible.builtin.copy
module. We can extend the current implementation by simply filtering on whethersrc
orcontent
is set in each item inmysql_config_include_files
This PR also adds a label definition to the loop, that becomes necessary to avoid printing entire files with the default loop label
Example
For example if you want to use
mysql_config_include_files
with a file stored inside another role (because that's where it's the most practical place to store it currently), you need to:Instead, for very simple configuration snippets it's cleaner to store them in the inventory / group_vars, and this PR then allows you to do that: