raffienficiaud.ansible_atlassian_bambooagent_role
Ansible Atlassian BambooAgent Role
This role sets up an Atlassian Bamboo remote agent on a machine.
What This Role Does
- Creates a user for the Bamboo agent.
- Installs the Bamboo server certificate to allow direct download of the agent jar file (optional).
- Creates startup scripts for the agent and adds paths and options as needed.
- Registers the startup script to launch the agent when the machine boots.
- Configures an automatic start service on the operating system.
- Sets the capabilities of the agent.
- Modifies the build folder and agent name.
Requirements
Java must be installed on the target machine. Use the ansible-atlassian-bambooagent-oracle-java
role for this.
Role Variables
You need to set the following variables for this role:
Variable | Default | Meaning |
---|---|---|
bamboo_server_url |
"" |
URL of your Bamboo instance (required) |
bambooagent_user |
bambooagent |
User for the Bamboo agent |
bambooagent_group |
bambooagent_grp |
Group for the Bamboo agent user |
bambooagent_service_name |
bambooagent |
Name of the Bamboo agent service |
bambooagent_install_root |
/home/{{ bambooagent_user }} |
Root folder for agent programs and scripts |
bambooagent_agent_root |
{{ bambooagent_install_root }}/bamboo-agent-home |
Folder for Bamboo agent files |
bambooagent_version |
5.11.1.1 |
Version of the agent |
bamboo_java_jar_file |
"" |
Location of the Java agent launcher jar |
bambooagent_jar_filename |
atlassian-bamboo-agent-installer-{{ bambooagent_version }}.jar |
Name of the jar file on the agent |
bambooagent_capability_file |
{{ bambooagent_agent_root }}/bin/bamboo-capabilities.properties |
Location of capabilities file |
bambooagentjava_additional_options |
["-Djava.awt.headless=true", "-Dbamboo.home={{ bambooagent_agent_root }}"] |
Java options to pass |
bambooagent_additional_environment |
[] |
Additional environment variables to set |
certificate_files |
[] |
List of certificates (see below) |
bamboo_verify_certificates |
True |
Verify server certificates when downloading jar |
Java Compatibility
Ensure the agent version works with the installed Java version. For instance, version 5.11 requires Java 8.
Agent Capabilities
The agent can declare its capabilities via a capability file. This file is simple and located in the installation folder. It lists capability names and their values.
You can read existing capabilities with pre-tasks and update them with post-tasks in your playbook.
Removing Capabilities
To manage obsolete capabilities, use the bamboo_capabilities_to_remove
list to specify which capabilities to remove in your playbook.
Getting the Agent UUID
The role provides a helper to retrieve the agent's UUID, useful for managing agents in Bamboo's admin view.
Using HTTPS Certificates
List certificates in the certificate_files
variable, specifying an alias and file path.
Changing the Build Folder
You can change the build folder after installing the agent. This is useful for managing disk usage and backups. Ensure the agent is stopped before making changes.
Example Playbook
Here is an example playbook to install the Bamboo agent:
- hosts: bambooagents
vars:
- program_location: /folder/containing/installers/
- server_url: https://my.local.network/bamboo/
- local_var_bambooagent_install_root: "/somebigdrive/bambooagent"
- bambooagent_version: "6.8.1"
- local_copy_of_bamboo_agent_jar: "/some/folder/{{ bambooagent_jar_filename }}"
pre_tasks:
- name: Reading the agent capability file
include_role:
name: atlassian_bambooagent_role
tasks_from: read_capability
post_tasks:
- name: Updates agent capabilities
include_role:
name: atlassian_bambooagent_role
tasks_from: write_capability
roles:
- name: installing the bamboo agent
role: atlassian_bambooagent_role
vars:
bambooagent_user: "bamboo_service_user"
bambooagent_group: "bamboo_service_group"
bambooagent_agent_root: "/mount/folder/fast/disk/bamboo-agent"
bambooagent_service_name: atlassian-bambooagent
bamboo_server_url: "{{ server_url }}"
bamboo_java_jar_file: "{{ local_copy_of_bamboo_agent_jar }}"
bambooagent_install_root: "{{ local_var_bambooagent_install_root }}"
certificate_files:
- alias: "my.certificate.authority.crt"
file: "/some/local/folder/my.certificate.authority.crt"
tags: bamboo
tasks:
- name: '[BAMBOO] default capabilities'
set_fact:
bamboo_capabilities: "{{ bamboo_capabilities | combine({item.key:item.value}) }}"
loop:
- key: 'operating_system'
value: "{{ bamboo_operating_system }}"
- key: agent_name
value: "{{ ansible_fqdn }}"
- key: osversion
value: "{{ ansible_distribution_version.split('.')[:2] | join('.') }}"
License
BSD License
Author Information
Feedback and contributions related to Ansible are welcome in the dedicated Github project.
Change Log
- v0.1: Initial version with role name change, variable additions, and bug fixes.
Installs Atlassian Bamboo remote agent on a target machine
ansible-galaxy install raffienficiaud.ansible_atlassian_bambooagent_role