trfore.jsvc
Ansible Role: jsvc
This role compiles jsvc
, part of Apache Commons Daemon, on RedHat/CentOS and Debian/Ubuntu operating systems.
It downloads and compiles the latest version from Apache Commons and copies the binary to /usr/bin/
. You can also choose to delete the JDK and source code folder after the process.
If you want to manually download the source code to your Ansible control host, get the native-src file, commons-daemon-*.*.*-native-src.tar.gz
, and place it in your files
directory. Then, set these two variables in your playbook:
jsvc_tar_src: commons-daemon-*.*.*-native-src.tar.gz
jsvc_tar_src_remote: false
How to Install the Role
You can install this role using the Ansible Galaxy command line tool:
ansible-galaxy role install trfore.jsvc
Alternatively, you can add it to a requirements.yml
file and install it by running ansible-galaxy install -r requirements.yml
. The format should be:
---
roles:
- trfore.jsvc
Supported Platforms
ansible-core
versions 2.15, 2.16, and 2.17- CentOS Stream versions 8 and 9
- Note: CentOS 8 uses Python 3.6, which is not supported in ansible-core 2.17
- Debian versions 10 and 11
- Ubuntu versions 20.04, 22.04, and 24.04
Requirements
None
Role Variables
Here are the variables you can use, along with their default values (see defaults/main.yml
):
Variable | Default | Description | Required |
---|---|---|---|
jsvc_src_version | 1.4.0 |
Latest version of Apache Commons' Daemon | No |
jsvc_tar_src | URL | Source tar file for Apache Commons' Daemon, either a URL or a relative path | No |
jsvc_tar_src_remote | true |
Set to true if downloading from a URL |
No |
jsvc_tar_dir | /var/tmp |
Temporary directory for extracting and compiling the source code | No |
jsvc_tar_folder | Automatic | Determined from the jsvc_tar_src variable |
Automatic |
jsvc_build_dependencies | ["autoconf", "make", "gcc"] |
Packages needed for compiling the source code | No |
jsvc_remove_jdk | false |
Set to true to uninstall the Java JDK after build |
No |
jsvc_remove_tar_folder | false |
Set to true to remove the source code temporary directory |
No |
OS-specific variables are:
Variable | Default | Description | Required |
---|---|---|---|
jsvc_build_jdk | openjdk-11-jdk-headless |
Java JDK (Debian) | No |
jsvc_build_jdk | java-11-openjdk-devel.x86_64 |
Java JDK (RHEL) | No |
Dependencies
None
Example Playbook
- hosts: servers
become: true
roles:
- name: Compile jsvc binary
role: trfore.jsvc
- If you have downloaded the tar file manually and wish to remove the JDK and source directory:
- hosts: servers
become: true
vars:
jsvc_tar_src: commons-daemon-1.4.0-native-src.tar.gz
jsvc_tar_src_remote: false
jsvc_remove_jdk: true
jsvc_remove_tar_folder: true
roles:
- name: Compile jsvc binary
role: trfore.jsvc
License
MIT
Author
Taylor Fore (https://github.com/trfore)
Related Roles & Playbooks
Github | Ansible Galaxy |
---|---|
ansible-role-jsvc | trfore.jsvc |
ansible-role-mongodb-install | trfore.mongodb_install |
ansible-role-omada-install | trfore.omada_install |
References
Apache Commons Daemon / jsvc
Compile the Apache Commons Daemon, aka jsvc, binary on RedHat/CentOS and Debian/Ubuntu.
ansible-galaxy install trfore.jsvc