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

View File

@ -1,20 +1,19 @@
--- ---
- name: copy systemd service config - become: yes
become: yes block:
copy: - name: copy systemd service config
src: octoprint.service copy:
dest: /lib/systemd/system/octoprint.service src: 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 mode: 0440
mode: 0440