Skip to content

Commit

Permalink
Ansible 2.8 compatibility (#6)
Browse files Browse the repository at this point in the history
* Register result variable for copy task

* Introduce conga_files_changed result fact

* Ignore ansible-lint "[503] Tasks that run when changed should likely be handlers".

* Fix travis, use configured ansible-lint version
  • Loading branch information
Tobias Richter authored Dec 11, 2020
1 parent 0f00f10 commit 1d0b392
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ addons:

install:
# Install ansible and dependencies
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible ansible-lint --upgrade; else pip install ansible=="$ANSIBLE_VERSION" ansible-lint=="3.5.1" --upgrade; fi
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible ansible-lint --upgrade; else pip install ansible=="$ANSIBLE_VERSION" ansible-lint=="$ANSIBLE_LINT_VERSION" --upgrade; fi

# Check ansible version
- ansible --version
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ Optional regular expressions used to modify or filter the list of files to be co
The `conga_files_strip` expression is removed from the files on the target host. This is useful if files were generated with an additional path components for organization (e.g. `apache`).
The `conga_files_filter` expression is used to filter the list of files to be copied. Only files matching the expression are processed. This is useful if you don't want to copy all files at once or exclude some altogether.

## Result facts

conga_files_changed

This fact has the value `true` when the deployment of the conga file(s)
resulted in a change.

## Dependencies

This role depends on the [wcm_io_devops.conga_facts](https://github.com/wcm-io-devops/ansible-conga-facts) role for supplying the list of files and directories to copy.
Expand Down
9 changes: 8 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# ensures that all conga directories exist and copies over all files that CONGA
# has generated for that combination.

- name: Setup files and directories lists.
- name: Setup files, directories lists and result fact.
set_fact:
_conga_directories: "{{ conga_files_directories }}"
_conga_files: "{{ conga_files_files }}"
conga_files_changed: false

- name: Map list of files to their paths.
set_fact:
Expand Down Expand Up @@ -34,4 +35,10 @@
group: "{{ conga_files_group | default(omit) }}"
mode: "{{ conga_files_mode | default(omit) }}"
with_items: "{{ _conga_files }}"
register: _conga_files_result
notify: "{{ conga_files_handlers | default(omit) }}"

- name: "Set 'conga_files_changed' to true when changed." # noqa 503
set_fact:
conga_files_changed: true
when: _conga_files_result.changed

0 comments on commit 1d0b392

Please sign in to comment.