diff --git a/roles/rproxy/tasks/dirs.yml b/roles/rproxy/tasks/dirs.yml index dffb35d..8f8752e 100644 --- a/roles/rproxy/tasks/dirs.yml +++ b/roles/rproxy/tasks/dirs.yml @@ -14,6 +14,36 @@ path: "{{ repo_data_dir }}" state: directory +- name: "Create {{ repo_data_dir }}/archive" + ansible.builtin.file: + path: "{{ repo_data_dir }}/archive" + state: directory + +- name: "Create {{ repo_data_dir }}/pip" + ansible.builtin.file: + path: "{{ repo_data_dir }}/pip" + state: directory + +- name: "Create {{ repo_data_dir }}/pip/py3" + ansible.builtin.file: + path: "{{ repo_data_dir }}/pip/py3" + state: directory + +- name: "Create {{ repo_data_dir }}/repo" + ansible.builtin.file: + path: "{{ repo_data_dir }}/repo" + state: directory + +- name: "Create {{ repo_data_dir }}/repo/almalinux" + ansible.builtin.file: + path: "{{ repo_data_dir }}/repo/almalinux" + state: directory + +- name: "Create {{ repo_data_dir }}/repo/almalinux/10" + ansible.builtin.file: + path: "{{ repo_data_dir }}/repo/almalinux/10" + state: directory + - name: Create sites dir ansible.builtin.file: path: "{{ rproxy_dir }}/sites" diff --git a/roles/rproxy/tasks/main.yml b/roles/rproxy/tasks/main.yml index 701c44c..d1bfbb3 100644 --- a/roles/rproxy/tasks/main.yml +++ b/roles/rproxy/tasks/main.yml @@ -17,4 +17,8 @@ - name: Repository install ansible.builtin.include_tasks: - file: repo.yml \ No newline at end of file + file: repo.yml + +- name: Pypi repository install + ansible.builtin.include_tasks: + file: pypi.yml \ No newline at end of file diff --git a/roles/rproxy/tasks/pypi.yml b/roles/rproxy/tasks/pypi.yml new file mode 100644 index 0000000..61c81f8 --- /dev/null +++ b/roles/rproxy/tasks/pypi.yml @@ -0,0 +1,17 @@ +--- +- name: Install pypi-server + ansible.builtin.pip: + name: + - pypiserver + +- name: Copy pypi-server service file + ansible.builtin.template: + src: "templates/pypiserver.service.j2" + dest: "/etc/systemd/system/pypiserver.service" + +- name: Enable pypiserver service + ansible.builtin.systemd: + name: "pypiserver.service" + state: started + enabled: yes + daemon_reload: yes \ No newline at end of file diff --git a/roles/rproxy/templates/pypiserver.service.j2 b/roles/rproxy/templates/pypiserver.service.j2 new file mode 100644 index 0000000..e79ca9d --- /dev/null +++ b/roles/rproxy/templates/pypiserver.service.j2 @@ -0,0 +1,17 @@ +[Unit] +Description=PyPI Server (pypiserver) +After=network.target +Wants=network.target + +[Service] +Type=simple +WorkingDirectory={{ repo_data_dir }}/pip/py3 +ExecStart=/usr/bin/python3 -m pypiserver -p 10000 -o {{ repo_data_dir }}/pip/py3 +Restart=always +RestartSec=5 +StandardOutput=journal +StandardError=journal +ReadWriteDirectories={{ repo_data_dir }}/pip/py3 + +[Install] +WantedBy=multi-user.target