Closed BelenValdivia closed 1 year ago
This PR aims to add HostManager methods.
Methods:
install_package()
uninstall_package()
append_block_in_file()
Python console
>>> hm.install_package('agent1', 'nmap-ncat', become=True) {'ansible_facts': {'discovered_interpreter_python': '/usr/libexec/platform-python'}, 'changed': True, 'msg': '', 'rc': 0, 'results': ['Installed: nmap-ncat-2:7.70-6.el8.x86_64']}
hm.install_package('windows1', '7zip') {'changed': True, 'rc': 0}
- uninstall_package():
hm.uninstall_package('agent1', 'nmap-ncat', become=True) {'ansible_facts': {'discovered_interpreter_python': '/usr/libexec/platform-python'}, 'changed': True, 'msg': '', 'rc': 0, 'results': ['Removed: nmap-ncat-2:7.70-6.el8.x86_64']}
>> hm.uninstall_package('windows1', '7zip') {'changed': True, 'rc': 0}
>>> hm.append_block_in_file('agent1', '/tmp/config', '<configuration>', become=True) {'ansible_facts': {'discovered_interpreter_python': '/usr/libexec/platform-python'}, 'changed': True, 'msg': 'Block inserted'}
>>> hm.append_block_in_file('windows1', 'C:/test/test_ansible.txt', 'new content', windows=True) {'changed': True, 'checksum': 'a9936d8ec5869c5dae4c6571f2deed9f0955799c'}
manager_package():
manager_package()
append_block_in_file():
Description
This PR aims to add HostManager methods.
Added
Methods:
install_package()
: Install packages.uninstall_package()
: Uninstall packages.append_block_in_file()
: Insert a block of text at the end of a file., it will be useful to set local rules, configurations in ossec.conf and local decoder.Testing performed
Python console