Skip to content

Commit

Permalink
Merge pull request #49 from bcgov-nr/feat/checkCustomFiles
Browse files Browse the repository at this point in the history
feat: tomcat options, loop through custom var files
  • Loading branch information
andrwils authored May 6, 2024
2 parents 58d3cb9 + f5dad67 commit 456bb72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
15 changes: 9 additions & 6 deletions generators/pd-ansible-playbook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ export default class extends Generator {
);
// Initialize empty files that can be used for custom variables
// Skip copying templates if any custom files already exist
if (!fs.existsSync(this.destinationPath(`${this.options.playbookPath}/vars/custom`))) {
this.fs.copyTpl(
this.templatePath('vars/custom/**'),
this.destinationPath(`${this.options.playbookPath}/vars/custom`),
{},
);
const varsFiles = fs.readdirSync(this.templatePath('vars/custom'));
for (const file of varsFiles) {
if (!fs.existsSync(this.destinationPath(`${this.options.playbookPath}/vars/custom/${file}`))) {
this.fs.copyTpl(
this.templatePath(`vars/custom/${file}`),
this.destinationPath(`${this.options.playbookPath}/vars/custom/${file}`),
{},
);
}
}

this.config.save();
Expand Down
6 changes: 6 additions & 0 deletions generators/pd-ansible-playbook/templates/vars/custom/all.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Use this file for custom variables related to your webapp
# This is optional. The default is the latest.
# tomcat_major_version: "8"

# This is optional. The default is the latest of the major version.
# If you need to use a particular version of Tomcat, set the version here.
# tomcat_version_number: "8.5.51"
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ alt_app_dir_name: <%= altAppDirName %>
# By default, the Tomcat port is set dynamically by using the port_manager role
# If you need to set a static port, replace the dynamic port assignment value with your static value
tomcat_https_port: "{{ portmanager_assignments[ansible_host] }}"

# If you need to use a particular version of Tomcat, set the version here
tomcat_version_number: "8.5.51"

0 comments on commit 456bb72

Please sign in to comment.