How to make a file executable with Ansible

0 votes

Hi Guys,

I want to make a file executable using the Ansible playbook. Whenever the task runs it will make the file executable. How can I do that?

Sep 16, 2020 in Ansible by akhtar
• 38,240 points
4,292 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the file module in Ansible. This module has an argument named mode. There you can pass your requirement. You can also take help from the below-given code.

- name: Changing perm of "/etc/rc.d/rc.local", adding "+x"
  file:
    dest: /etc/rc.d/rc.local
    mode: a+x

answered Sep 16, 2020 by MD
• 95,380 points

Related Questions In Ansible

0 votes
1 answer

How to use Ansible git module pull a branch with local changes?

You cannot achieve it using the git ...READ MORE

answered Jul 9, 2018 in Ansible by Atul
• 10,230 points
5,492 views
0 votes
1 answer

How to create a new encrpted file using Ansible Vault?

If you are creating a new file ...READ MORE

answered Jan 29, 2019 in Ansible by Kyraa
440 views
0 votes
1 answer

How to move/rename a file using an Ansible task on a remote system?

Hi@akhtar, You can use the command module to ...READ MORE

answered Sep 17, 2020 in Ansible by MD
• 95,380 points
15,137 views
0 votes
1 answer

How to remove duplicate entries from a file using Ansible?

Hi@akhtar, You can use the shell module to do your ...READ MORE

answered Sep 17, 2020 in Ansible by MD
• 95,380 points
2,794 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
2,087 views
+2 votes
1 answer
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,380 points
9,022 views
0 votes
1 answer

How to add multiple lines in a file using Ansible playbook?

Hi@akhtar, You can update your file using lineinfile ...READ MORE

answered Sep 16, 2020 in Ansible by MD
• 95,380 points
15,978 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP