Question about databags

Heyas, first time posting and recently new chef user (2 days to be exact).

Now im trying to do a deployment of tomcat + apache and since I run
100% RHEL I want the servers to join
groups in the satellite according to my structure. NP I got that part.
But I want to be able to use encrypted databags
to supply the recipe with credentials.
Havnt realy found any good guides how to use databags.
If I put the passwords there in cleartext it works like a charm. Its
no big deal since the user can only add systems to different groups in
satellite. But still I want the passwords hidden =)

Any takers to help me out here or perhaps have a nice databag tutorial
session with me? =)

bash “satellite_group_check” do
# check if in group allready
not_if “/usr/local/bin/rhn-tool -s my.satellite -l
user.to.manage.group -p user.passwrd --list-my-groups | grep Apache”,
:user => ‘root’

	#  Join the correct group
	user "root"
	code <<-EOH
	/usr/local/bin/rhn-tool -s my.satellite -l user.to.manage.group -p

user.passwrd -g Apache
EOH
end

Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT

On Thu, Nov 1, 2012 at 7:17 AM, Jens Skott jens.skott@schibsted.se wrote:

Any takers to help me out here or perhaps have a nice databag tutorial
session with me? =)

Walking through this post is what helped me get encrypted data bags working.
http://jtimberman.housepub.org/blog/2011/08/06/encrypted-data-bag-for-postfix-sasl-authentication/

--
Elliot Murphy

It worked like a charm. The databags works with templates and stuff
but now I want to be able to
use the items in bash.

Added this to my recipie and the test['test1'] and test['test2'] are
from the databag.

Have tried in every different way possble to include the variables in
the bash scrip.

bash "make_test_file" do
not_if "cat /root/test | grep test['test1']", :user => 'root'

	user "root"
	code <<-EOH
	echo test['test1'] test['test2'] >> /root/test
	EOH

end

Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT

2012/11/1 Elliot Murphy elliot.murphy@patdeegan.com:

On Thu, Nov 1, 2012 at 7:17 AM, Jens Skott jens.skott@schibsted.se wrote:

Any takers to help me out here or perhaps have a nice databag tutorial
session with me? =)

Walking through this post is what helped me get encrypted data bags working.
http://jtimberman.housepub.org/blog/2011/08/06/encrypted-data-bag-for-postfix-sasl-authentication/

--
Elliot Murphy

Does #{test['test1']} work?
On Nov 1, 2012 2:11 PM, "Jens Skott" jens.skott@schibsted.se wrote:

It worked like a charm. The databags works with templates and stuff
but now I want to be able to
use the items in bash.

Added this to my recipie and the test['test1'] and test['test2'] are
from the databag.

Have tried in every different way possble to include the variables in
the bash scrip.

bash "make_test_file" do
not_if "cat /root/test | grep test['test1']", :user => 'root'

            user "root"
            code <<-EOH
            echo test['test1'] test['test2'] >> /root/test
            EOH

end

Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT

2012/11/1 Elliot Murphy elliot.murphy@patdeegan.com:

On Thu, Nov 1, 2012 at 7:17 AM, Jens Skott jens.skott@schibsted.se
wrote:

Any takers to help me out here or perhaps have a nice databag tutorial
session with me? =)

Walking through this post is what helped me get encrypted data bags
working.

http://jtimberman.housepub.org/blog/2011/08/06/encrypted-data-bag-for-postfix-sasl-authentication/

--
Elliot Murphy

Because the context is recipe code and not an erb template, I believe you
need to use string interpolation with #{} here.

not_if "cat /root/test | grep #{test['test1']}", :user => 'root'

On Thu, Nov 1, 2012 at 2:11 PM, Jens Skott jens.skott@schibsted.se wrote:

It worked like a charm. The databags works with templates and stuff
but now I want to be able to
use the items in bash.

Added this to my recipie and the test['test1'] and test['test2'] are
from the databag.

Have tried in every different way possble to include the variables in
the bash scrip.

bash "make_test_file" do
not_if "cat /root/test | grep test['test1']", :user => 'root'

            user "root"
            code <<-EOH
            echo test['test1'] test['test2'] >> /root/test
            EOH

end

Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT

2012/11/1 Elliot Murphy elliot.murphy@patdeegan.com:

On Thu, Nov 1, 2012 at 7:17 AM, Jens Skott jens.skott@schibsted.se
wrote:

Any takers to help me out here or perhaps have a nice databag tutorial
session with me? =)

Walking through this post is what helped me get encrypted data bags
working.

http://jtimberman.housepub.org/blog/2011/08/06/encrypted-data-bag-for-postfix-sasl-authentication/

--
Elliot Murphy

--
Elliot Murphy
Pat Deegan PhD & Associates, LLC

Super. Now it works. Thanks so much =)

Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT

2012/11/1 Elliot Murphy elliot.murphy@patdeegan.com:

Because the context is recipe code and not an erb template, I believe you
need to use string interpolation with #{} here.

not_if "cat /root/test | grep #{test['test1']}", :user => 'root'

On Thu, Nov 1, 2012 at 2:11 PM, Jens Skott jens.skott@schibsted.se wrote:

It worked like a charm. The databags works with templates and stuff
but now I want to be able to
use the items in bash.

Added this to my recipie and the test['test1'] and test['test2'] are
from the databag.

Have tried in every different way possble to include the variables in
the bash scrip.

bash "make_test_file" do
not_if "cat /root/test | grep test['test1']", :user => 'root'

            user "root"
            code <<-EOH
            echo test['test1'] test['test2'] >> /root/test
            EOH

end

Jens Skott
Tel: +46-8-5142 4396
Schibsted Centralen IT

2012/11/1 Elliot Murphy elliot.murphy@patdeegan.com:

On Thu, Nov 1, 2012 at 7:17 AM, Jens Skott jens.skott@schibsted.se
wrote:

Any takers to help me out here or perhaps have a nice databag tutorial
session with me? =)

Walking through this post is what helped me get encrypted data bags
working.

http://jtimberman.housepub.org/blog/2011/08/06/encrypted-data-bag-for-postfix-sasl-authentication/

--
Elliot Murphy

--
Elliot Murphy
Pat Deegan PhD & Associates, LLC