Remove python config repo & use templates instead
This commit is contained in:
parent
9bf8c46bb9
commit
947a6f1b87
@ -1,7 +1,13 @@
|
|||||||
---
|
---
|
||||||
- name: install config repo
|
- name: stat old config repo
|
||||||
git:
|
stat:
|
||||||
repo: git@code.infektor.net:config/python.git
|
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
|
dest: ~/.config/python
|
||||||
|
|
||||||
- name: create config directories
|
- name: create config directories
|
||||||
@ -13,41 +19,44 @@
|
|||||||
- ~/.config/ipython/profile_default
|
- ~/.config/ipython/profile_default
|
||||||
- ~/.config/pip
|
- ~/.config/pip
|
||||||
|
|
||||||
# Ensure that pip.conf exists before ever installing pip packages since
|
- name: stat pip.conf
|
||||||
# Debian has enabled `EXTERNALLY-MANAGED` from PEP 668 which breaks `pip
|
stat:
|
||||||
# install --user` unless configured otherwise.
|
path: ~/.config/pip/pip.conf
|
||||||
- name: create symbolic links
|
register: pip_conf
|
||||||
|
|
||||||
|
- name: remove pip.conf if its a symbolic link
|
||||||
|
when: pip_conf.stat.islnk
|
||||||
file:
|
file:
|
||||||
state: link
|
path: ~/.config/pip/pip.conf
|
||||||
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
|
|
||||||
|
|
||||||
# TODO: remove this symbolic link if it exists, don't remove a regular file
|
# Ensure that pip.conf exists before ever installing pip packages since Debian
|
||||||
# - src: ~/.config/python/pip.conf
|
# has enabled `EXTERNALLY-MANAGED` from PEP 668 which breaks `pip install
|
||||||
# dest: ~/.config/pip/pip.conf
|
# --user` unless configured otherwise.
|
||||||
|
- name: create user pip.conf from template
|
||||||
- name: create pip.conf from template
|
|
||||||
template:
|
template:
|
||||||
src: pip.conf.j2
|
src: pip.conf.j2
|
||||||
dest: ~/.config/pip/pip.conf
|
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
|
- name: install pip packages
|
||||||
pip:
|
pip:
|
||||||
name: '{{python_pip_packages}}'
|
name: '{{python_pip_packages}}'
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: --user
|
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