ansible/test/integration/targets/xattr/tasks/main.yml
bengerman13 25aac6151f add integration tests for xattr module (#24947)
* add integration tests for xattr module

* fix whitespace
2017-05-23 12:02:56 -07:00

68 lines
No EOL
1.4 KiB
YAML

- name: Setup
include: setup.yml
- name: Set attributes
xattr:
path: "{{ test_file }}"
key: user.foo
value: bar
register: xattr_set_result
- name: Get attributes
xattr:
path: "{{ test_file }}"
register: xattr_get_all_result
- name: Get specific attribute
xattr:
path: "{{ test_file }}"
key: user.foo
register: xattr_get_specific_result
- assert:
that:
- "xattr_set_result.changed"
- "xattr_get_all_result['xattr']['user.foo'] == 'bar'"
- "not xattr_get_all_result.changed"
- "xattr_get_specific_result['xattr']['user.foo'] == 'bar'"
- "not xattr_get_specific_result.changed"
- name: Set attribute again
xattr:
path: "{{ test_file }}"
key: user.foo
value: bar
register: xattr_set_again_result
- assert:
that:
- "not xattr_set_again_result.changed"
- name: Unset attribute
xattr:
path: "{{ test_file }}"
key: user.foo
state: absent
register: xattr_unset_result
- name: get attributes
xattr:
path: "{{ test_file }}"
register: xattr_get_after_unset_result
- assert:
that:
- "xattr_unset_result.changed"
- "xattr_get_after_unset_result['xattr'] == {}"
- "not xattr_get_after_unset_result.changed"
- name: Unset attribute again
xattr:
path: "{{ test_file }}"
key: user.foo
state: absent
register: xattr_unset_result
- assert:
that:
- "not xattr_set_again_result.changed"