diff --git a/main.yaml b/main.yaml index c1d598a..02fc203 100644 --- a/main.yaml +++ b/main.yaml @@ -15,4 +15,5 @@ roles: - role: neovim - role: git + - role: python - role: autohotkey diff --git a/roles/python/tasks/Darwin.yaml b/roles/python/tasks/Darwin.yaml new file mode 100644 index 0000000..d6d335b --- /dev/null +++ b/roles/python/tasks/Darwin.yaml @@ -0,0 +1,6 @@ +--- +- name: install homebrew packages + homebrew: + name: + - python + state: latest diff --git a/roles/python/tasks/Debian.yaml b/roles/python/tasks/Debian.yaml new file mode 100644 index 0000000..9a458b3 --- /dev/null +++ b/roles/python/tasks/Debian.yaml @@ -0,0 +1,8 @@ +--- +- name: install apt packages + apt: + name: + - python3 + - python3-pip + - python3-virtualenv + - python-is-python3 diff --git a/roles/python/tasks/Windows.yaml b/roles/python/tasks/Windows.yaml new file mode 100644 index 0000000..8d31f66 --- /dev/null +++ b/roles/python/tasks/Windows.yaml @@ -0,0 +1,13 @@ +--- +- name: install chocolatey packages + win_chocolatey: + name: + - python + state: latest + +# TODO: - name: install config repo +# TODO: - name: set repo email +# TODO: - name: install pip packages +# TODO: - name: create config directories/files + +# TODO: https://docs.python.org/3/using/windows.html#removing-the-max-path-limitation diff --git a/roles/python/tasks/main.yaml b/roles/python/tasks/main.yaml index 31040e2..d78b78e 100644 --- a/roles/python/tasks/main.yaml +++ b/roles/python/tasks/main.yaml @@ -1,44 +1,5 @@ --- -- name: install config repo - git: - repo: git@code.infektor.net:config/python.git - dest: ~/.config/python +- include_tasks: '{{ansible_os_family}}.yaml' -# TODO: set repo email - -- name: install pip packages - pip: - name: - - flake8 - - grip - - ipdb - - ipython - - isort - - pylint - - python-gist - - yapf - state: latest - extra_args: --user - -- name: create directories - file: - state: directory - dest: '{{item}}' - with_items: - - ~/.config/ipython/profile_default - - ~/.config/pip - -- name: create symbolic links - 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 - - src: ~/.config/python/pip.conf - dest: ~/.config/pip/pip.conf +- include_tasks: 'unix.yaml' + when: ansible_os_family != "Windows" diff --git a/roles/python/tasks/unix.yaml b/roles/python/tasks/unix.yaml new file mode 100644 index 0000000..a17c60c --- /dev/null +++ b/roles/python/tasks/unix.yaml @@ -0,0 +1,36 @@ +--- +- name: install config repo + git: + repo: git@code.infektor.net:config/python.git + dest: ~/.config/python + +# TODO: set repo email + +- 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 + +- name: create symbolic links + 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 + - src: ~/.config/python/pip.conf + dest: ~/.config/pip/pip.conf diff --git a/roles/python/vars/main.yaml b/roles/python/vars/main.yaml new file mode 100644 index 0000000..04cfeb4 --- /dev/null +++ b/roles/python/vars/main.yaml @@ -0,0 +1,10 @@ +--- +python_pip_packages: + - flake8 + - grip + - ipdb + - ipython + - isort + - pylint + - python-gist + - yapf