Answer the question
In order to leave comments, you need to log in
How to mark all tasks in playbook to run as superuser?
Greetings.
I am writing my first playbook for Ansible. The task is simple: make sure that the current transmission-daemon is installed, feed it the config assembled from the template, reload it and make sure that it is successfully launched.
The question is how to mark that all tasks in the script must be executed on behalf of the superuser. Now I add become and become_pass keys to each task:
- name: ensure transmission-daemon is up to date
become: true
become_pass: "{{ become_pass }}"
apt:
name: transmission-daemon
state: latest
- name: write transmission config and reload transmission-daemon
become: true
become_pass: "{{ become_pass }}"
template:
src: configs/transmission.j2
dest: /etc/transmission-daemon/settings.json
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question