mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
8635cd84d4
* feature: module dpkg_divert + tests * try to skip non-deb linux distrib * use collection namespace in EXAMPLES * skip unsupported OS/distrib in tasks instead * tests: remove unskipped distribs * apply changes suggested by Andersson007 * Remove ANSIBLE_METADATA (no more needed). * Normalize docstrings (capitalize descriptions, fix styling, use yes/no booleans). * fix descriptions * update DOCUMENTATION * Drop field 'version_added' (no more needed). * Add a note about check_mode support. * use list comprehension * support diff mode * Move 'before'/'after' dicts into 'diff' dictionary. * Set 'diversion' as the actual state (or the state that would be reached, when in check mode). * Always return 'diversion' on handled exits (exit_json & fail_json). * enable 'diff' mode in tests, add missing 'become'
39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
---
|
|
- name: "set variables for the entire playbook"
|
|
set_fact:
|
|
foobarrc: "{{ foobarrc }}"
|
|
foobarrc_ansible: "{{ foobarrc }}.ansible"
|
|
foobarrc_distrib: "{{ foobarrc }}.distrib"
|
|
foobarrc_oldtext: "# foobar configuration file\n# Please refer to the documentation for details\n"
|
|
foobarrc_oldsha1: "e1c54c36d2fd1b8d67d1826e49b95ac8c0f24c0a"
|
|
foobarrc_newtext: "# Custom foobar configuration file\nFOO=bar\nBAR=foo"
|
|
foobarrc_newsha1: "3fe6c890519fb48e27c1b0e3e37afb11357d5cac"
|
|
vars:
|
|
foobarrc: "/etc/foobarrc"
|
|
|
|
- name: "remove foobarrc diversion"
|
|
dpkg_divert:
|
|
path: "{{ foobarrc }}"
|
|
state: absent
|
|
become: yes
|
|
|
|
- name: "remove test files"
|
|
file:
|
|
path: "{{ dpkg_divert_item }}"
|
|
state: absent
|
|
loop:
|
|
- "{{ foobarrc_ansible }}"
|
|
- "{{ foobarrc_distrib }}"
|
|
loop_control:
|
|
loop_var: dpkg_divert_item
|
|
become: yes
|
|
|
|
|
|
- block:
|
|
- name: "include tasks to perform basic tests (create, remove, update)"
|
|
include_tasks: tests/01-basic.yml
|
|
|
|
- name: "include tasks to perform other tests (rename)"
|
|
include_tasks: tests/02-rename.yml
|
|
become: yes
|
|
diff: yes
|