cevich.touchstone
Touchstone
This is an Ansible Galaxy enabled role that helps ensure that sets of plays, roles, or tasks can be run multiple times without causing problems. This is important for tasks that happen in a specific order. For example, if one role creates partitions and another formats them, running that order again could erase your data.
Requirements
You need the standard Ansible version 2.3+
.
Role Variables
touch_touchstone
:- When set to true, it marks the completion status identified by
stone_name
.
- When set to true, it marks the completion status identified by
stone_name
:- An optional string to identify different completion states, useful if you are tracking multiple playbooks. It defaults to
.touchstone
.
- An optional string to identify different completion states, useful if you are tracking multiple playbooks. It defaults to
touchstone_filepath
:- An optional path where the touchstone will be checked or written. This must be a permanent, writable location for
ansible_user
(not something temporary like/tmp
). A lock file will be created here to monitor the touchstone's status.
- An optional path where the touchstone will be checked or written. This must be a permanent, writable location for
stone_touched
:- A boolean value that indicates whether the touchstone has been used at least once.
touchstone_template
:- An optional full path to a jinja2 template that generates the content of the touchstone file.
Dependencies
This role requires a systemd-based machine with a unique /etc/machine-id
.
Example Playbook
- hosts: all
roles:
- role: cevich.touchstone
- role: something
when: not stone_touched
- role: another_thing
when: not stone_touched
- role: final_thing
when: not stone_touched
- role: cevich.touchstone
touch_touchstone: True
License
This role helps ensure that sets of plays, roles, or tasks can be run multiple times without issues. Copyright (C) 2017 Christopher C. Evich
This software is free to use and modify under the GNU General Public License, version 3 or later.
This program is provided with no guarantees, including any implied warranty of quality or suitability for a specific purpose. Refer to the GNU General Public License for more details.
You should have received a copy of this license with the program. If not, visit https://www.gnu.org/licenses/.
Author Information
Troubling and playing with Linux since Windows 98.
Continuous Integration
Easily make sets of plays, roles or tasks idempotent.
ansible-galaxy install cevich.touchstone