Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: Pulp 2 stops working after installing Pulp 3 #128

Merged
merged 1 commit into from Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions roles/pulp-database/tasks/main.yml
Expand Up @@ -35,7 +35,7 @@
name: '{{ result.files[0].path }}/site-packages/pulpcore/app/migrations'
state: directory
owner: '{{ pulp_user }}'
group: '{{ pulp_user }}'
group: '{{ pulp_group }}'
mode: 0700
when: pulp_source_dir is undefined

Expand All @@ -44,7 +44,7 @@
name: '{{ result.files[0].path }}/site-packages/{{ item }}/app/migrations'
state: directory
owner: '{{ pulp_user }}'
group: '{{ pulp_user }}'
group: '{{ pulp_group }}'
mode: 0700
with_items: "{{ pulp_install_plugins }}"
when: pulp_install_plugins[item].source_dir is undefined
Expand Down
2 changes: 1 addition & 1 deletion roles/pulp-database/vars/main.yml
Expand Up @@ -3,7 +3,7 @@

postgresql_databases:
- name: '{{ merged_pulp_settings.databases.default.NAME }}'
owner: '{{ merged_pulp_settings.databases.default.NAME }}'
owner: '{{ merged_pulp_settings.databases.default.USER }}'

postgresql_users:
- name: '{{ merged_pulp_settings.databases.default.USER }}'
Expand Down
1 change: 1 addition & 0 deletions roles/pulp-workers/templates/pulp-worker@.service.j2
Expand Up @@ -8,6 +8,7 @@ EnvironmentFile=-/etc/default/pulp-workers
EnvironmentFile=-/etc/default/pulp-workers-%i
Environment="DJANGO_SETTINGS_MODULE=pulpcore.app.settings"
User={{ pulp_user }}
Group={{ pulp_group }}
WorkingDirectory=/var/run/pulp-worker-%i/
RuntimeDirectory=pulp-worker-%i
ExecStart={{ pulp_install_dir }}/bin/rq worker \
Expand Down
5 changes: 5 additions & 0 deletions roles/pulp/README.md
Expand Up @@ -29,6 +29,11 @@ Role Variables:
* `pulp_source_dir`: Optional. Absolute path to Pulp source code. If present, Pulp
will be installed from source in editable mode.
* `pulp_user`: User that owns and runs Pulp. Defaults to "pulp".
* `pulp_user_id`: Integer value of uid for the `pulp_user`. Defaults to nothing and uid is assigned
by the system.
* `pulp_group`: The group that the `pulp_user` belongs to. Defaults to `pulp`.
* `pulp_group_id`: Integer value of gid for the `pulp_group`. Defaults to nothing and gid is
assigned by the system.
* `pulp_use_system_wide_pkgs` Use python system-wide packages. Defaults to "false".
* `pulp_remote_user_environ_name` Optional. Set the `REMOTE_USER_ENVIRON_NAME` setting for Pulp.
This variable will be set as the value of `CONTENT_HOST` as the base path to build content URLs.
Expand Down
3 changes: 3 additions & 0 deletions roles/pulp/defaults/main.yml
Expand Up @@ -8,6 +8,9 @@ pulp_install_dir: '/usr/local/lib/pulp'
pulp_install_plugins: {}
pulp_install_api_service: true
pulp_user: pulp
pulp_user_id:
pulp_group: pulp
pulp_group_id:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add these to the role README.

Also, what is the behavior when blank like this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior is that the operating system assigns the UID. However, if it is provided, that number will be used. unless it's taken and tehn an error will occur.

pulp_user_home: '/var/lib/pulp'
pulp_pip_editable: yes
pulp_use_system_wide_pkgs: false
Expand Down
4 changes: 2 additions & 2 deletions roles/pulp/tasks/configure.yml
Expand Up @@ -10,15 +10,15 @@
path: '{{ pulp_config_dir }}'
state: directory
owner: root
group: '{{ pulp_user }}'
group: '{{ pulp_group }}'
mode: 0750

- name: Create configuration file for Pulp
template:
src: settings.py.j2
dest: '{{ pulp_config_dir }}/settings.py'
owner: root
group: '{{ pulp_user }}'
group: '{{ pulp_group }}'
mode: 0640
force: no

Expand Down
30 changes: 28 additions & 2 deletions roles/pulp/tasks/install.yml
Expand Up @@ -41,28 +41,54 @@
check_mode: False
register: result

- name: Make sure {{ pulp_group }} group exists
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't if Ansible properly interpolates here or if you need to quote. Still a bit of magic to me.

group:
name: '{{ pulp_group }}'
gid: '{{ pulp_group_id }}'
state: present
system: true

- name: Create user {{ pulp_user }}
user:
name: '{{ pulp_user }}'
uid: '{{ pulp_user_id }}'
shell: '{{ result.stdout.strip() }}'
home: '{{ pulp_user_home }}'
system: true
when: developer_user is not defined

- name: Add user {{ pulp_user }} to {{ pulp_group }} group
user:
name: '{{ pulp_user }}'
groups:
- '{{ pulp_group }}'
append: true

- name: Add user {{ developer_user }} to {{ pulp_group }} group
user:
name: '{{ developer_user }}'
groups:
- '{{ pulp_group }}'
append: true
when: developer_user is defined

- name: Reset ssh conn to allow user changes to affect when ssh user and pulp user are the same
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a when to detect this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, but got a warning saying that it is not allowed with the 'reset_connection' metatask.

meta: reset_connection

- name: Create cache dir for Pulp
file:
path: '{{ pulp_cache_dir }}'
state: directory
owner: '{{ pulp_user }}'
group: '{{ pulp_user }}'
group: '{{ pulp_group }}'
mode: 0775

- name: Create pulp install dir
file:
path: '{{ pulp_install_dir }}'
state: directory
owner: '{{ pulp_user }}'
group: '{{ pulp_user }}'
group: '{{ pulp_group }}'

- name: Install packages needed for source install
package:
Expand Down