Giter Site home page Giter Site logo

mimacom / ansible-role-bamboo-agent Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 10.0 59 KB

Ansible Role - bamboo-agent

Home Page: https://galaxy.ansible.com/mimacom/bamboo-agent/

License: Apache License 2.0

Ruby 13.35% Shell 86.65%
bamboo ansible agent build atlassian role buildserver ci

ansible-role-bamboo-agent's Introduction

Ansible Role: bamboo-agent

Build Status

Installs a local or remote Bamboo agent (node) for a specific Atlassian Bamboo master server.

Requirements

You already must have an Atlassian Bamboo server, since Bamboo agents depend on it. Before using this role, make sure you have enough licenses remote Bamboo agents (if wanted) otherwise they won't show up in Bamboo.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

install_jdk: true

Whether to install JDK or not.

openjdk_version: 1.8.0

The version of openJDK to install (remote agent only).

bamboo_agent_remote: False

Whether this is a remote agent or not.

bamboo_master_version: ""
bamboo_master_fqdn: ""
bamboo_master_https: False
bamboo_master_port: ""

Bamboo master connection (remote agent only)

bamboo_master_user: bamboo

Service user for Bamboo master node (local agent only)

bamboo_agent_user: bambooagent
bamboo_agent_uid: 5000

Service user name, primary group and ID for systemd (remote agent only).

bamboo_agent_application_folder: "/opt/{{ bamboo_agent_user }}"
bamboo_agent_data_folder: "/opt/{{ bamboo_agent_user }}/bamboo-agent-home"

Path where to store application binaries and application data (remote agent only).

bamboo_agent_jvm_memory: 768m

Java heap space for remote bamboo agent (remote agent only).

bamboo_agent_npmrc: ""
bamboo_agent_maven_settings: ""

Contents of the service user's setting files for npm and maven.

bamboo_agent_capabilities: []

A list of Bamboo capabilities. For remote agents, the capabilities will be added as actual capabilities in the Bamboo remote agent, when properties is set. Unfortunately this is not possible for local agents.

If you specify the source with a proper name, an according package is installed. You must install the used package manager by yourself!

A capability has the values:

  • name
  • source (One of repository (means yum/apt/...), unarchive-remote, npm)
  • symlinks (List of symlinks to create for this binary. Set it to [] if you don't use it! Subkeys are src and dest)
  • binary_path (Value will be added to $PATH for all users and Bamboo agent service user)
  • extract_path (Path where to extract, when source: unarchive-remote)
  • properties (List of properties which are set on remote agents. Subkeys are key and value)

HTTP proxy

http_proxy

If set, remote agent will use this proxy for HTTP connections. This dict has the following values:

https_proxy

If set, remote agent will use this proxy for HTTPS connections. If unset but http_proxy set, its value will be copied to https_proxy. This dict has the following values:

  • host
  • port

Other values will be used from http_proxy.

Other notes for npm dependencies

If you configure to install npm, you must make sure to install node by yourself. Please note: If you install node to a non-default PATH, make sure to define the "symlinks" sub-variable and point the destination of npm and node to a default-path like /usr/bin/.

Simply setting "binary_path", which would add the path to $PATH variable doesn't work since ansible npm_module ignores it!

Deprecation warning

  • dicts bamboo_master and bamboo_agent are deprecated and will be removed in future releases. Please consult README.
  • bamboo_agent_capabilities will not install packages anymore in the future. It will be used only for setting capability variables for remote agents, and set binary paths. Please use pre_tasks or post_tasks in your playbook, to install using your own tasks.

Dependencies

Normally none. But if you use this role for a local bamboo agent, it is recommended to use mimacom.bamboo role.

Example playbook

This installs a Bamboo remote agent. The binary will be fetched from the Bamboo master node (according to bamboo_master_* variables). The jar will be setup as a systemd service.

Nodejs as a capability will be downloaded, extracted, symlinked and the binary path will be added to the systemd service in order for the agent to find nodejs.

Angular CLI as a second capability will be installed using npm. No symlinks are created, and a custom capability will be set on the remote agent according to its properties.

- 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 will not be upgraded when you change the bamboo_master_version variable. Each remote agent will update itself once it has detected a new version on the master node. So, simply worry about upgrading the Bamboo master :-)

License

Apache License 2.0

Author Information

This role was created by Remo Wenger.

ansible-role-bamboo-agent's People

Contributors

danielm0hr avatar stromvirvel avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-role-bamboo-agent's Issues

Versioning conflicts

Good evening!

I tried to install your tool, but ansible-galaxy threw the following error:

[WARNING]: - mimacom.bamboo-agent was NOT installed successfully: Unable to compare role versions (v0.0.1, 0.0.1) to determine the most recent version due to incompatible version formats. Please contact the role author to resolve versioning conflicts, or specify an explicit role version to install.

Maybe you can fix the version tag conflict :)


ansible-galaxy 2.5.2

Best regards,
Mtze

ERROR! The handlers/main.yml file for role 'mimacom.bamboo-agent' must contain a lt of tasks

I've tried installing this role by:

ansible-galaxy install mimacom.bamboo-agent

and

git clone https://github.com/mimacom/ansible-role-bamboo-agent.git ansible-bamboo-agent

My playbook is simple:

- hosts: bambooagent
  become: yes
  roles:
    - role: mimacom.bamboo-agent
      install_jdk: false
      bamboo_agent_remote: true
      bamboo_master_version: 6.6.1
      bamboo_master_fqdn: "bamboo.mysite.com"
      bamboo_master_https: true
      bamboo_master_port: 443

No matter what I try, I get the following error:

ERROR! The handlers/main.yml file for role 'mimacom.bamboo-agent' must contain a list of tasks

The error appears to have been in '/etc/ansible/roles/mimacom.bamboo-agent/tasks/main.yml': line 2, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- include: deprecated_bamboo_master.yml
^ here

Example Local Agent Configuration

Is it possible to demonstrate a local agent configuration?

Playbook

- hosts: local-bamboo-agent
  become: yes

  pre_tasks:
    - name: Ensure Apps Folder Exists
      file:
        path: "{{ item }}"
        state: directory
        owner: root
        group: root
      with_items:
        - /apps
        - /apps/mvn

    - name: Maven 3.5.2
      unarchive:
        src: http://apache.claz.org/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
        dest: /apps/mvn
        remote_src: yes
        creates: /apps/mvn/apache-maven-3.2.5/bin/mvn

  tasks:
    - name: mimacom.bamboo-agent
      include_role:
        name: mimacom.bamboo-agent
      tags:
        - local_bamboo_agent

Group Var

install_jdk: false
bamboo_agent_remote: false
bamboo_master_user: bamboo
bamboo_agent_npmrc: ""
bamboo_agent_maven_settings: ""

bamboo_agent_capabilities:
    - name: http://apache.claz.org/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
      binary_path: /apps/mvn/apache-maven-3.2.5/bin
      symlinks: []
      properties: []

This is also using your bamboo role to actually install bamboo, then Im running this agent role against the same instance. Playbook runs without error, but I have nothing showing in the agent configuration.

bambooagent group is not created

It looks like the role doesn't try to create the bambooagent group before creating the user, resulting in the following error:

TASK [mimacom.bamboo-agent : Add service user] *************************************************************************************************************************************** fatal: [xxx]: FAILED! => {"changed": false, "msg": "Group bambooagent does not exist"}

Happy to create a PR once this is confirmed as an issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.