Re: [ansible-project] Folder Permission for Multiple directories at once

2019-08-07 Thread Sandip Bhattacharya
 Please always share your actual error message to help people helping you.




On August 7, 2019 at 6:23:31 PM, Bishwajit Samanta 
(bishwajitsamanta1...@gmail.com(mailto:bishwajitsamanta1...@gmail.com)) wrote:

> Hi All,  
>  
> I am trying to achieve mentioning multiple directories in var.yml so that in 
> loop i can give them folder permission however it is not working. Can anyone 
> help me here.  
>  
> ---  
> - name: "File List"
> hosts: localhost
> gather_facts: no
> become: yes
> become_user: root
>  
> tasks:  
> - include_vars: var.yml
> - name: "Folder Permission"
> file:
> path: '{{ item }}'
> mode: '{{ folder_perm }}'
> loop: "{{ folder_path }}"
>  
> ignore_errors: true  
> - name: "File Permission"  
> file:
> path: '{{ file_path }}'
> mode: '{{ file_perm }}'
> ignore_errors: true
>  
> vars.yml  
>  
> ---  
> folder_path:  
> - /home/sysops/bishwajit/ansible/folder_perm/
> - /home/sysops/bishwajit/ansible/demo_perm
> - /home/sysops/bishwajit/ansible/sample_perm
> file_path: /home/sysops/bishwajit/ansible/folder_perm/file_perm
> folder_perm: 0755
> file_perm: 0644
>  
>  


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/etPan.5d4b7e4c.2c086b0b.38c%40showmethesource.org.


[ansible-project] Folder Permission for Multiple directories at once

2019-08-07 Thread Bishwajit Samanta
Hi All,

I am trying to achieve mentioning multiple directories in var.yml so that 
in loop i can give them folder permission however it is not working. Can 
anyone help me here.

---
- name: "File List"
hosts: localhost
gather_facts: no
become: yes
become_user: root

tasks:
- include_vars: var.yml
- name: "Folder Permission"
file: 
path: '{{ item }}'
mode: '{{ folder_perm }}'
loop: "{{ folder_path }}"

ignore_errors: true

- name: "File Permission"
file: 
path: '{{ file_path }}'
mode: '{{ file_perm }}'
ignore_errors: true

vars.yml

---

folder_path: 
- /home/sysops/bishwajit/ansible/folder_perm/
- /home/sysops/bishwajit/ansible/demo_perm
- /home/sysops/bishwajit/ansible/sample_perm
file_path: /home/sysops/bishwajit/ansible/folder_perm/file_perm
folder_perm: 0755
file_perm: 0644


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8b8c1fc0-436f-447f-9d78-a847ad77aa90%40googlegroups.com.