Last active
October 21, 2015 21:20
-
-
Save stefhen/cedd43a701f25e9539d5 to your computer and use it in GitHub Desktop.
machine_tag search example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| include_recipe "machine_tag::default" | |
| # Tag host with seed status | |
| machine_tag "cassandra:seed_host=#{node[:cassandra][:is_seed_host]}" do | |
| action :create | |
| end | |
| # Tag host with broadcast and listen addresses for discovery | |
| machine_tag "cassandra:broadcast_address=#{node[:cassandra][:broadcast_address]}" do | |
| action :create | |
| end | |
| machine_tag "cassandra:listen_address=#{node[:cassandra][:listen_address]}" do | |
| action :create | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Chef::Recipe | |
| include Chef::MachineTagHelper | |
| end | |
| include_recipe 'machine_tag::default' | |
| Chef::Log.info 'Beginning gluster search' | |
| glusterfs_peers = [] | |
| tags_results = tag_search(node, 'gluster:server=true') | |
| Chef::Log.info 'tags:' + tags_results.inspect | |
| tags_results.each do |itemlist| | |
| ip_address = itemlist['server:private_ip_0'].first.split('=').last | |
| Chef::Log.info ' Here are the ips addresses that we got from ruby block of gluster peer: #{ip_address}' | |
| glusterfs_peers << ip_address | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment