How do I enable sudo privileges in the playbook?

0 votes
How do I enable sudo privileges for a task in the playbook?
Mar 6 in Ansible by Kiran
27 views

1 answer to this question.

0 votes

Hey @Kiran, to set enable mode for all tasks in a single play, add become at the play level:

- hosts: eos-switches
  become: yes
  become_method: enable
  tasks:
    - name: Gather facts (eos)
      eos_facts:
        gather_subset:
          - "!hardware"
answered Mar 6 by Yogesh

Related Questions In Ansible

0 votes
1 answer

How do I execute a shell script and then use the result in ansible

This can work out for you: - name: ...READ MORE

answered Apr 11, 2018 in Ansible by shubham
• 6,890 points
1,577 views
0 votes
1 answer
0 votes
1 answer

How do I add ssh authorized keys in ansible playbook?

Hey @kailash use the authorized_key plugin that ...READ MORE

answered Feb 11 in Ansible by Kyra
148 views
0 votes
2 answers

How do you stop Ansible from creating .retry files in the home directory?

[defaults] ... retry_files_enabled = True # Create them ...READ MORE

answered Apr 5 in Ansible by anonymous
780 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
186 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I enable cache plugin in Ansible?

Hey @Jason, You can enable a cache plugin ...READ MORE

answered Feb 19 in Ansible by Yogesh
89 views