Remove python config repo & use templates instead
This commit is contained in:
parent
9bf8c46bb9
commit
947a6f1b87
@ -1,7 +1,13 @@
|
||||
---
|
||||
- name: install config repo
|
||||
git:
|
||||
repo: git@code.infektor.net:config/python.git
|
||||
- name: stat old config repo
|
||||
stat:
|
||||
path: ~/.config/python/.git
|
||||
register: config_python_git
|
||||
|
||||
- name: remove old config repo
|
||||
when: config_python_git.stat.exists
|
||||
file:
|
||||
state: absent
|
||||
dest: ~/.config/python
|
||||
|
||||
- name: create config directories
|
||||
@ -13,41 +19,44 @@
|
||||
- ~/.config/ipython/profile_default
|
||||
- ~/.config/pip
|
||||
|
||||
# Ensure that pip.conf exists before ever installing pip packages since
|
||||
# Debian has enabled `EXTERNALLY-MANAGED` from PEP 668 which breaks `pip
|
||||
# install --user` unless configured otherwise.
|
||||
- name: create symbolic links
|
||||
- name: stat pip.conf
|
||||
stat:
|
||||
path: ~/.config/pip/pip.conf
|
||||
register: pip_conf
|
||||
|
||||
- name: remove pip.conf if its a symbolic link
|
||||
when: pip_conf.stat.islnk
|
||||
file:
|
||||
state: link
|
||||
src: '{{item.src}}'
|
||||
dest: '{{item.dest}}'
|
||||
with_items:
|
||||
- src: ~/.config/python/flake8
|
||||
dest: ~/.config/flake8
|
||||
- src: ~/.config/python/pylintrc
|
||||
dest: ~/.pylintrc
|
||||
- src: ~/.config/python/ipython_config.py
|
||||
dest: ~/.config/ipython/profile_default/ipython_config.py
|
||||
path: ~/.config/pip/pip.conf
|
||||
|
||||
# TODO: remove this symbolic link if it exists, don't remove a regular file
|
||||
# - src: ~/.config/python/pip.conf
|
||||
# dest: ~/.config/pip/pip.conf
|
||||
|
||||
- name: create pip.conf from template
|
||||
# Ensure that pip.conf exists before ever installing pip packages since Debian
|
||||
# has enabled `EXTERNALLY-MANAGED` from PEP 668 which breaks `pip install
|
||||
# --user` unless configured otherwise.
|
||||
- name: create user pip.conf from template
|
||||
template:
|
||||
src: pip.conf.j2
|
||||
dest: ~/.config/pip/pip.conf
|
||||
|
||||
# TODO: Also configure pip to disable `EXTERNALLY-MANAGED` globally?
|
||||
|
||||
- name: stat old ipython_config.py
|
||||
stat:
|
||||
path: ~/.config/ipython/profile_default/ipython_config.py
|
||||
register: ipython_config_py
|
||||
|
||||
- name: remove ipython_conifg.py if its a symbolic link
|
||||
when: ipython_config_py.stat.islnk
|
||||
file:
|
||||
state: absent
|
||||
path: ~/.config/ipython/profile_default/ipython_config.py
|
||||
|
||||
- name: create ipython config from template
|
||||
template:
|
||||
src: ipython_config.py
|
||||
dest: ~/.config/ipython/profile_default/ipython_config.py
|
||||
|
||||
- name: install pip packages
|
||||
pip:
|
||||
name: '{{python_pip_packages}}'
|
||||
state: latest
|
||||
extra_args: --user
|
||||
|
||||
- name: create directories
|
||||
file:
|
||||
state: directory
|
||||
dest: '{{item}}'
|
||||
with_items:
|
||||
- ~/.config/ipython/profile_default
|
||||
- ~/.config/pip
|
||||
|
1
roles/python/templates/ipython_config.py
Normal file
1
roles/python/templates/ipython_config.py
Normal file
@ -0,0 +1 @@
|
||||
c.TerminalInteractiveShell.editing_mode = 'vi'
|
Loading…
x
Reference in New Issue
Block a user