diff --git a/roles/pulp3/README.md b/roles/pulp3/README.md index fe378ba6b..e63b7b5c3 100644 --- a/roles/pulp3/README.md +++ b/roles/pulp3/README.md @@ -11,6 +11,8 @@ Role Variables: * `pulp_cache_dir`: Location of Pulp cache. Defaults to "/var/lib/pulp/tmp". * `pulp_config_dir`: Directory which will contain Pulp configuration files. Defaults to "/etc/pulp". +* `pulp_db_type`: Type of db to install packages for. Options are postgres + or mysql. Default is postgres. * `pulp_default_admin_password`: Initial password for the Pulp admin. **Required**. * `pulp_install_dir`: Location of a virtual environment for Pulp and its Python dependencies. Defaults to "/usr/local/lib/pulp". diff --git a/roles/pulp3/defaults/main.yml b/roles/pulp3/defaults/main.yml index 4e1584ba2..d2116f37a 100644 --- a/roles/pulp3/defaults/main.yml +++ b/roles/pulp3/defaults/main.yml @@ -2,6 +2,7 @@ pulp_cache_dir: '/var/lib/pulp/tmp' pulp_config_dir: '/etc/pulp' +pulp_db_type: 'postgres' pulp_default_admin_password: '' pulp_install_dir: '/usr/local/lib/pulp' pulp_install_plugins: {} diff --git a/roles/pulp3/tasks/install.yml b/roles/pulp3/tasks/install.yml index 24adf853c..8b24543f7 100644 --- a/roles/pulp3/tasks/install.yml +++ b/roles/pulp3/tasks/install.yml @@ -66,6 +66,22 @@ virtualenv: '{{ pulp_install_dir }}' virtualenv_command: '{{ pulp_python_interpreter }} -m venv' + - name: Install the psycopg python package + pip: + name: psycopg2-binary + state: present + virtualenv: '{{ pulp_install_dir }}' + virtualenv_command: '{{ pulp_python_interpreter }} -m venv' + when: pulp_db_type == "postgres" + + - name: Install the mysqlclient python package + pip: + name: mysqlclient + state: present + virtualenv: '{{ pulp_install_dir }}' + virtualenv_command: '{{ pulp_python_interpreter }} -m venv' + when: pulp_db_type == "mysql" + - name: Install pulpcore package from source pip: name: '{{ pulp_source_dir }}'