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
8 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,480 points
219 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
44 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
436 views
+13 votes
2 answers
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
52 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.