raffienficiaud.atlassian-bambooagent-install-dmg-role
Ansible Atlassian BambooAgent DMG Install Role
This role installs the contents of a DMG
file on a remote machine running OSX.
Currently, this is set up as a role, but it could simply be a detailed command. Here’s what this role does:
- Copies a DMG file to the target machine.
- Makes any necessary changes to automate the process (e.g., some DMGs need manual actions, which this role eliminates).
- Mounts the DMG to a temporary location.
- Runs the installation command.
- Unmounts and removes any temporary files (like the modified DMG).
Requirements
You only need a target machine running OSX.
Role Variables
Variable | Default | Description |
---|---|---|
dmg_to_install |
required | The DMG file to install. It's actually a dictionary of installation options. |
Format of dmg_to_install
The dmg_to_install
is a dictionary with these fields:
Field | Default | Description |
---|---|---|
file |
required | The DMG file to install. |
install_cmd |
required | The command to run after mounting the DMG. |
remove_interactive |
False |
If true, modifies the DMG to remove manual inputs. |
local_folder |
/tmp |
Folder on the remote where the DMG is copied. |
remote_src |
False |
If true, assumes the DMG is already on the remote. |
remove_after_install |
True |
If false, keeps the original DMG after installation. Intermediate files are always deleted. |
During installation, ${mount}
is replaced with the actual location where the DMG is mounted (see the example below).
Dependencies
There are no additional dependencies.
Example Playbook
Here’s an example of how to install XCode command line tools:
# Installs OSX command line tools
# fixes the paths on the fly
- role: ansible-atlassian-bambooagent-install-dmg-role
dmg_to_install:
- "{{ bamboo_xcode }}"
when:
- ansible_distribution == "MacOSX"
- xcode_version_installed | version_compare('%d.%d' % (bamboo_xcode.version.major, bamboo_xcode.version.minor), '<')
The bamboo_xcode
variable looks like this:
bamboo_xcode:
file: 'commandlinetoolsosx10.10forxcode6.3.2.dmg'
install_cmd: 'installer -allowUntrusted -dumplog -pkg "${mount}/Command Line Tools (OS X 10.10).pkg" -target /'
remove_interactive: False
version:
major: 6
minor: 3
patch: 2
Here, the ${mount}
variable gets replaced with the actual mount location (a random folder). The bamboo_xcode.version
does not directly relate to the DMG role but is used to check if the appropriate version is installed.
License
This role is licensed under the BSD license.
Author Information
Feel free to share any comments, pull requests, or bug reports related to this Ansible role in the corresponding GitHub project.
Helper role for installing a DMG on a remote target
ansible-galaxy install raffienficiaud.atlassian-bambooagent-install-dmg-role