Skip to content

Commit

Permalink
Add conga_maven_vault_password_file configuration variable with sensi…
Browse files Browse the repository at this point in the history
…ble default (#7)

* Add a conga_maven_vault_password_file variable which defaults to the file configured for Ansible itself. This allows using the various Ansible configuration facilities for setting the password file (e.g. ansible.cfg) instead of being forced to set the ANSIBLE_VAULT_PASSWORD_FILE environment variable.
* Only include extra Maven command line arguments if they have a non-empty value to allow omitting them by setting them to empty.
* Bump the required Ansible version to 2.5 due to config lookup plugin usage
  • Loading branch information
interatom authored Jul 4, 2019
1 parent d743ba1 commit b443975
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
# run against latest version
- ANSIBLE_VERSION=latest
# run against minimal required version
- ANSIBLE_VERSION=2.0.*
- ANSIBLE_VERSION=2.5.*

# Use the new container infrastructure
sudo: false
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ If you want to use a Git configuration repository, you need to at least set the
conga_maven_opts: "-B -U -Dconga.environments={{ conga_environment }}"
# Path of a custom settings file to use when running Maven
conga_maven_settings: ~/.m2/settings.xml
# Path to the Vault password file, defaults to Ansible configuration
conga_maven_vault_password_file: "{{ lookup('config', 'DEFAULT_VAULT_PASSWORD_FILE') }}"

These variables let you customize the way Maven is executed, e.g. supplying a full path for the Maven executable or supplying a custom settings file.

Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
conga_maven_root: configuration
# Maven command to execute
conga_maven_cmd: mvn
# Path to the Vault password file, defaults to Ansible configuration
conga_maven_vault_password_file: "{{ lookup('config', 'DEFAULT_VAULT_PASSWORD_FILE') }}"
# Maven options (run in batch mode, update snapshots and only compile a single environment)
conga_maven_opts: "-B -U -Dconga.environments={{ conga_environment }}"
# Path of a custom settings file to use when running Maven
Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ galaxy_info:
company: pro!vision
issue_tracker_url: https://wcm-io.atlassian.net
license: Apache
min_ansible_version: 2.0
min_ansible_version: 2.5

platforms:
- name: Ubuntu
Expand Down
7 changes: 6 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
- name: Add custom Maven settings.
set_fact:
_mvn_cmdline: "{{ _mvn_cmdline }} --settings={{ conga_maven_settings }}"
when: conga_maven_settings is defined
when: conga_maven_settings is defined and conga_maven_settings

- name: Add Maven Vault password file.
set_fact:
_mvn_cmdline: "{{ _mvn_cmdline }} -Dansible.vault.password.file={{ conga_maven_vault_password_file }}"
when: conga_maven_vault_password_file is defined and conga_maven_vault_password_file

- name: Compile CONGA configuration with Maven.
shell: "{{ _mvn_cmdline }}"
Expand Down

0 comments on commit b443975

Please sign in to comment.