64 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
---
 | 
						|
- 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
 | 
						|
  file:
 | 
						|
    state: directory
 | 
						|
    path: '{{item}}'
 | 
						|
  with_items:
 | 
						|
    - ~/.config
 | 
						|
    - ~/.config/ipython/profile_default
 | 
						|
    - ~/.config/pip
 | 
						|
 | 
						|
- 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.exists and pip_conf.stat.islnk
 | 
						|
  file:
 | 
						|
    state: absent
 | 
						|
    path: ~/.config/pip/pip.conf
 | 
						|
 | 
						|
# 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.exists and 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
 |