Convert part of the following chef recipe to Ansible -


i trying convert following chef recipe ansible. equivalent of ?.. familiar ansible. correct there going 3 directories created ?. such /usr/share/agentone/lib ; /usr/share/agentone/etc ; /usr/share/agentone/bin , of them have 0755 mode on ?

 if node[:platform_family] == 'debian'    %w{lib etc bin}.each |dir|     directory "/usr/share/agentone/#{dir}"      mode '0755'      owner 'root'      group 'root'      action :create      recursive true     end   end    directory '/var/log/agentone'   directory 'var/run/agentone'    link '/usr/share/agentone/logs'    '/var/log/agentone'   end    template '/etc/init.d/agentone'     owner 'root'     group 'root'     mode '750'     source 'agentone.init.erb'     variables(       :version => node[:base][:agent][:agent_artifact][:version]      )   end   end  

what best way write in ansible ?

the ansible version of this:

- name: create dirs   file: path=/usr/share/agentone/{{ item }}         state=directory         owner=root         group=root         mode=0755         recurse=true   with_items:       - lib       - etc       - bin   when: ansible_distribution == 'debian' 

edit: respect additional code added:

- name: symlink /usr/share/agentone/logs   file: path=/usr/share/agentone/logs         src=/var/log/agentone         state=link  - name: template /etc/init.d/agentone   template: src=agentone.init.erb             dest=/etc/init.d/agentone             owner=root             group=root             mode=0750 

with respect variables used in template task, need added inventory file, vars file, or anywhere else ansible variables can defined.


Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -