From e407cbf02ca25b3d1dd8cfab7d3b24ebb1af1801 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Oct 2018 20:11:51 -0400 Subject: [PATCH 1/5] modified: roles/pyenv/tasks/main.yml modified: roles/pyroscope-cli/defaults/main.yml modified: roles/pyroscope-cli/tasks/cron.yml modified: roles/pyroscope-cli/tasks/main.yml modified: roles/rtorrent-ps/tasks/config.yml modified: roles/rtorrent-ps/tasks/main.yml modified: scripts/install_ansible.sh --- roles/pyenv/tasks/main.yml | 30 +++++++++++++-------------- roles/pyroscope-cli/defaults/main.yml | 2 +- roles/pyroscope-cli/tasks/cron.yml | 8 +++---- roles/pyroscope-cli/tasks/main.yml | 22 ++++++++++---------- roles/rtorrent-ps/tasks/config.yml | 8 +++---- roles/rtorrent-ps/tasks/main.yml | 19 +++++++++-------- scripts/install_ansible.sh | 12 +++++------ 7 files changed, 51 insertions(+), 50 deletions(-) diff --git a/roles/pyenv/tasks/main.yml b/roles/pyenv/tasks/main.yml index b22a533..27fab97 100644 --- a/roles/pyenv/tasks/main.yml +++ b/roles/pyenv/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Create .local directory - file: path=/home/rtorrent/.local state=directory owner=rtorrent group=rtorrent mode=0750 + file: path=/home/{{ rt_user }}/.local state=directory owner={{ rt_user }} group={{ rt_user }} mode=0750 - name: Install build dependencies for pyenv apt: name={{ item }} state=latest @@ -20,18 +20,18 @@ - libncursesw5-dev - name: Probe pyenv checkout - stat: path=/home/rtorrent/.local/pyenv/plugins/pyenv-installer/.gitignore + stat: path=/home/{{ rt_user }}/.local/pyenv/plugins/pyenv-installer/.gitignore register: pyenv_flagfile - name: git clone pyenv project - git: repo=https://github.com/yyuu/pyenv.git dest=/home/rtorrent/.local/pyenv + git: repo=https://github.com/yyuu/pyenv.git dest=/home/{{ rt_user }}/.local/pyenv when: not pyenv_flagfile.stat.exists - name: Create plugins directory - file: path=/home/rtorrent/.local/pyenv/plugins state=directory owner=rtorrent group=rtorrent mode=0750 + file: path=/home/{{ rt_user }}/.local/pyenv/plugins state=directory owner={{ rt_user }} group={{ rt_user }} mode=0750 - name: git clone pyenv plugins - git: repo=https://github.com/yyuu/{{ item }}.git dest=/home/rtorrent/.local/pyenv/plugins/{{ item }} + git: repo=https://github.com/yyuu/{{ item }}.git dest=/home/{{ rt_user }}/.local/pyenv/plugins/{{ item }} when: not pyenv_flagfile.stat.exists with_items: - pyenv-doctor @@ -41,31 +41,31 @@ - pyenv-installer - name: Fix pyenv ownership - file: path=/home/rtorrent/.local/pyenv state=directory recurse=true owner=rtorrent group=rtorrent + file: path=/home/{{ rt_user }}/.local/pyenv state=directory recurse=true owner={{ rt_user }} group={{ rt_user }} when: not pyenv_flagfile.stat.exists - name: Install pyenv activation - copy: src=pyenv.sh dest=/home/rtorrent/.local/profile.d/pyenv.sh owner=rtorrent group=rtorrent mode=0640 + copy: src=pyenv.sh dest=/home/{{ rt_user }}/.local/profile.d/pyenv.sh owner={{ rt_user }} group={{ rt_user }} mode=0640 - name: Probe Python installation - stat: path=/home/rtorrent/.local/pyenv/version + stat: path=/home/{{ rt_user }}/.local/pyenv/version register: pyenv_py_flagfile - name: Install Python - shell: su -c '. .bash_aliases; TMPDIR=$PWD/tmp pyenv install {{ pyenv_python_version }}' rtorrent + shell: su -c '. .bash_aliases; TMPDIR=$PWD/tmp pyenv install {{ pyenv_python_version }}' {{ rt_user }} args: executable: /bin/bash - chdir: /home/rtorrent - creates: "/home/rtorrent/.local/pyenv/versions/{{ pyenv_python_version }}/bin/python" + chdir: /home/{{ rt_user }} + creates: "/home/{{ rt_user }}/.local/pyenv/versions/{{ pyenv_python_version }}/bin/python" when: not pyenv_py_flagfile.stat.exists - name: Install virtualenv and update pip - shell: su -c '.local/pyenv/versions/{{ pyenv_python_version }}/bin/pip install -U pip virtualenv' rtorrent + shell: su -c '.local/pyenv/versions/{{ pyenv_python_version }}/bin/pip install -U pip virtualenv' {{ rt_user }} args: executable: /bin/bash - chdir: /home/rtorrent - creates: "/home/rtorrent/.local/pyenv/versions/{{ pyenv_python_version }}/bin/virtualenv" + chdir: /home/{{ rt_user }} + creates: "/home/{{ rt_user }}/.local/pyenv/versions/{{ pyenv_python_version }}/bin/virtualenv" when: not pyenv_py_flagfile.stat.exists - name: Define global pyenv version - copy: content="{{ pyenv_python_version }}" dest=/home/rtorrent/.local/pyenv/version owner=rtorrent group=rtorrent mode=0640 force=no + copy: content="{{ pyenv_python_version }}" dest=/home/{{ rt_user }}/.local/pyenv/version owner={{ rt_user }} group={{ rt_user }} mode=0640 force=no diff --git a/roles/pyroscope-cli/defaults/main.yml b/roles/pyroscope-cli/defaults/main.yml index 674210f..09d4971 100644 --- a/roles/pyroscope-cli/defaults/main.yml +++ b/roles/pyroscope-cli/defaults/main.yml @@ -1,2 +1,2 @@ pyenv_python_version: 2.7.13 -python_bin: "/home/rtorrent/.local/pyenv/versions/{{ pyenv_python_version }}/bin/python" +python_bin: "/home/{{ rt_user }}/.local/pyenv/versions/{{ pyenv_python_version }}/bin/python" diff --git a/roles/pyroscope-cli/tasks/cron.yml b/roles/pyroscope-cli/tasks/cron.yml index e457146..aa0b360 100644 --- a/roles/pyroscope-cli/tasks/cron.yml +++ b/roles/pyroscope-cli/tasks/cron.yml @@ -1,19 +1,19 @@ --- - name: Install rtorrent cron scripts - copy: src=bin/{{ item }} dest=/home/rtorrent/bin/{{ item }} owner=rtorrent group=rtorrent mode=0750 + copy: src=bin/{{ item }} dest=/home/{{ rt_user }}/bin/{{ item }} owner={{ rt_user }} group={{ rt_user }} mode=0750 with_items: - _cron_autolabel - _cron_rt_invalid_items - _cron_sweep - name: Copy ~/etc config files (once) - copy: src=etc/{{ item }} dest=/home/rtorrent/etc/{{ item }} owner=rtorrent group=rtorrent mode=0640 force=no + copy: src=etc/{{ item }} dest=/home/{{ rt_user }}/etc/{{ item }} owner={{ rt_user }} group={{ rt_user }} mode=0640 force=no with_items: - autolabel_rules - sweep_rules - name: Add rtorrent cron job 'rt_invalid_items' - cron: user=rtorrent minute=*/3 name=rt_invalid_items job="test ! -f ~/NOCRON && test -S ~/rtorrent/.scgi_local && sleep 21 && nice ~/bin/_cron_rt_invalid_items --stop --cron" + cron: user={{ rt_user }} minute=*/3 name=rt_invalid_items job="test ! -f ~/NOCRON && test -S ~/{{ rt_user }}/.scgi_local && sleep 21 && nice ~/bin/_cron_rt_invalid_items --stop --cron" - name: Add rtorrent cron job '_cron_autolabel' - cron: user=rtorrent minute=*/31 name=_cron_autolabel job="test ! -f ~/NOCRON && ~/bin/_cron_autolabel --cron" + cron: user={{ rt_user }} minute=*/31 name=_cron_autolabel job="test ! -f ~/NOCRON && ~/bin/_cron_autolabel --cron" diff --git a/roles/pyroscope-cli/tasks/main.yml b/roles/pyroscope-cli/tasks/main.yml index 0a43170..7d14baf 100644 --- a/roles/pyroscope-cli/tasks/main.yml +++ b/roles/pyroscope-cli/tasks/main.yml @@ -1,11 +1,11 @@ --- - name: Copy profile scripts - copy: src=profile.d/{{ item }} dest=/home/rtorrent/.local/profile.d/{{ item }} owner=rtorrent group=rtorrent mode=0640 + copy: src=profile.d/{{ item }} dest=/home/{{ rt_user }}/.local/profile.d/{{ item }} owner={{ rt_user }} group={{ rt_user }} mode=0640 with_items: - rt-alias.sh - name: Copy helper scripts - copy: src=bin/{{ item }} dest=/home/rtorrent/bin/{{ item }} owner=rtorrent group=rtorrent mode=0750 + copy: src=bin/{{ item }} dest=/home/{{ rt_user }}/bin/{{ item }} owner={{ rt_user }} group={{ rt_user }} mode=0750 with_items: - rt-throttle @@ -33,29 +33,29 @@ - libffi-dev - name: Create PyroScope config dir - file: path=/home/rtorrent/.pyroscope state=directory owner=rtorrent group=rtorrent mode=0750 + file: path=/home/{{ rt_user }}/.pyroscope state=directory owner={{ rt_user }} group={{ rt_user }} mode=0750 - name: Render default configuration files (no overwrite) - template: src="{{ item }}" dest="/home/rtorrent/.pyroscope/{{ item }}" owner=rtorrent group=rtorrent mode=0640 force=no + template: src="{{ item }}" dest="/home/{{ rt_user }}/.pyroscope/{{ item }}" owner={{ rt_user }} group={{ rt_user }} mode=0640 force=no with_items: - config.ini - name: git clone 'pyrocore' - shell: su -c 'git clone https://github.com/pyroscope/pyrocore.git pyroscope' rtorrent + shell: su -c 'git clone https://github.com/pyroscope/pyrocore.git pyroscope' {{ rt_user }} args: executable: /bin/bash - chdir: /home/rtorrent/.local - creates: /home/rtorrent/.local/pyroscope/.gitignore + chdir: /home/{{ rt_user }}/.local + creates: /home/{{ rt_user }}/.local/pyroscope/.gitignore - name: Initial 'pyroscope' installation - shell: su -c './update-to-head.sh {{ python_bin }}' rtorrent + shell: su -c './update-to-head.sh {{ python_bin }}' {{ rt_user }} args: executable: /bin/bash - chdir: /home/rtorrent/.local/pyroscope - creates: /home/rtorrent/.local/pyroscope/bin/pyroadmin + chdir: /home/{{ rt_user }}/.local/pyroscope + creates: /home/{{ rt_user }}/.local/pyroscope/bin/pyroadmin - name: Get PyroScope & Python version - shell: "/home/rtorrent/bin/pyroadmin --version ; /home/rtorrent/.local/pyroscope/bin/python --version 2>&1" + shell: "/home/{{ rt_user }}/bin/pyroadmin --version ; /home/{{ rt_user }}/.local/pyroscope/bin/python --version 2>&1" changed_when: False register: pyro_versions - debug: var=pyro_versions.stdout_lines diff --git a/roles/rtorrent-ps/tasks/config.yml b/roles/rtorrent-ps/tasks/config.yml index 6f5d8d6..e815480 100644 --- a/roles/rtorrent-ps/tasks/config.yml +++ b/roles/rtorrent-ps/tasks/config.yml @@ -1,14 +1,14 @@ - name: Render default configuration and start script - template: src="rtorrent/{{ item.name }}" dest="/home/rtorrent/rtorrent/{{ item.name }}" owner=rtorrent group=rtorrent mode="{{ item.mode }}" force="{{ force_cfg }}" + template: src="rtorrent/{{ item.name }}" dest="/home/{{ rt_user }}/rtorrent/{{ item.name }}" owner={{ rt_user }} group={{ rt_user }} mode="{{ item.mode }}" force="{{ force_cfg }}" with_items: - { name: 'rtorrent.rc', mode: '0640' } - { name: 'start', mode: '0750' } - name: Render default "Local settings" include file - template: src=rtorrent/_rtlocal.rc dest=/home/rtorrent/rtorrent/_rtlocal.rc owner=rtorrent group=rtorrent mode=0640 force=no + template: src=rtorrent/_rtlocal.rc dest=/home/{{ rt_user }}/rtorrent/_rtlocal.rc owner={{ rt_user }} group={{ rt_user }} mode=0640 force=no - name: Render "rtorrent.d" include files - template: src="rtorrent/rtorrent.d/{{ item }}" dest="/home/rtorrent/rtorrent/rtorrent.d/{{ item }}" owner=rtorrent group=rtorrent mode=0640 + template: src="rtorrent/rtorrent.d/{{ item }}" dest="/home/{{ rt_user }}/rtorrent/rtorrent.d/{{ item }}" owner={{ rt_user }} group={{ rt_user }} mode=0640 with_items: - 00-pyrocore.rc - 05-rt-ps-columns.rc @@ -33,4 +33,4 @@ - watch-dirs.rc - name: Create rutorrent include placeholder - copy: content="" dest=/var/torrent/_rutorrent.rc owner=rtorrent group=rtorrent mode=0640 force=no + copy: content="" dest=/var/torrent/_rutorrent.rc owner={{ rt_user }} group={{ rt_user }} mode=0640 force=no diff --git a/roles/rtorrent-ps/tasks/main.yml b/roles/rtorrent-ps/tasks/main.yml index 8263f9c..c048ef6 100644 --- a/roles/rtorrent-ps/tasks/main.yml +++ b/roles/rtorrent-ps/tasks/main.yml @@ -51,15 +51,16 @@ - name: Create rtorrent group group: name=rtorrent state=present + group: name={{ rt_user }} state=present - name: Create rtorrent user - user: name=rtorrent comment="rTorrent Client" group=rtorrent groups=users append=yes shell=/bin/bash + user: name={{ rt_user }} comment="{{ rt_user }} rTorrent" group={{ rt_user }} groups=users append=yes shell=/bin/bash - name: Create rtorrent home directory - file: path=/home/rtorrent state=directory owner=rtorrent group=rtorrent mode=0750 + file: path=/home/{{ rt_user }} state=directory owner={{ rt_user }} group={{ rt_user }} mode=0750 - name: Create rtorrent home subdirs - file: path=/home/rtorrent/{{ item }} state=directory owner=rtorrent group=rtorrent mode=0750 + file: path=/home/{{ rt_user }}/{{ item }} state=directory owner={{ rt_user }} group={{ rt_user }} mode=0750 with_items: - bin - etc @@ -83,28 +84,28 @@ - .local/profile.d - name: Copy rtorrent dot files - copy: src=dotfiles/{{ item.name }} dest=/home/rtorrent/.{{ item.name }} owner=rtorrent group=rtorrent mode=0640 force={{ item.force }} + copy: src=dotfiles/{{ item.name }} dest=/home/{{ rt_user }}/.{{ item.name }} owner={{ rt_user }} group={{ rt_user }} mode=0640 force={{ item.force }} with_items: - { name: bash_aliases, force: yes } - { name: tmux.conf, force: no } - name: Copy rtorrent scripts - copy: src=bin/{{ item }} dest=/home/rtorrent/bin/{{ item }} owner=rtorrent group=rtorrent mode=0750 + copy: src=bin/{{ item }} dest=/home/{{ rt_user }}/bin/{{ item }} owner={{ rt_user }} group={{ rt_user }} mode=0750 with_items: - _event.download.finished - name: Render rtorrent bash helpers - template: src=bin/{{ item }} dest=/home/rtorrent/bin/{{ item }} owner=rtorrent group=rtorrent mode=0640 + template: src=bin/{{ item }} dest=/home/{{ rt_user }}/bin/{{ item }} owner={{ rt_user }} group={{ rt_user }} mode=0640 with_items: - _tools.sh - name: Create rtorrent /var symlink - file: src=/home/rtorrent/rtorrent path=/var/torrent state=link + file: src=/home/{{ rt_user }}/rtorrent path=/var/torrent state=link - include: config.yml - name: Install initial rtorrent crontab - copy: src=crontab dest=/var/spool/cron/crontabs/rtorrent owner=rtorrent group=crontab mode=0600 force=no + copy: src=crontab dest=/var/spool/cron/crontabs/{{ rt_user }} owner={{ rt_user }} group=crontab mode=0600 force=no - name: Add rtorrent cron job 'rt_backup_session' - cron: user=rtorrent minute=7 hour=0 name=rt_backup_session job="test ! -f ~/NOCRON && cd /var/torrent && tar cfz \"backups/session-$(date +'\%u').tgz\" .session/" + cron: user={{ rt_user }} minute=7 hour=0 name=rt_backup_session job="test ! -f ~/NOCRON && cd /var/torrent && tar cfz \"backups/session-$(date +'\%u').tgz\" .session/" diff --git a/scripts/install_ansible.sh b/scripts/install_ansible.sh index deec110..feb92bf 100755 --- a/scripts/install_ansible.sh +++ b/scripts/install_ansible.sh @@ -9,23 +9,23 @@ python="/usr/bin/python2" # just to make sure you have the packages you need echo "*** Checking build essentials" test -f "/usr/share/build-essential/essential-packages-list" \ - || sudo apt-get install build-essential + || sudo apt-get install -y build-essential echo "*** Checking curl" -which curl >/dev/null 2>&1 || sudo apt-get install curl +which curl >/dev/null 2>&1 || sudo apt-get install -y curl echo "*** Checking virtualenv" -which virtualenv >/dev/null 2>&1 || sudo apt-get install python-virtualenv +which virtualenv >/dev/null 2>&1 || sudo apt-get install -y python-virtualenv echo "*** Checking Python development support" -test -f "/usr/bin/python-config" || sudo apt-get install python-dev +test -f "/usr/bin/python-config" || sudo apt-get install -y python-dev echo "*** Checking ffi-dev" -test -f "/usr/share/man/man3/ffi.3.gz" || sudo apt-get install libffi-dev +test -f "/usr/share/man/man3/ffi.3.gz" || sudo apt-get install -y libffi-dev echo "*** Checking openssl-dev" test -f "/usr/include/openssl/opensslconf.h" -o -f "/usr/include/openssl/conf.h" \ - || sudo apt-get install libssl-dev + || sudo apt-get install -y libssl-dev # install Ansible From 986624efc665fb2f6194b5ca115ecc2e41fe649c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Oct 2018 22:05:43 -0400 Subject: [PATCH 2/5] modified: docs/advanced.rst modified: roles/flexget/defaults/main.yml modified: roles/flexget/tasks/main.yml modified: roles/rtorrent-ps/defaults/main.yml modified: roles/rutorrent/tasks/main.yml modified: roles/rutorrent/templates/_rutorrent.rc modified: roles/rutorrent/templates/fpm-rutorrent.conf --- docs/advanced.rst | 18 +++++++++--------- roles/flexget/defaults/main.yml | 2 +- roles/flexget/tasks/main.yml | 10 +++++----- roles/rtorrent-ps/defaults/main.yml | 2 +- roles/rutorrent/tasks/main.yml | 4 ++-- roles/rutorrent/templates/_rutorrent.rc | 2 +- roles/rutorrent/templates/fpm-rutorrent.conf | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index dcbdfc1..560d884 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -145,17 +145,17 @@ Implementation Details Location of Configuration Files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- ``/home/rtorrent/rtorrent/rtorrent.rc`` – Main *rTorrent* +- ``/home/{{ rt_user }}/rtorrent/rtorrent.rc`` – Main *rTorrent* configuration file; to update it from this repository use ``-e force_cfg=yes``, see :doc:`setup` for details. -- ``/home/rtorrent/rtorrent/_rtlocal.rc`` – *rTorrent* configuration +- ``/home/{{ rt_user }}/rtorrent/_rtlocal.rc`` – *rTorrent* configuration include for custom modifications, this is *never* overwritten once it exists. -- ``/home/rtorrent/.pyroscope/config.ini`` – ``pyrocore`` main +- ``/home/{{ rt_user }}/.pyroscope/config.ini`` – ``pyrocore`` main configuration. -- ``/home/rtorrent/.pyroscope/config.py`` – ``pyrocore`` custom field +- ``/home/{{ rt_user }}/.pyroscope/config.py`` – ``pyrocore`` custom field configuration. -- ``/home/rtorrent/.config/flexget/config.yml`` – *FlexGet* +- ``/home/{{ rt_user }}/.config/flexget/config.yml`` – *FlexGet* configuration. - ``/home/rutorrent/ruTorrent-master/conf/config.php`` – *ruTorrent* configuration. @@ -170,13 +170,13 @@ Location of Configuration Files Location of Installed Software ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- ``/home/rtorrent/.local/profile.d/`` — Directory with shell scripts +- ``/home/{{ rt_user }}/.local/profile.d/`` — Directory with shell scripts that get sourced in ``~rtorrrent/.bash_aliases``. -- ``/home/rtorrent/.local/pyenv/`` — Unless you chose to use the +- ``/home/{{ rt_user }}/.local/pyenv/`` — Unless you chose to use the system's *Python*, the interpreter used to run ``pyrocore`` and ``flexget`` is installed here. -- ``/home/rtorrent/.local/pyroscope`` — Virtualenv for ``pyrocore``. -- ``/home/rtorrent/.local/flexget`` — Virtualenv for ``flexget``. +- ``/home/{{ rt_user }}/.local/pyroscope`` — Virtualenv for ``pyrocore``. +- ``/home/{{ rt_user }}/.local/flexget`` — Virtualenv for ``flexget``. - ``/home/rutorrent/ruTorrent-master`` — *ruTorrent* code base. diff --git a/roles/flexget/defaults/main.yml b/roles/flexget/defaults/main.yml index 016ea59..9ba5886 100644 --- a/roles/flexget/defaults/main.yml +++ b/roles/flexget/defaults/main.yml @@ -1,3 +1,3 @@ flexget_enabled: false pyenv_python_version: 2.7.13 -venv_bin: "/home/rtorrent/.local/pyenv/versions/{{ pyenv_python_version }}/bin/virtualenv" +venv_bin: "/home/{{ rt_user }}/.local/pyenv/versions/{{ pyenv_python_version }}/bin/virtualenv" diff --git a/roles/flexget/tasks/main.yml b/roles/flexget/tasks/main.yml index 9b18f47..e91e1d4 100644 --- a/roles/flexget/tasks/main.yml +++ b/roles/flexget/tasks/main.yml @@ -4,23 +4,23 @@ args: executable: /bin/bash chdir: /home/rtorrent - creates: /home/rtorrent/.local/flexget/bin/pip + creates: /home/{{ rt_user }}/.local/flexget/bin/pip - name: Install FlexGet shell: su -c '.local/flexget/bin/pip install flexget' rtorrent args: executable: /bin/bash chdir: /home/rtorrent - creates: /home/rtorrent/.local/flexget/bin/flexget + creates: /home/{{ rt_user }}/.local/flexget/bin/flexget - name: Create flexget ~/bin symlink - file: src=../.local/flexget/bin/flexget path=/home/rtorrent/bin/flexget state=link owner=rtorrent group=rtorrent + file: src=../.local/flexget/bin/flexget path=/home/{{ rt_user }}/bin/flexget state=link owner={{ rt_user }}/ group={{ rt_user }}/ - name: Create default FlexGet config (so --help works) - copy: content="" dest=/home/rtorrent/.local/flexget/config.yml owner=rtorrent group=rtorrent mode=0640 force=no + copy: content="" dest=/home/{{ rt_user }}/.local/flexget/config.yml owner={{ rt_user }}/ group={{ rt_user }}/ mode=0640 force=no - name: Create FlexGet config dir - file: path=/home/rtorrent/.config/flexget state=directory owner=rtorrent group=rtorrent mode=0750 + file: path=/home/{{ rt_user }}/.config/flexget state=directory owner={{ rt_user }}/ group={{ rt_user }}/ mode=0750 - name: Add FlexGet cron job cron: user=rtorrent minute=*/11 name=flexget job="test ! -f ~/NOCRON && test -f ~/.config/flexget/config.yml && sleep 11 && nice ~/bin/flexget -c ~/.config/flexget/config.yml --cron execute >~/.config/flexget/flexget-cron.log 2>&1" diff --git a/roles/rtorrent-ps/defaults/main.yml b/roles/rtorrent-ps/defaults/main.yml index e797226..a1ac7d1 100644 --- a/roles/rtorrent-ps/defaults/main.yml +++ b/roles/rtorrent-ps/defaults/main.yml @@ -1,5 +1,5 @@ force_cfg: no -main_rtrc_file: /home/rtorrent/rtorrent/rtorrent.rc +main_rtrc_file: /home/{{ rt_user }}/rtorrent/rtorrent.rc rutorrent_rtrc_file: "{{ main_rtrc_file }}" rtorrent_bindir: /opt/rtorrent/bin/ diff --git a/roles/rutorrent/tasks/main.yml b/roles/rutorrent/tasks/main.yml index eda3f45..e0aef89 100644 --- a/roles/rutorrent/tasks/main.yml +++ b/roles/rutorrent/tasks/main.yml @@ -30,7 +30,7 @@ - include: install.yml - name: Render rutorrent include for rtorrent - template: src=_rutorrent.rc dest=/var/torrent/_rutorrent.rc owner=rtorrent group=rtorrent mode=0640 force=yes + template: src=_rutorrent.rc dest=/var/torrent/_rutorrent.rc owner={{ rt_user }}/ group={{ rt_user }}/ mode=0640 force=yes - name: Set ruTorrent config values lineinfile: @@ -73,7 +73,7 @@ register: avconv_bin - name: Create ffmpeg to avconv symlink - file: src=/usr/bin/avconv path=/home/rtorrent/bin/ffmpeg state=link owner=rtorrent group=rtorrent + file: src=/usr/bin/avconv path=/home/{{ rt_user }}/bin/ffmpeg state=link owner={{ rt_user }}/ group={{ rt_user }}/ when: "( av_tool is not defined or av_tool != 'ffmpeg' ) and avconv_bin.stat.exists" - include: fpm.yml diff --git a/roles/rutorrent/templates/_rutorrent.rc b/roles/rutorrent/templates/_rutorrent.rc index 738da06..a059abb 100644 --- a/roles/rutorrent/templates/_rutorrent.rc +++ b/roles/rutorrent/templates/_rutorrent.rc @@ -5,5 +5,5 @@ # This file is included by the main "rtorrent.rc" and initializes ruTorrent! execute.throw = {sh, -c,\ - export PATH=/home/rtorrent/bin:/home/rutorrent/bin:/usr/local/bin:/usr/bin:/bin ;\ + export PATH=/home/{{ rt_user }}/bin:/home/rutorrent/bin:/usr/local/bin:/usr/bin:/bin ;\ /usr/bin/php /usr/share/nginx/htdocs/rutorrent/php/initplugins.php {{ rutorrent_www_user }} &} diff --git a/roles/rutorrent/templates/fpm-rutorrent.conf b/roles/rutorrent/templates/fpm-rutorrent.conf index 2832126..7f4e9ea 100644 --- a/roles/rutorrent/templates/fpm-rutorrent.conf +++ b/roles/rutorrent/templates/fpm-rutorrent.conf @@ -17,4 +17,4 @@ pm.min_spare_servers = 1 pm.max_spare_servers = 3 php_admin_value[memory_limit] = {{ rutorrent_php_memory_limit }} chdir = /home/rutorrent/profile -env[PATH] = /home/rutorrent/bin:/home/rtorrent/bin:/usr/local/bin:/usr/bin:/bin +env[PATH] = /home/rutorrent/bin:/home/{{ rt_user }}/bin:/usr/local/bin:/usr/bin:/bin From bc47a9dc7563a103f6439705f4b42a53caffdb25 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Oct 2018 22:07:56 -0400 Subject: [PATCH 3/5] modified: roles/flexget/tasks/main.yml modified: roles/rtorrent-ps/files/crontab --- roles/flexget/tasks/main.yml | 4 ++-- roles/rtorrent-ps/files/crontab | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/flexget/tasks/main.yml b/roles/flexget/tasks/main.yml index e91e1d4..7c88990 100644 --- a/roles/flexget/tasks/main.yml +++ b/roles/flexget/tasks/main.yml @@ -3,14 +3,14 @@ shell: su -c '{{ venv_bin }} .local/flexget' rtorrent args: executable: /bin/bash - chdir: /home/rtorrent + chdir: /home/{{ rt_user }} creates: /home/{{ rt_user }}/.local/flexget/bin/pip - name: Install FlexGet shell: su -c '.local/flexget/bin/pip install flexget' rtorrent args: executable: /bin/bash - chdir: /home/rtorrent + chdir: /home/{{ rt_user }} creates: /home/{{ rt_user }}/.local/flexget/bin/flexget - name: Create flexget ~/bin symlink diff --git a/roles/rtorrent-ps/files/crontab b/roles/rtorrent-ps/files/crontab index 42e8722..bb8749b 100644 --- a/roles/rtorrent-ps/files/crontab +++ b/roles/rtorrent-ps/files/crontab @@ -15,7 +15,7 @@ CRON=true MAILTO=root@localhost -HOME=/home/rtorrent +HOME=/home/{{ rt_user }} LANG=en_US.UTF-8 PATH=$HOME/bin:/usr/bin:/usr/local/bin:/bin From 3325666aeea0cd57d8e2df52cbb05c81bcac93ae Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Oct 2018 22:10:33 -0400 Subject: [PATCH 4/5] modified: docs/advanced.rst modified: roles/flexget/tasks/main.yml --- docs/advanced.rst | 4 ++-- roles/flexget/tasks/main.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index 560d884..f8ef8da 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -46,7 +46,7 @@ rTorrent, for all hosts in your inventory: .. code-block:: console - $ ansible box -f4 --become-user=rtorrent -a "~/bin/rtxmlrpc view.size '' default" -o + $ ansible box -f4 --become-user={{ rt_user }}/ -a "~/bin/rtxmlrpc view.size '' default" -o my-box | success | rc=0 | (stdout) 42 my-box2 | success | rc=0 | (stdout) 123 @@ -56,7 +56,7 @@ this: .. code-block:: shell ansible box -f4 -a "sudo -i -u rtorrent -- ~rtorrent/.local/pyroscope/update-to-head.sh" - ansible box -f4 --become-user=rtorrent -a "~/bin/pyroadmin --version" -o + ansible box -f4 --become-user={{ rt_user }}/ -a "~/bin/pyroadmin --version" -o This is especially useful if you control more than one host. diff --git a/roles/flexget/tasks/main.yml b/roles/flexget/tasks/main.yml index 7c88990..8e18c00 100644 --- a/roles/flexget/tasks/main.yml +++ b/roles/flexget/tasks/main.yml @@ -23,4 +23,4 @@ file: path=/home/{{ rt_user }}/.config/flexget state=directory owner={{ rt_user }}/ group={{ rt_user }}/ mode=0750 - name: Add FlexGet cron job - cron: user=rtorrent minute=*/11 name=flexget job="test ! -f ~/NOCRON && test -f ~/.config/flexget/config.yml && sleep 11 && nice ~/bin/flexget -c ~/.config/flexget/config.yml --cron execute >~/.config/flexget/flexget-cron.log 2>&1" + cron: user={{ rt_user }}/ minute=*/11 name=flexget job="test ! -f ~/NOCRON && test -f ~/.config/flexget/config.yml && sleep 11 && nice ~/bin/flexget -c ~/.config/flexget/config.yml --cron execute >~/.config/flexget/flexget-cron.log 2>&1" From 7aeb666cd53f89e18ab1a31d00da044c15fd33f4 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Oct 2018 22:16:50 -0400 Subject: [PATCH 5/5] modified: docs/advanced.rst modified: roles/flexget/tasks/main.yml --- docs/advanced.rst | 4 ++-- roles/flexget/tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index f8ef8da..76944fe 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -55,7 +55,7 @@ this: .. code-block:: shell - ansible box -f4 -a "sudo -i -u rtorrent -- ~rtorrent/.local/pyroscope/update-to-head.sh" + ansible box -f4 -a "sudo -i -u {{ rt_user }} -- ~rtorrent/.local/pyroscope/update-to-head.sh" ansible box -f4 --become-user={{ rt_user }}/ -a "~/bin/pyroadmin --version" -o This is especially useful if you control more than one host. @@ -110,7 +110,7 @@ added to ``~rtorrent/.netrc``, like this: .. code-block:: ini machine localhost - login rtorrent + login {{ rt_user }} password YOUR_PWD Make sure to call ``chmod 0600 ~/.netrc`` after creating the file. diff --git a/roles/flexget/tasks/main.yml b/roles/flexget/tasks/main.yml index 8e18c00..580802f 100644 --- a/roles/flexget/tasks/main.yml +++ b/roles/flexget/tasks/main.yml @@ -1,13 +1,13 @@ --- - name: Create FlexGet virtualenv - shell: su -c '{{ venv_bin }} .local/flexget' rtorrent + shell: su -c '{{ venv_bin }} .local/flexget' {{ rt_user }} args: executable: /bin/bash chdir: /home/{{ rt_user }} creates: /home/{{ rt_user }}/.local/flexget/bin/pip - name: Install FlexGet - shell: su -c '.local/flexget/bin/pip install flexget' rtorrent + shell: su -c '.local/flexget/bin/pip install flexget' {{ rt_user }} args: executable: /bin/bash chdir: /home/{{ rt_user }}