From 3200471f682e269657a1b84d8de41e7a96cc99d1 Mon Sep 17 00:00:00 2001 From: pgrondek Date: Tue, 26 May 2020 00:02:14 +0200 Subject: [PATCH] Use block for become --- roles/octoprint/tasks/install.yml | 48 +++++++++++++++---------------- roles/octoprint/tasks/service.yml | 33 +++++++++++---------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/roles/octoprint/tasks/install.yml b/roles/octoprint/tasks/install.yml index e2bd922..ef6d448 100644 --- a/roles/octoprint/tasks/install.yml +++ b/roles/octoprint/tasks/install.yml @@ -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 diff --git a/roles/octoprint/tasks/service.yml b/roles/octoprint/tasks/service.yml index bb27a9d..e85837f 100644 --- a/roles/octoprint/tasks/service.yml +++ b/roles/octoprint/tasks/service.yml @@ -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