diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index f82148e28..850ff6458 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -5,3 +5,4 @@ - pulp3-workers - pulp3-resource-manager - pulp3-webserver + - pulp3-content diff --git a/roles/pulp3-content/README.md b/roles/pulp3-content/README.md new file mode 100644 index 000000000..7c6909b6c --- /dev/null +++ b/roles/pulp3-content/README.md @@ -0,0 +1,16 @@ +pulp3-content +============= + +Install, configure, and set the state of pulp content app. + +Shared variables: +----------------- + +* `ansible_python_interpreter`: **Required**. Path to the Python interpreter. + +This role **is not tightly coupled** with the `pulp3` role, but it does use some of the same +variables. When used together, the values are inherited from the role. When not used together, +these values are **required**. + +* `pulp_user` +* `pulp_install_dir` diff --git a/roles/pulp3-content/handlers/main.yml b/roles/pulp3-content/handlers/main.yml new file mode 100644 index 000000000..ec9069d9f --- /dev/null +++ b/roles/pulp3-content/handlers/main.yml @@ -0,0 +1,7 @@ +--- +- name: Reload systemd and restart pulp content app + systemd: + daemon_reload: true + name: pulp_content_app.service + state: restarted + become: true diff --git a/roles/pulp3-content/meta/main.yml b/roles/pulp3-content/meta/main.yml new file mode 100644 index 000000000..b9fd61ac7 --- /dev/null +++ b/roles/pulp3-content/meta/main.yml @@ -0,0 +1,11 @@ +--- +galaxy_info: + author: Pulp + description: Pulp content app + company: Red Hat + min_ansible_version: 2.4 + platforms: + - name: Fedora + versions: + - 28 + license: GPL-3.0 diff --git a/roles/pulp3-content/tasks/main.yml b/roles/pulp3-content/tasks/main.yml new file mode 100644 index 000000000..6e82eb467 --- /dev/null +++ b/roles/pulp3-content/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- block: + - name: Install pulp_content_app service file + template: + src: pulp_content_app.service.j2 + dest: /lib/systemd/system/pulp_content_app.service + owner: root + group: root + mode: 0644 + notify: Reload systemd and restart pulp content app + + - name: Set state of pulp content app + systemd: + daemon_reload: true + name: pulp_content_app.service + state: started + enabled: true + become: true diff --git a/roles/pulp3-content/templates/pulp_content_app.service.j2 b/roles/pulp3-content/templates/pulp_content_app.service.j2 new file mode 100644 index 000000000..701be1b27 --- /dev/null +++ b/roles/pulp3-content/templates/pulp_content_app.service.j2 @@ -0,0 +1,21 @@ +[Unit] +Description=Pulp Content App +After=network-online.target +Wants=network-online.target + +# This service will break if left running while PostgreSQL restarts. +BindsTo=postgresql.service +After=postgresql.service + +[Service] +Environment="DJANGO_SETTINGS_MODULE=pulpcore.app.settings" +User={{ pulp_user }} +WorkingDirectory=/var/run/pulp_content_app/ +RuntimeDirectory=pulp_content_app +ExecStart={{ pulp_install_dir }}/bin/gunicorn pulpcore.content:server \ + --bind 'localhost:8080' \ + --worker-class 'aiohttp.GunicornWebWorker' \ + -w 2 + +[Install] +WantedBy=multi-user.target diff --git a/source-install.yml b/source-install.yml index 006483c6d..51722ed21 100644 --- a/source-install.yml +++ b/source-install.yml @@ -24,4 +24,5 @@ - pulp3-workers - pulp3-resource-manager - pulp3-webserver + - pulp3-content - pulp3-devel diff --git a/user-sandbox.yml b/user-sandbox.yml index 6fc23386d..c0b784040 100644 --- a/user-sandbox.yml +++ b/user-sandbox.yml @@ -17,3 +17,4 @@ - pulp3-workers - pulp3-resource-manager - pulp3-webserver + - pulp3-content