From 3f7ed9a39036f36d84b97f65113f4203e756aca1 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Oct 19 2018 08:01:18 +0000 Subject: Better describe how to use the role and 5 stars. --- diff --git a/.gitignore b/.gitignore index 0af2904..10b26d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ molecule/*/.molecule *.log +*.swp diff --git a/README.md b/README.md index 5ccb856..2f3f3d6 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Example Playbook - role: robertdebock.reboot ``` -You can also include a role in a handler of an existing role. +You can also include a role when something changed. ``` - name: reboot @@ -94,13 +94,41 @@ You can also include a role in a handler of an existing role. - name: do something that requires a reboot. sestatus: state: disabled - notify: - - include reboot role + register do_something - handlers: - name: include reboot role include_role: name: robertdebock.reboot + when: + - do_something.changed +``` + +Normally a `notify` using handlers is perfect for changed tasks, but the module `include_role` [can't be used in a handler](https://github.com/ansible/ansible/issues/35542). + +Linting will suggest to move that `include_role` to a handler. To instruct ansible-lint to ignore this issue, use one of these two methods: + +1. Tag the task +In your `playbook.yml`: +``` + - name: include reboot role + include_role: + name: robertdebock.reboot + when: + - do_something.changed + tags: + - skip_ansible_lint +``` + +2. Let molecule skip a test +In molecule/*/molecule.yml: +``` +provisioner: + name: ansible + lint: + name: ansible-lint + options: + x: + - ANSIBLE0016 ``` To install this role: diff --git a/meta/main.yml b/meta/main.yml index 6c1f4c4..4267442 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -3,7 +3,8 @@ galaxy_info: author: Robert de Bock role_name: reboot description: Reboot a system. - license: Apache License, Version 2.0 + license: Apache-2.0 + company: none min_ansible_version: 2.5 platforms: