Mohammad Fattahian | 30 Jul 16:15 2015

Creating local users

Hi folks,

 

What’s the best way to create local users based on the role of the nodes?

 

Let say I need different users created on nodes based on their roles (WEB Server, DB Server, etc.)

 

I’m using ‘users Cookbook’ to create users from a database.

 

 

Mohammad

Alan Thatcher | 30 Jul 00:22 2015
Picon

AIX service idempotency

Hello,

I have been working with Chef for only a few weeks, and only used it on RHEL nodes up until now.  Today I started working on the AIX pieces of my cookbooks.  One thing I have noticed so far is that the "service" idempotency does not seem to be the same for AIX as it is for linux.  For instance, when I create an LWRP such as:

service "xntpd" do
  supports :restart => true
  action [ :start ]
end

Everything functions as expected, except that the chef-client run always spits out the message that it started the service.  I have verified that the service is indeed running with lssrc -s xntpd before running the cookbook through.

I assume that this is a known thing.  My question is, how can I "fix" this for now.  I tried the method of adding an only_if, however, that stopped the :restart directive i gave it for when the /etc/ntp.conf file was updated.  I looked as best I could ( being new to Chef and Ruby ), and I did see where there was a lssrc check in  chef::provider::service::aix.  I obviously don't want to modify, and thus maintain that modification across upgrades, the Chef provided code.  

Any help would be appreciated.  Thanks!

-Alan
Matthew Moretti | 28 Jul 15:19 2015
Picon

Re: Powershell query

Scheduled tasks are certainly the direction you want to go. The Windows cookbook has the windows_task resource. Underneath the hood it relies on schtask, but abstracts a good deal of the complexity away under a resource. Hope that gets you pointed in the right direction.

Matt Moretti


On Tue, Jul 28, 2015 at 4:27 AM, ANGELA EBIRIM <aebirim <at> icloud.com> wrote:
Hi everyone,

I'm hoping someone could help me with this as I'm stuck!

