Ansible code shared with the public. Includes playbooks for setting up macOS hosts, installing deviceConnect on macOS hosts, and installing gigacap on Ubuntu hosts.
- Ansible (with
ansible-playbookavailable on your PATH) - sshpass — the inventory is configured for password-based SSH authentication, which requires
sshpasson the Ansible controller - SSH access to all target hosts
become(sudo) privileges on each target host — the inventory configuresansible_become_passwordto use the same password as SSH- The deviceConnect
.pkgor gigacap.debinstaller file downloaded locally
For development:
- ansible-lint (
pip install ansible-lint)
Get the playbooks onto your Ansible controller by either cloning the repository:
git clone https://github.com/kobiton/public-ansible.git
cd public-ansibleOr by downloading and extracting a ZIP of the repository using the Code > Download ZIP button on GitHub.
.
├── .github/workflows/ci.yml # CI: runs lint on PRs and pushes to main
├── install-deviceconnect.yml # Playbook: install deviceConnect on macOS
├── install-gigacap.yml # Playbook: install gigacap on Ubuntu hosts
├── inventory.yml.example # Example inventory (copy to inventory.yml)
├── Makefile # Lint target
└── setup-mac.yml # Playbook: set up macOS hosts (Corretto)
The playbooks expect an inventory file at inventory.yml with two host groups: mac (macOS hosts) and gem (Ubuntu hosts). This file is gitignored since it contains environment-specific values. An example is provided to get you started.
-
Copy the example inventory:
cp inventory.yml.example inventory.yml
Or create your own
inventory.ymlfrom scratch — just ensure it definesmacandgemgroups. -
Open
inventory.ymlin your editor. The file has the following structure:all: children: mac: hosts: standalone-mac-01: ansible_host: 10.0.1.10 standalone-mac-02: ansible_host: 10.0.1.11 vars: ansible_user: your-mac-username # Provided by your Kobiton contact ansible_password: "{{ mac_password }}" ansible_become_password: "{{ mac_password }}" gem: hosts: standalone-gem-01: ansible_host: 10.0.2.10 standalone-gem-02: ansible_host: 10.0.2.11 vars: ansible_user: your-gem-username # Provided by your Kobiton contact ansible_password: "{{ gem_password }}" ansible_become_password: "{{ gem_password }}"
-
Update the hosts under each group to match your environment. For each host, set
ansible_hostto its IP address or hostname. Add or remove host entries as needed. -
If needed, update the
ansible_userunder each group'svarssection to match the SSH user for that group. -
The SSH passwords are referenced as variables (
mac_passwordandgem_password). Supply them at runtime using one of:-
Ansible Vault (recommended) — create an encrypted vars file:
mkdir -p group_vars/all ansible-vault create group_vars/all/vault.yml
Add the passwords inside:
mac_password: "your-mac-password" gem_password: "your-gem-password"
Then pass
--ask-vault-passwhen running playbooks. -
Command-line variables — pass them directly with
-e:-e mac_password="your-mac-password"
-
The setup-mac.yml playbook sets up macOS hosts in the mac group. Currently it installs Amazon Corretto (JDK). It compares the version from the package filename against the currently installed version and skips hosts that are already up to date. It also validates that the package architecture (aarch64 or x64) matches the target host.
Package filename format: amazon-corretto-<version>-macosx-<arch>.pkg (e.g., amazon-corretto-21.0.10.7.1-macosx-aarch64.pkg)
-
Place the Corretto
.pkgfile on your local machine (the Ansible controller). -
Run the playbook, passing the path to the
.pkgfile.Using Ansible Vault:
ansible-playbook setup-mac.yml \ -i inventory.yml \ -e corretto_pkg=/path/to/amazon-corretto-21.0.10.7.1-macosx-aarch64.pkg \ --ask-vault-pass
Using command-line variables:
ansible-playbook setup-mac.yml \ -i inventory.yml \ -e corretto_pkg=/path/to/amazon-corretto-21.0.10.7.1-macosx-aarch64.pkg \ -e mac_password="your-password" -
Review the output. For each host, the playbook will print a version comparison showing whether it will install or skip.
The install-deviceconnect.yml playbook installs a deviceConnect .pkg on all hosts in the mac group. It compares the version from the package filename against the currently installed version and skips hosts that are already up to date.
Package filename format: deviceConnect.<version>.pkg — the <version> portion must exactly match the output of dc-services --version (e.g., 4.23.0.202501010000.production@abc1234def).
-
Place the deviceConnect
.pkgfile on your local machine (the Ansible controller). -
Run the playbook, passing the path to the
.pkgfile.Using Ansible Vault:
ansible-playbook install-deviceconnect.yml \ -i inventory.yml \ -e pkg_file=/path/to/deviceConnect.<version>.pkg \ --ask-vault-pass
Using command-line variables:
ansible-playbook install-deviceconnect.yml \ -i inventory.yml \ -e pkg_file=/path/to/deviceConnect.<version>.pkg \ -e mac_password="your-password"
-
Review the output. For each host, the playbook will print a version comparison showing whether it will install or skip.
The install-gigacap.yml playbook installs a gigacap .deb package on all hosts in the gem group. It runs one host at a time (serial: 1) to limit the blast radius of a failed installation — if one host fails, the remaining hosts are skipped. It restarts the gigacap systemd service after a successful install.
Package filename format: gigacap_<version>+<commit>_<arch>.deb — the <version>+<commit> portion is compared against the installed version, which is parsed from gigacap version output (e.g., 4.22.0+abc1234).
-
Place the gigacap
.debfile on your local machine (the Ansible controller). -
Run the playbook, passing the path to the
.debfile.Using Ansible Vault:
ansible-playbook install-gigacap.yml \ -i inventory.yml \ -e deb_file=/path/to/gigacap_<version>+<commit>_<arch>.deb \ --ask-vault-pass
Using command-line variables:
ansible-playbook install-gigacap.yml \ -i inventory.yml \ -e deb_file=/path/to/gigacap_<version>+<commit>_<arch>.deb \ -e gem_password="your-password"
-
Review the output. For each host, the playbook will print a version comparison showing whether it will install or skip. If a new version is installed, the gigacap service is automatically restarted.
All playbooks are safe to re-run. If a run fails mid-way, the installer file may be left in /tmp on the target host. A subsequent successful run will clean it up.
Run ansible-lint against the playbooks:
make lintThis requires ansible-lint to be installed (pip install ansible-lint).
Linting also runs automatically in CI on pull requests and pushes to main.