mimacom.bamboo-agent
Ansible Role: bamboo-agent
This role installs a Bamboo agent (node) on either a local or remote machine for a specific Atlassian Bamboo server.
Requirements
You need an existing Atlassian Bamboo server because Bamboo agents rely on it. Ensure you have enough licenses for remote Bamboo agents if needed; otherwise, they won't appear in Bamboo.
Role Variables
Here are the variables you can use with their default values (check defaults/main.yml
):
install_jdk
: true
Decides if JDK should be installed.openjdk_version
: 1.8.0
Version of openJDK to install (only for remote agents).bamboo_agent_remote
: False
Indicates if this is a remote agent.bamboo_master_version
: ""bamboo_master_fqdn
: ""bamboo_master_https
: Falsebamboo_master_port
: ""
Connection details for the Bamboo master (only for remote agents).bamboo_master_user
: bamboo
User for the Bamboo master node (only for local agents).bamboo_agent_user
: bambooagentbamboo_agent_uid
: 5000
Username and ID for the service user (only for remote agents).bamboo_agent_application_folder
: "/opt/{{ bamboo_agent_user }}"bamboo_agent_data_folder
: "/opt/{{ bamboo_agent_user }}/bamboo-agent-home"
Where to keep application files and data (only for remote agents).bamboo_agent_jvm_memory
: 768m
Java memory allocation for the remote agent (only for remote agents).bamboo_agent_npmrc
: ""bamboo_agent_maven_settings
: ""
Configuration files for npm and Maven for the service user.bamboo_agent_capabilities
: []
List of capabilities for Bamboo remote agents. Capabilities are added to the Bamboo remote agent whenproperties
is defined. This is not applicable for local agents.
You can specify a source
and name
to install a corresponding package. Install the package manager separately.
Each capability has:
name
source
(one ofrepository
(like yum/apt),unarchive-remote
,npm
)symlinks
(List of symlinks to create, set as[]
if not used, withsrc
anddest
)binary_path
(Added to $PATH for all users and the Bamboo service user)extract_path
(Location to extract ifsource: unarchive-remote
)properties
(Key-value list for setting on remote agents)
HTTP Proxy Configuration
http_proxy
:
If this is set, remote agents will use this for HTTP connections, with keys forhost
,port
, optionaluser
, optionalpassword
, and optionalno_proxy
.
https_proxy
https_proxy
:
If this is defined, remote agents will use this for HTTPS connections. Ifhttp_proxy
is set andhttps_proxy
is not,http_proxy
will be copied.
Additional Notes for npm Dependencies
If you choose to install npm, you need to install Node.js manually. If Node.js is installed in a non-default location, use the "symlinks" sub-variable to define the correct destination for npm and Node.js in a standard path, like /usr/bin/.
Setting "binary_path" alone does not work because the ansible npm_module ignores it.
Deprecation Warning
- The dictionaries
bamboo_master
andbamboo_agent
are deprecated and will be removed in future versions. Please check the README. - The
bamboo_agent_capabilities
variable will no longer install packages in future versions. It will only set capability variables for remote agents and define binary paths. Usepre_tasks
orpost_tasks
in your playbook for installation with your custom tasks.
Dependencies
Usually none. For local bamboo agents, it is recommended to use the mimacom.bamboo
role.
Example Playbook
This example installs a Bamboo remote agent, fetching binaries from the Bamboo master node. It sets up the jar as a systemd service.
Node.js is added as a capability with download, extraction, symlinking, and updates to the systemd service for accessibility.
Angular CLI is installed with npm without creating symlinks, and a custom capability is set on the remote agent.
- hosts: build-agents
become: yes
roles:
- role: mimacom.bamboo-agent
bamboo_agent_remote: true
bamboo_master_version: 6.2.2
bamboo_master_fqdn: "https://bamboo.company.example/"
bamboo_master_https: true
bamboo_master_port: 443
bamboo_agent_capabilities:
- name: https://nodejs.org/dist/v7.7.4/node-v7.7.4-linux-x64.tar.gz
source: unarchive-remote
binary_path: /opt/nodejs/node-v7/bin/
extract_path: /opt/nodejs/
symlinks:
- src: /opt/nodejs/node-v7.7.4-linux-x64
dest: /opt/nodejs/node-v7
- src: /opt/nodejs/node-v7.7.4-linux-x64/bin/npm
dest: /usr/bin/npm
- src: /opt/nodejs/node-v7.7.4-linux-x64/bin/node
dest: /usr/bin/node
properties:
- key: system.builder.node.node-7
value: /opt/nodejs/node-v7/bin/node
- name: "@angular/cli"
source: npm
symlinks: []
properties:
- key: path.has.ng
value: "true"
Upgrade Bamboo Remote Agent
Bamboo remote agents do not upgrade automatically when you change bamboo_master_version
. Each remote agent updates itself upon detecting a new version on the master node. So, focus on upgrading the Bamboo master instead.
License
Apache License 2.0
Author Information
This role was created by Remo Wenger.
Installs a local or remote Bamboo agent with capabilities
ansible-galaxy install mimacom.bamboo-agent