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,26 +1,26 @@
---
- name: install needed tools
become: yes
apt:
update_cache: yes
pkg:
- python-pip
- python-dev
- python-setuptools
- python-virtualenv
- git
- libyaml-dev
- build-essential
- become: yes
block:
- name: install needed tools
apt:
update_cache: yes
pkg:
- python-pip
- python-dev
- python-setuptools
- python-virtualenv
- git
- libyaml-dev
- build-essential
- name: install octoprint software
become: yes
become_user: octoprint
shell:
chdir: /home/octoprint
cmd: |
virtualenv system-site-packages .
source bin/activate
pip install pip --upgrade
pip install octoprint
args:
executable: /bin/bash
- name: install octoprint software
become_user: octoprint
shell:
chdir: /home/octoprint
cmd: |
virtualenv system-site-packages .
source bin/activate
pip install pip --upgrade
pip install octoprint
args:
executable: /bin/bash

View File

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