1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-07-02 00:28:52 +00:00

win_optional_feature - support multiple feature in name (#54368)

This commit is contained in:
Jordan Borean 2019-03-28 05:26:20 +10:00 committed by GitHub
parent 9e6b6385e8
commit 9e93a84429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 135 additions and 38 deletions

View file

@ -21,5 +21,20 @@
register: run_tests
- name: run tests
include_tasks: tests.yml
when: run_tests.stdout | trim | bool
block:
- name: ensure we start test with removed features
win_optional_feature:
name:
- SimpleTCP
- TelnetClient
state: absent
- include_tasks: tests.yml
always:
- name: make sure test features have been removed after test
win_optional_feature:
name:
- SimpleTCP
- TelnetClient
state: absent

View file

@ -16,6 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: fail with invalid feature name
win_optional_feature:
name:
- TelnetClient
- FakeFeature
state: present
register: invalid_name
failed_when: invalid_name.msg != "Failed to find feature 'FakeFeature'"
- name: run with check_mode
win_optional_feature:
name: TelnetClient
@ -36,7 +45,7 @@
include_parent: true
register: real_feature_check
- name: assert feature installed
- name: assert feature installed
assert:
that:
- real_feature_check.changed
@ -53,6 +62,34 @@
that:
- not real_feature_check.changed
- name: install feature with list
win_optional_feature:
name:
- SimpleTCP
- TelnetClient
state: present
include_parent: true
register: install_list
- name: assert install feature with list
assert:
that:
- install_list is changed
- name: install feature with list (idempotent)
win_optional_feature:
name:
- SimpleTCP
- TelnetClient
state: present
include_parent: true
register: install_list_again
- name: assert install feature with list (idempotent)
assert:
that:
- not install_list_again is changed
- name: removal run with check_mode
win_optional_feature:
name: TelnetClient
@ -76,7 +113,7 @@
that:
- real_feature_check.changed
- name: test idempotence for removal
- name: test idempotence for removal
win_optional_feature:
name: TelnetClient
state: absent
@ -86,3 +123,29 @@
assert:
that:
- not real_feature_check.changed
- name: remove feature with list
win_optional_feature:
name:
- SimpleTCP
- TelnetClient
state: absent
register: remove_feature_list
- name: assert remove feature with list
assert:
that:
- remove_feature_list is changed
- name: remove feature with list (idempotent)
win_optional_feature:
name:
- SimpleTCP
- TelnetClient
state: absent
register: remove_feature_list_again
- name: assert remove feature with list (idempotent)
assert:
that:
- not remove_feature_list_again is changed