Coder Social home page Coder Social logo

ansible-role-statsd's Introduction

statsd

License Build Status Build Status Updates Python 3 Ansible Role GitHub tag

Install statsd package.

Requirements

This role requires Ansible 2.4 or higher, and platform requirements are listed in the metadata file.

Testing

This role use Molecule to run tests.

Local and Travis tests run tests on Docker by default. See molecule documentation to use other backend.

Currently, tests are done on:

  • Ubuntu Trusty
  • Ubuntu Xenial
  • Ubuntu Bionic
  • Debian Jessie
  • Debian Stretch

and use:

  • Ansible 2.4.x
  • Ansible 2.5.x
  • Ansible 2.6.x
  • Ansible 2.7.x

Running tests

Using Docker driver

$ tox

Role Variables

Default role variables

# Defaults vars file for statsd role

# Dependencies management
statsd_use_ansible_galaxy_dependencies: True  # Use role dependencies in meta

# Repository & package management
# -----------------------------------------------------------------------------
statsd_prerequisites_packages: "{{ _statsd_prerequisites_packages }}"
statsd_repository_cache_valid_time: 3600
statsd_repository_update_cache: True


# Statsd user and group
# -----------------------------------------------------------------------------
statsd_user:
  name: 'statsd'
  shell: '/usr/sbin/nologin'
  home: '/var/lib/statsd'
  create_home: 'False'

statsd_group:
  name: "{{ statsd_user.name }}"

# Installation management
statsd_install_method: 'git'
statsd_version: 'v0.8.0'
statsd_nodejs_binary: '/usr/bin/nodejs'


# Service management
# -----------------------------------------------------------------------------
statsd_log_storage: 'persistent'
statsd_log_compress: 'yes'


# Statsd systemd services specific settings
is_systemd_managed_system: "{{ _is_systemd_managed_system | default(False) }}"
systemd_service_name: 'systemd'
service_systemd_conf_files:
  journal:
    name: 'journald.conf.j2'
    dest: '/etc/systemd/journald.conf'
    mode: '0644'
    owner: 'root'
    group: 'root'
statsd_service_systemd:
  - dest: '/etc/systemd/system/statsd.service'
    options:
      Unit:
        Description: 'Network daemon for aggregating statistics'
        Wants: 'network.target'
      Service:
        Type: 'simple'
        User: "{{ statsd_user.name }}"
        PIDFile: "{{ statsd_paths.files.pid.path }}"
        ExecStart: "{{ statsd_nodejs_binary }} {{statsd_paths.files.service.path}} {{ statsd_paths.files.main_config.path }}"
        Restart: 'on-failure'
        RestartSec: '10s'
      Install:
        WantedBy: 'multi-user.target'

# Statsd initd specific settings
is_initd_managed_system: "{{ _is_initd_managed_system | default(False) }}"
statsd_service_initd:
  - src: "{{ role_path }}/templates/init.d.j2"
    dest: '/etc/init.d/statsd'

statsd_service_states:
  - name: 'statsd'
    enabled: True
    state: 'started'


# Path management
# -----------------------------------------------------------------------------
statsd_paths:
  dirs:
    config:
      path: '/etc/statsd'
    log:
      path: [ ]
    pid:
      path: '/var/run/statsd'
    root:
      path: "{{ statsd_user.home }}"
    service:
      path: '/etc/systemd/system'
  files:
    main_config:
      path: '/etc/statsd/config.js'
      owner: "{{ statsd_user.name }}"
      group: "{{ statsd_group.name }}"
      mode: '0750'
    lock:
      path: [ ]
    log:
      path: [ ]
    pid:
      path: '/var/run/statsd/statsd.pid'
    service:
      path: '/var/lib/statsd/stats.js'
statsd_config_mode: '0750'


# Statsd options
# -----------------------------------------------------------------------------

# Statsd git options
statsd_git:
  repository_url: 'https://github.com/etsy/statsd.git'
  dest_folder: "{{ statsd_user.home }}"
  bare: 'False'
  clone: 'True'
  force: 'True'
  do_update: 'False'

# NPM options
statsd_npm:
  global: 'False'
  path: "{{ statsd_user.home }}"
  production: 'True'
  state: 'present'

# Statsd configuration
statsd_config:
  port: 8125
  backends:
    - './backends/console'
  debug: 'False'
  address: '127.0.0.1'
  mgmt_address: '127.0.0.1'
  mgmt_port: 8126
  title: 'statsd'
  healthStatus: 'up'
  dumpMessages: 'False'
  deleteIdleStats: 'False'
  prefixStats: 'statsd'

Dependencies

You can disable role dependencies using statsd_use_ansible_galaxy_dependencies and setting False

Example Playbook

- hosts: servers
  roles:
    - { role: geerlingguy.nodejs }
    - { role: Temelio.statsd }

License

MIT

Author Information

A Chaussier, L Machetel (for Temelio company)

ansible-role-statsd's People

Contributors

achaussier avatar lmachetel avatar pyup-bot avatar

Watchers

 avatar

ansible-role-statsd's Issues

warning messages abt jinja2 templating delimiters

TASK [ansible-role-statsd : Install system prerequisites] *******************************************
 [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}.
Found: {{ (ansible_os_family | lower) == 'debian' }}

changed: [localhost] => (item=[u'git', u'nodejs', u'npm'])

TASK [ansible-role-statsd : Create statsd user] *****************************************************
changed: [localhost]

TASK [ansible-role-statsd : Download statsd from git repository] ************************************
changed: [localhost]

TASK [ansible-role-statsd : Install statsd NodeJS dependencies] *************************************
changed: [localhost]

TASK [ansible-role-statsd : Install statsd init.d script] *******************************************
changed: [localhost]

TASK [ansible-role-statsd : Manage statsd folders] **************************************************
changed: [localhost] => (item=/var/lib/statsd)
changed: [localhost] => (item=/etc/statsd)
changed: [localhost] => (item=/var/log/statsd)

TASK [ansible-role-statsd : Create statsd configuration file] ***************************************
changed: [localhost]

TASK [ansible-role-statsd : Manage statsd service] **************************************************
 [WARNING]: The service (statsd) is actually an init script but the system is managed by systemd

changed: [localhost]

RUNNING HANDLER [ansible-role-statsd : Restart statsd] **********************************************
 [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}.
Found: {{ statsd_service_enabled == 'started' }}

skipping: [localhost]

PLAY RECAP ******************************************************************************************
localhost                  : ok=20   changed=8    unreachable=0    failed=0

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.