Use block for become

This commit is contained in:
pgrondek 2020-05-26 00:02:14 +02:00
parent 6b7bb404bd
commit 3200471f68
2 changed files with 40 additions and 41 deletions

View File

@ -1,6 +1,7 @@
--- ---
- name: install needed tools - become: yes
become: yes block:
- name: install needed tools
apt: apt:
update_cache: yes update_cache: yes
pkg: pkg:
@ -12,8 +13,7 @@
- libyaml-dev - libyaml-dev
- build-essential - build-essential
- name: install octoprint software - name: install octoprint software
become: yes
become_user: octoprint become_user: octoprint
shell: shell:
chdir: /home/octoprint chdir: /home/octoprint

View File

@ -1,19 +1,18 @@
--- ---
- name: copy systemd service config - become: yes
become: yes block:
- name: copy systemd service config
copy: copy:
src: octoprint.service src: octoprint.service
dest: /lib/systemd/system/octoprint.service dest: /lib/systemd/system/octoprint.service
- name: enable systemd service - name: enable systemd service
become: yes
systemd: systemd:
name: octoprint name: octoprint
enabled: yes enabled: yes
state: started state: started
- name: enable octoprint to restart itself - name: enable octoprint to restart itself
become: yes
copy: copy:
src: sudoers.conf src: sudoers.conf
dest: /etc/sudoers.d/octoprint dest: /etc/sudoers.d/octoprint