I have a powershell command: powershell.exe Get-ChildItem C:\Users\ae\AppData\Local\Temp\3\logstash | Where-Object {_.LastwriteTime -lt (Get-Date).addhours(-12} | Remove-Item -Recurse -Force

which essentially deletes folders within the logstash directory that are older than 12 hours. This needs to be done at a certain time each day.

This command will be included in a Chef recipe and deployed to a Windows Server box.

I'm having difficulty getting this to run at a certain time and was wondering if anyone knew of a way to do this. I've been using the SCHTASKS windows function but this works on a command line but not within a script.

Is anyone aware of a Chef resource that could do this?

Many thanks
 
Sent from iCloud

Phil Oliva | 27 Jul 23:29 2015

gem_package and --user-install

Hi all,

 

I can’t seem to figure out a way to use gem_package with --user-install option but install gem to another user’s home directory (local user for example).

 

gem_package = node[‘my_cookbook’]['gem_package']

gems = gem_package['gems']

gem_binary = gem_package['gem_binary']

remove_options = gem_package['remove_options']

install_options = gem_package['install_options']

source = gem_package['source']

 

gems.each { |gem_name, gem_info|

  gem_ver = gem_info['ver']

 

  gem_package "Remove old versions of #{gem_name} gem" do

    package_name "#{gem_name}"

    action :remove

    ignore_failure true

    gem_binary gem_binary

    options remove_options

    not_if %Q[#{gem_binary} list | grep "#{gem_name} (#{gem_ver})"]

  end

 

  gem_package "Install specified version of #{gem_name} gem" do

    package_name "#{gem_name}"

    version "#{gem_ver}"

    options "--clear-sources --source #{source} #{install_options}"

    action :install

    gem_binary gem_binary

    not_if %Q[#{gem_binary} list | grep "#{gem_name} .*#{gem_ver}"]

  end

}

 

The gem resource produces the right command but needs to be run as local and not root so files end up in wrong directory.

 

/usr/bin/gem install gem_name -q --no-rdoc --no-ri -v "3.15.0" --clear-sources --source http://gemserver.chef.orion.altus.bblabs.rim.net/ --user-install

 

Is an execute block only way to do this using “user” attribute?

For some reason I thought it was common functionality that you can change which user runs a resource in chef. However after checking docs it seem you can only reference :user in guards.

 

Am I missing something obvious?

 

-Phil

 

Philip Oliva

Senior Infrastructure Software Developer

BlackBerry Ltd.

“Fail quick, fail often, recover quickly”

http://ca.linkedin.com/pub/philip-oliva/67/74/10

 

Jeremy Bingham | 27 Jul 22:03 2015
Picon

goiardi 0.10.0 - Taihun

The bad news is that goiardi 1.0.0 got pushed back again because of various reasons, but the good news is that in the meantime goiardi 0.10.0 "Taihun" is here: https://github.com/ctdk/goiardi/releases/tag/v0.10.0. For those curious, but don't feel like clicking through to find out, "taihun" was the Gothic word for "ten".

The big thing in this release is the postgres backed search, which I mentioned on this very list several weeks ago. I put it through its paces in that time and optimized it a bunch, so performance is now a lot better when running searches against 10,000 nodes. As I wrote in the documenation:

```
In testing, goiardi with postgres search can handle 10,000 nodes without any particular problem. Simple queries complete reasonably quickly, but more complex queries can take longer. In the most recent tests, on a 2014 MacBook Pro with 16GB of RAM and a totally untuned PostgreSQL installation, executing the search query equivalent to “data_center:Vagrantheim” directly into the database with 10,000 nodes consistently took about 40-60 milliseconds. The equivalent of “data_center:Vagrantheim AND name:server2*” took between 3 and 4 seconds, while “data_center:Vagrantheim AND name:(server2* OR server4*)” took about 7-8 seconds. It is expected that with proper tuning, and as this feature matures, these numbers will go down. It’s also worth mentioning that when using knife search, the whole process takes considerably longer anyway.
```

Once goiardi has reached the 1.0.0 milestone and gets organizations, a standalone search may be possible. This may not be as easy as I originally thought, because now the postgres search makes use of the node/environment/etc. tables to vastly speed up the searches, but it should be doable.

For those interested in learning more, the postgres search documentation is available at http://goiardi.readthedocs.org/en/latest/features/search.html#postgres-search, and the v0.10.0 announcement is at http://goiardi.gl/blog/2015/07/24/goiardi-version-0.10.0---taihun/.

Thanks,

-j
Fouts, Chris | 25 Jul 04:20 2015

Pinning cookbook versions to a test bed

I have

-        1 central Chef Enterprise 12 server with multiple organizations – Dev, QA, etc

-        Several test beds per organizations – TestBed1, TestBed2…TestBed10 in Dev, different ones in QA

-        Berkshelf API server

 

Using the AAME server and the SAME organization, and WITHOUT using Chef PolicyFile, nor setting up an environment json file per test bed, is it even possible to pin a cookbook version to a certain test bed? IOW, I may want

-        Cookbook1 v1.0.0 in TestBed1 in Dev organization

-        Cookbook1 v1.1.0 in TestBed2 in Dev organization

 

A  valid answer may be “I can’t without policy file nor environments”

 

I’ve been Chef’ng for almost a year now, and this is still one piece of the puzzle I’m lacking.

 

Chris

 

Claire McQuin | 24 Jul 22:16 2015

Ohai 8.6.0.alpha.0 is released

Hi folks,

I've released ohai 8.6.0.alpha.0 which includes some of the changes from RFC 053 (https://github.com/chef/chef-rfc/blob/master/rfc053-ohai-config.md), namely:

  - Ohai::Config[:option] is deprecated in favor of ohai.option in configuration files
  - ohai command now supports a config file option. Pass a config file to ohai with `-c CONFIG`.

Claire
Benzinger, Dennis | 24 Jul 13:02 2015
Picon

Cookbook Attributes Best Practices/Guidelines ?

Hello List,

what are some good websites or presentations about best practices/guidelines
for attributes in cookbooks? 

For example about:
- Naming of the attribute files
- Naming of the attributes themselves
- Arrays vs. hashes
- And especially interesting for me:

  When to use node.run_state instead of an attribute?

  I've seen cookbooks which put every variable in an attribute even if it is used
  only internally. Wouldn't it be better to use node.run_state in this case? At
  least as long as you don't have to store it between Chef runs.

Thanks,
Dennis Benzinger | hybris

--
Dennis Benzinger
IT Architecture Senior Specialist
hybris Cloud Services
dennis.benzinger <at> sap.com

hybris GmbH
Nymphenburger Straße 86
80636 München, Germany
Fax +49 89 890 65 555
www.hybris.com
hybris GmbH, Nymphenburger Str. 86, 80636 München, Deutschland. 
Geschäftsführer: Ariel F. Lüdi, Carsten Thoma, Michael Zips. 
Amtsgericht München, HRB 124384. 

Claire McQuin | 24 Jul 02:03 2015

Released 12.5.0.alpha.1 of chef and chef-config gems

Hi folks,

I have just released 12.5.0.alpha.1 of the chef and chef-config gems. Chef-config 12.5.0.alpha.1 includes changes which are required in upcoming work for Ohai.

- Claire
Go Sato | 23 Jul 13:11 2015
Picon

Using Amazon RDS as Chef Server Backend is supported officially ?

Hi there everyone,

Using Amazon RDS (engine=postgresql) as Chef Server Backend is supported officially ?

I will use Chef Server version 12.


I hope you will be able to provide the information.
Jacobus van Heerden | 23 Jul 11:27 2015

[CHEF]Create random file and assign to a variable in recipe

Good Day

In my recipe I want to create a filename with a random name in say either a ruby block or a bash block. I then want to assign that created filename to a variable and use that variable in the rest of my recipe.

How do I go about doing that?

Regards


Gmane