basho-labs / ansible-riak Goto Github PK
View Code? Open in Web Editor NEWAnsible roles for Riak
License: Other
Ansible roles for Riak
License: Other
I was looking for examples regarding the usage of this role to form a cluster and the documentation refers and links a missing examples/
folder, apparently deleted by cf5d68e. Because of the commit message I'm not sure if the deletion occurred by mistake, although I'm assuming they were deleted because they were out-of-date; what makes me question this is that they were already using v2.0.0 of riak-common
: see roles.txt.
In the case of the latter, how different should the cluster setup be from the "old" examples? Are there plans to release some cluster setup examples any time soon?
Thanks in advance.
https://github.com/basho-labs/ansible-riak/blob/develop/tasks/main.yml#L45
https://github.com/basho-labs/ansible-riak/blob/develop/tasks/main.yml#L50
The template module has a "backup" parameter that will automatically backup and timestamp the file it replaces, should negate the need for these.
When attempting to reference a URL or file on the remote machine for riak.deb
, ansible gives this message:
TASK [ansible-riak : Install Riak for Debian] **********************************
fatal: [54.194.64.222]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'http://s3.amazonaws.com/.../riak.deb' is available"}
It appears the cause of this is the fact that the apt module requires another parameter called deb
when referencing local files. I'm not sure how to supply a URL at this point.
In basho-labs.riak-kv/tasks/Debian.yml
- name: Fetch ansible ansible_version
local_action: shell ansible --version
register: ans_ver
Should be:
- name: Fetch ansible ansible_version
local_action: shell ansible --version
register: ans_ver
sudo: False
Because it will trigger a local sudo that is not mandatory. As it is not mandatory, it should explicitely ignore rights escalation (see: ansible/ansible#1415 (comment) )
This is require for me since I moved from sudo
to become
/become_user
I have trouble making my riak
role inherit this one with ansible 2.0.1.0. The with_items don't work very nice with BARE variables (eg not inside a "{{…}}") that cause my playbook to crash on security.yml and buckets.yml
Would it be possible to change security.yml
to something like that:
---
- name: Create users
command: '{{ riak_admin }} security add-user {{ item.user }} password={{ item.password }}'
with_items: "{{riak_users}}"
- name: Create security sources
command: '{{ riak_admin }} security add-source {{ item.user }} {{ item.cidr }} {{ item.type }}'
with_items: "{{ riak_sources }}"
- name: Set security permissions
command: '{{ riak_admin }} security grant {{ item.permissions }} on {{ item.container }} to {{ item.subject }}'
with_items: "{{ riak_grants }}"
This to avoid this kin d of message:
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{riak_bucket_types}}'). This feature will be removed in a future release. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.
If riak_tune_disks is enabled, then /etc/rc.local gets completely overwritten.
I don't think this is good behaviour at all -- sysadmins may have, quite reasonably, added customisations to this file already.
My suggestion would be to, instead, create an upstart job that starts on boot and runs once, which has the same content as the riak rc.local. That's unfortunately a bit distro-specific; you'd probably need to replicate this work for sysv and systemd as well. I'd say it's the right way to do this, though...
Install an executable script somewhere with the actual content that current goes in rc.local. Then add a line to /etc/rc.local to call it. This can be done with the "lineinfile" command in Ansible, to just append the line to the file if it doesn't exist, rather than clobbering the whole file.
Thoughts?
As new Riak KV versions are released, I am not confident of the files embedded in the role under directories files
and templates
. In particular, I understand the riak.conf
file is already included in the packages hence, rather than embedding a Jinja2-templated-copy of that, Ansible modules e.g. lineinfile
may be used for editing in-place /etc/riak/riak.conf
. In this way, users wanting to perform custom changes to /etc/riak/riak.conf
can do that knowing that as long as the line regexps are different ansible-riak will not overwrite those changes.
Do you understand as well that riak.conf.j2
could be deleted from the role replacing it with in-place editing where needed? And do you plan / accept contributions in this direction?
Unless I'm mistaken, you won't need the when: riak_ring_status.stdout.find('joining') > 0
under the Riak module section, should already be taken care of in the module: https://github.com/ansible/ansible-modules-extras/blob/devel/database/misc/riak.py#L197
Hi,
In the « Ansible Galaxy Install » readme section, references are made to christophermancini.riak-kv which no longer exists.
There is no basho-labs or riak roles that matches this repository on Ansible Galaxy anymore.
I'll clone the repository, but I think that worth an action on your side.
In the current dev-2.x branch, we have this action item:
- name: Replace / add config settings to riak.conf
lineinfile: "dest=/etc/riak/riak.conf regexp='^#{0,1}{{ item.key|replace('-','.') }} = .+$' line='{{ item.key|replace('-','.') }} = {{ item.value }}'"
tags: configfiles
when: riak_conf is defined
with_dict: riak_conf
Unfortunately this fails with an error, "with_dict expects a dict", if riak_conf is undefined. Even though there is a conditional above that looks like it should prevent this item running at all.
(riak_conf can be optionally uncommented and defined in defaults/main.yml)
The same issue applies to the security.yml tasks and their related (and commented-out) parameters in defaults.yml
Riak doesn't starts. Riak role version: v1.0.9. Riak common version: v1.1.0, Riak version 1.4
TASK: [basho.riak | start riak] ***********************************************
failed: [186.234.246.54] => {"failed": true}
msg: sudo: unable to resolve host riak-57ebaa2d-dd52-41cb-8bc4-6fe458c4a701
Error on line 18: syntax error before: '<'
Error reading /etc/riak/app.config
The app.config file in ansible-galaxy, differs from the one in github:
Ansible-galaxy:
{pb_backlog, (< riak_pb_backlog >)}
Github:
{pb, [ {"{{ riak_pb_bind_ip }}", {{ riak_pb_port }}} ]}
https://github.com/basho/ansible-riak/blob/develop/templates/etc_riak_app.config.j2
it's asking for item.container but everything is now buckets.
Developers using Docker for development/testing/staging environment (not for production) would benefit from using the same scripts for all environments. In Docker containers, alternative init systems are usually preferred to systemd - runit is one of those e.g. see https://github.com/phusion/baseimage-docker .
I keep getting this when I use the role to install riak.
TASK: [basho.riak | install riak] *********************************************
failed: [crawler_stats] => {"failed": true}
stderr: E: Version '1.4.10-1' for 'riak' was not found
stdout: Reading package lists...
Building dependency tree...
Reading state information...
msg: 'apt-get install 'riak=1.4.10-1' ' failed: E: Version '1.4.10-1' for 'riak' was not found
FATAL: all hosts have already failed -- aborting
How can I use the role to install riak? I have this in my playbook. It is an ubuntu 14.04 box.
- role: basho.riak
tags: ["riak"]
sudo: yes
This is useful e.g. for memory.
Hi,
I'm trying to configure ansible-riak to use a separate volume for riak data. Although the ansible script correctly mounts the volume it seems to ignore it.
riak_partition: '/dev/vdb'
riak_mountpoint: '/riak-data'
riak_tune_disks: yes
riak_physical_disks: '[vdb]'
df /riak-data
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vdb 20642428 176064 19417788 1% /riak-data
df /var/lib/riak
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 41283904 1008184 38179116 3% /
May be the ansible script should change app.config data root to the mounted folder?
After a fresh install it points to:
{data_root, "/var/lib/riak/bitcask"}
Basically reopen of #79 but experienced by colleague with ansible 2.3.0.0
(and - if relevant at all - python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
) that called host group riak
. Changing variable riak_shell_group
fixed this e.g. { role: ansible-riak, riak_shell_group: }
.
Security is enabled by default
I believe it started with this commit: 4464591
The tasks/security.yml is unconditionally included, and since the commit above includes enabling security.
I imagine the fix would be to only include tasks/security.yml if a 'security' option is enabled, but I'm not sure what the intention of the initial tasks/security.yml was.
The readme states that the riak ansible module is in extras so is not part of the core install. That is incorrect. A pip install, git install, or OS package install all currently provide the ansible-extras modules. I find it a bit odd that the examples here show how to use the riak command line tools in preference of the riak ansible module, but perhaps it's because of this misunderstanding.
The first task stops riak, then it goes on to start riak at the end. Which means riak is always going to be stopped and started every time the role is used, which I'm guessing is not the desired behavior.
To fix I moved the 'when: riak_bucket_types is defined' to main.yml. This seems to fix the issue and from what I can tell the buckets.yml should really only be called when there are buckets defined.
I propose defaults/main.yml
shall have the possibility to express search config - similarly to how it already expresses bucket types (in riak_bucket_types
) - with a section like this:
#riak_search_schemas:
# - { name: myschema1, file: '/etc/mycustomschema' }
riak_search_schemas: []
#riak_search_indexes:
# - { name: myidx1, schema: 'myschema1' }
# - { name: myidx2, schema: 'myschema1' }
# - { name: myidx3, schema: '_yz_default' }
riak_search_indexes: []
Q1. Would it fit in ansible-riak?
Q2. I understand it shall be implemented using PUT requests 1 and 2. Do you have any advice on how to invoke those PUT requests idempotently? The two PUT requests are documented to return 409 if same name is already present - but it would not check if attributes are the same of the request (i.e. if the schema content is the expected one, and if the index is using the correct schema). It would require caller to issue GET first, store body, compare with the expected one, and then err if found but different. But such logic looks complex. Would you accept ignore_errors: true
like in 44da67f ?
In dev-2.x branch, the buckets.yml and security.yml tasks will fail if re-run, throwing errors because the things they try to create have already been created.
Really they should have some kind of "only create if thing doesn't exist" logic added.
Tried to use this role to install Riak TS on a couple of machines with Ubuntu 16.04 LTS installed and it failed as there is no packages in the repositories for this Ubuntu version. This might not be the correct place to report this, but I really don't know where.
TASK [basho-labs.riak-kv : Install Pre-requisites] *****************************
ok: [192.168.11.100] => (item=[u'curl', u'apt-transport-https', u'default-jre'])
ok: [192.168.12.9] => (item=[u'curl', u'apt-transport-https', u'default-jre'])
ok: [192.168.13.124] => (item=[u'curl', u'apt-transport-https', u'default-jre'])
TASK [basho-labs.riak-kv : Check if Riak is installed] *************************
ok: [192.168.11.100]
ok: [192.168.13.124]
ok: [192.168.12.9]
TASK [basho-labs.riak-kv : Add Package Cloud repository key without validation]
ok: [192.168.11.100]
ok: [192.168.12.9]
ok: [192.168.13.124]
TASK [basho-labs.riak-kv : Add Basho Riak repository (hosted at Package Cloud)]
ok: [192.168.11.100]
ok: [192.168.13.124]
ok: [192.168.12.9]
TASK [basho-labs.riak-kv : Install Riak for Debian] ****************************
fatal: [192.168.13.124]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'riak-ts' is available"}
fatal: [192.168.12.9]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'riak-ts' is available"}
fatal: [192.168.11.100]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'riak-ts' is available"}
to retry, use: --limit @/home/ubuntu/ansible/riakts_nodes.retry
PLAY RECAP *********************************************************************
In vagrant (Ubuntu) run:
ERROR: change handler (check proc writeable) is not defined
This commit appears to leave in the notify to the handler, and also remove the handler from handlers/main.yml
ansible-riak defaults riak_shell_group
to 'riak'
. Apparently Ansible 2.2.2.0 changed somehow evaluation of conditionals and/or dict lookup compared to 2.2.1.0 - see #78. Therefore users with an Ansible inventory with a host group named riak
experiences error in dict lookup.
Workaround as a user is changing default riak_shell_group
when using ansible-riak e.g. { role: ansible-riak, riak_shell_group: }
.
Proper fix would either:
riak_shell_nodes
and dependent variables; orriak_shell_group
to 'riak'
only if riak ts is being installed.A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.