roles/python_stuff/tasks/main.yaml (view raw)
1- name: Git pull on python repositories
2 become: false
3 git:
4 repo: "{{ git_url }}{{ item }}"
5 dest: "{{ repo_dir }}{{ item }}"
6 update: yes
7 version: master
8 loop: "{{ python_repos }}"
9
10- name: Install python-setuptools
11 community.general.pacman:
12 name: python-setuptools
13 state: present
14
15- name: Install specified python requirements in indicated virtualenv
16 ansible.builtin.pip:
17 requirements: "{{ repo_dir }}{{ item }}/requirements.txt"
18 virtualenv: "{{ repo_dir }}{{ item }}/venv"
19 loop: "{{ python_repos }}"
20
21- name: Create python-meme-bot .env file
22 become: false
23 template:
24 src: templates/.env.j2
25 dest: "{{ repo_dir }}{{ python_meme_bot }}/.env"
26
27- name: Create groupgardenbot .env file
28 become: false
29 template:
30 src: templates/.env2.j2
31 dest: "{{ repo_dir }}{{ groupgardenbot }}/.env"
32
33- name: Create python systemd service files
34 template:
35 src: templates/python.service.j2
36 dest: "/etc/systemd/system/{{ item }}.service"
37 loop: "{{ python_repos }}"
38
39- name: Enable and start python services
40 ansible.builtin.service:
41 name: "{{ item }}"
42 enabled: yes
43 state: started
44 loop: "{{ python_repos }}"