Debug School

Manish Gaur
Manish Gaur

Posted on

Day2 practice

• Write a recipe to create a file which should be owned by group called “root”, user “ec2-user” and permission executable.

user 'ec2-user' do
comment 'ec2 user'
uid 1234
end

group 'root' do
gid '123'
members 'ec2-user'
end

file 'first.txt' do
content 'Hello World'
group 'root'
owner 'ec2-user'
mode '755'
end

• Write a recipe to updates the access (atime) and file modification (mtime) times for a file.

file 'first.txt' do
action :touch
end

• Write a chef recipe to Create a directory

directory '/home/centos/day2/newDir' do
owner 'root'
group 'root'
mode '0755'
action :create
end

• Write a chef recipe to create group and use in linux.

user 'ec2-user' do
comment 'ec2 user'
uid 1234
end

group 'root' do
gid '123'
members 'ec2-user'
end

• Write a chef recipe to create a new user and password in the Nodes automatically?

user 'ec2-user' do
comment 'ec2 user'
uid 1234
end

• Write a chef recipe to install git.

package 'git' do
action :install
end

• Write a chef recipe to add= a message to a log file.

node.default['test']['key']['name'] = 'Dummy Name'

log "Test key name is set as : #{node['test']['key']['name']}" do
level :info
end

Top comments (0)