This repository contains a custom Ansible module for interacting with the osctl
API. The module supports various operations like retrieving system information, managing services, and more.
- Ensure the
osctl
API server is running and accessible. - Ensure you have the
requests
library installed in the Python environment that Ansible uses.
Clone this repository:
git clone https://github.com/yourusername/osctl-ansible-module.git
cd osctl-ansible-module
Update ansible.cfg
to include the custom module library path:
[defaults]
library = ./library
An example playbook is provided in the playbooks
directory. Here is how to run it:
ansible-playbook -i localhost, playbooks/osctl_playbook.yml
endpoint
: The API endpoint to call (e.g.,ram
,disk
,service
, etc.).host
: The host where theosctl
API server is running.port
: The port on which theosctl
API server is running.username
: The username for basic authentication.password
: The password for basic authentication.params
: Additional parameters for the API call (used for specific endpoints likeservice
).
- name: Get RAM usage
osctl_module:
endpoint: "ram"
host: "localhost"
port: 12000
username: "admin"
password: "password"
register: result
- name: Display RAM usage
debug:
msg: "{{ result.original_message }}"
This project is licensed under the MIT License - see the LICENSE file for details.