Skip to content

Commit df390ba

Browse files
committed
httpd vhost:80 configuration
1 parent f2d2d19 commit df390ba

File tree

4 files changed

+102
-17
lines changed

4 files changed

+102
-17
lines changed

src/playbooks/deploy/deploy.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
- "../../vars/foreman.yml"
1212
- "../../vars/base.yaml"
1313
roles:
14-
- role: pre_install
15-
- role: checks
16-
- role: certificates
17-
when: "certificate_source == 'default'"
18-
- role: certificate_checks
19-
vars:
20-
certificate_checks_certificate: "{{ server_certificate }}"
21-
certificate_checks_key: "{{ server_key }}"
22-
certificate_checks_ca: "{{ ca_certificate }}"
23-
- role: postgresql
24-
when:
25-
- database_mode == 'internal'
26-
- redis
27-
- candlepin
14+
# - role: pre_install
15+
# - role: checks
16+
# - role: certificates
17+
# when: "certificate_source == 'default'"
18+
# - role: certificate_checks
19+
# vars:
20+
# certificate_checks_certificate: "{{ server_certificate }}"
21+
# certificate_checks_key: "{{ server_key }}"
22+
# certificate_checks_ca: "{{ ca_certificate }}"
23+
# - role: postgresql
24+
# when:
25+
# - database_mode == 'internal'
26+
# - redis
27+
# - candlepin
2828
- httpd
29-
- pulp
30-
- foreman
31-
- role: systemd_target
29+
# - pulp
30+
# - foreman
31+
# - role: systemd_target
3232
- post_install

src/roles/httpd/tasks/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
- src: "{{ httpd_server_key }}"
4444
dest: "private/katello-apache.key"
4545

46+
- name: Configure foreman vhost
47+
ansible.builtin.template:
48+
src: foreman-vhost.conf.j2
49+
dest: /etc/httpd/conf.d/foreman.conf
50+
mode: "0644"
51+
notify:
52+
- Restart httpd
53+
4654
- name: Configure foreman-ssl vhost
4755
ansible.builtin.template:
4856
src: foreman-ssl-vhost.conf.j2
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<VirtualHost *:80>
2+
ServerName {{ ansible_facts['fqdn'] }}
3+
4+
## Load additional static includes
5+
IncludeOptional "/etc/httpd/conf.d/05-foreman.d/*.conf"
6+
7+
## Logging
8+
ErrorLog "/var/log/httpd/foreman_error.log"
9+
ServerSignature Off
10+
CustomLog "/var/log/httpd/foreman_access.log" combined
11+
12+
## Request header rules
13+
## as per http://httpd.apache.org/docs/2.4/mod/mod_headers.html#requestheader
14+
RequestHeader set X-FORWARDED-PROTO "http"
15+
RequestHeader set SSL-CLIENT-S-DN ""
16+
RequestHeader set SSL-CLIENT-CERT ""
17+
RequestHeader set SSL-CLIENT-VERIFY ""
18+
RequestHeader unset REMOTE_USER
19+
RequestHeader unset REMOTE-USER
20+
21+
ProxyPass /pulp_ansible/galaxy/ {{ httpd_pulp_api_backend }}/pulp_ansible/galaxy/
22+
ProxyPassReverse /pulp_ansible/galaxy/ {{ httpd_pulp_api_backend }}/pulp_ansible/galaxy/
23+
24+
<Location "/pulpcore_registry/v2/">
25+
RequestHeader unset REMOTE_USER
26+
RequestHeader unset REMOTE-USER
27+
ProxyPass {{ httpd_pulp_api_backend }}/v2/
28+
ProxyPassReverse {{ httpd_pulp_api_backend }}/v2/
29+
</Location>
30+
31+
ProxyPass /pulp/container/ {{ httpd_pulp_content_backend }}/pulp/container/
32+
ProxyPassReverse /pulp/container/ {{ httpd_pulp_content_backend }}/pulp/container/
33+
34+
<Location "/pulp/content">
35+
ProxyPass {{ httpd_pulp_content_backend }}/pulp/content disablereuse=on timeout=600
36+
ProxyPassReverse {{ httpd_pulp_content_backend }}/pulp/content
37+
</Location>
38+
39+
<Location "/pulp/api/v3">
40+
RedirectPermanent /pulp/api/v3 https://{{ ansible_facts['fqdn'] }}/pulp/api/v3
41+
</Location>
42+
43+
ProxyPass /pulp/assets/ {{ httpd_pulp_api_backend }}/pulp/assets/
44+
ProxyPassReverse /pulp/assets/ {{ httpd_pulp_api_backend }}/pulp/assets/
45+
46+
## Proxy rules
47+
ProxyRequests Off
48+
ProxyPreserveHost On
49+
ProxyAddHeaders On
50+
ProxyPass /pulp !
51+
ProxyPass /icons !
52+
ProxyPass /server-status !
53+
ProxyPass / {{ httpd_foreman_backend }}/ retry=0 timeout=900
54+
ProxyPassReverse / {{ httpd_foreman_backend }}/
55+
56+
AddDefaultCharset UTF-8
57+
</VirtualHost>

tests/httpd_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,23 @@ def test_https_pulp_auth(server, certificates, server_fqdn):
4141
cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --write-out '%{{stderr}}%{{http_code}}' --cert {certificates['client_certificate']} --key {certificates['client_key']} https://{server_fqdn}/pulp/api/v3/users/")
4242
assert cmd.succeeded
4343
assert cmd.stderr == '200'
44+
45+
def test_http_foreman_login(server, server_fqdn):
46+
cmd = server.run(f"curl --silent --output /dev/null --write-out '%{{http_code}}' http://{server_fqdn}/users/login")
47+
assert cmd.succeeded
48+
assert cmd.stdout == '200'
49+
50+
def test_http_pulp_status(server, server_fqdn):
51+
cmd = server.run(f"curl --silent --output /dev/null --write-out '%{{http_code}}' http://{server_fqdn}/pulp/api/v3/status/")
52+
assert cmd.succeeded
53+
assert cmd.stdout == '301'
54+
55+
def test_http_pulp_content(server, server_fqdn):
56+
cmd = server.run(f"curl --silent --output /dev/null --write-out '%{{http_code}}' http://{server_fqdn}/pulp/content/")
57+
assert cmd.succeeded
58+
assert cmd.stdout == '200'
59+
60+
def test_http_pulp_content_response(server, server_fqdn):
61+
cmd = server.run(f"curl --silent http://{server_fqdn}/pulp/content/")
62+
assert cmd.succeeded
63+
assert "Index of /pulp/content/" in cmd.stdout

0 commit comments

Comments
 (0)