This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from oVirt/makefile_additions
Support log for ansible-disaster-recovery + additional fixes
- Loading branch information
Showing
11 changed files
with
484 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Make coding more python3-ish, this is required for contributions to Ansible | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
# not only visible to ansible-doc, it also 'declares' the options the plugin requires and how to configure them. | ||
DOCUMENTATION = ''' | ||
callback: stdout | ||
callback_type: aggregate | ||
short_description: Output the log of ansible | ||
version_added: "2.0" | ||
description: | ||
- This callback output the log of ansible play tasks. | ||
''' | ||
from datetime import datetime | ||
|
||
from ansible.plugins.callback import CallbackBase | ||
|
||
|
||
class CallbackModule(CallbackBase): | ||
""" | ||
This callback module output the inforamtion with a specific style. | ||
""" | ||
CALLBACK_VERSION = 2.0 | ||
CALLBACK_TYPE = 'aggregate' | ||
CALLBACK_NAME = 'stdout' | ||
|
||
# only needed if you ship it and don't want to enable by default | ||
CALLBACK_NEEDS_WHITELIST = False | ||
|
||
def __init__(self): | ||
|
||
# make sure the expected objects are present, calling the base's __init__ | ||
super(CallbackModule, self).__init__() | ||
|
||
def runner_on_failed(self, host, res, ignore_errors=False): | ||
self._display.display('FAILED: %s %s' % (host, res)) | ||
|
||
def runner_on_ok(self, host, res): | ||
self._display.display('OK: %s %s' % (host, res)) | ||
|
||
def runner_on_skipped(self, host, item=None): | ||
self._display.display('SKIPPED: %s' % host) | ||
|
||
def runner_on_unreachable(self, host, res): | ||
self._display.display('UNREACHABLE: %s %s' % (host, res)) | ||
|
||
def runner_on_async_failed(self, host, res, jid): | ||
self._display.display('ASYNC_FAILED: %s %s %s' % (host, res, jid)) | ||
|
||
def playbook_on_import_for_host(self, host, imported_file): | ||
self._display.display('IMPORTED: %s %s' % (host, imported_file)) | ||
|
||
def playbook_on_not_import_for_host(self, host, missing_file): | ||
self._display.display('NOTIMPORTED: %s %s' % (host, missing_file)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
[log] | ||
log_file=/tmp/ovirt-dr-{}.log | ||
log_level=DEBUG | ||
|
||
[generate_vars] | ||
site=http://engine.example.com/ovirt-engine/api | ||
username=admin@internal | ||
password= | ||
ca_file=/etc/pki/ovirt-engine/ca.pem | ||
output_file=/var/lib/ovirt-ansible-disaster-recovery/mapping_vars.yml | ||
ansible_play=../examples/dr_play.yml | ||
ansible_play=/usr/share/doc/ovirt-ansible-disaster-recovery/examples/dr_play.yml | ||
|
||
[validate_vars] | ||
var_file=/var/lib/ovirt-ansible-disaster-recovery/mapping_vars.yml | ||
vault=../examples/ovirt_passwords.yml | ||
vault=/usr/share/doc/ovirt-ansible-disaster-recovery/examples/ovirt_passwords.yml | ||
|
||
[failover_failback] | ||
dr_target_host=secondary | ||
dr_source_map=primary | ||
vault=passwords.yml | ||
vault=/usr/share/doc/ovirt-ansible-disaster-recovery/examples/ovirt_passwords.yml | ||
var_file=/var/lib/ovirt-ansible-disaster-recovery/mapping_vars.yml | ||
ansible_play=../examples/dr_play.yml | ||
ansible_play=/usr/share/doc/ovirt-ansible-disaster-recovery/examples/dr_play.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.