Skip to content

Commit 5af547e

Browse files
authored
Merge pull request #16 from stackhpc/containers
Add support for pulp_container plugin content
2 parents a6035d1 + 39ef5a0 commit 5af547e

File tree

9 files changed

+82
-1
lines changed

9 files changed

+82
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Tested with the current Ansible 2.9-2.10 releases.
1111

1212
## Included content
1313

14-
pulp_repository role
14+
Roles:
15+
16+
* `pulp_repository`
17+
* `pulp_publication`
18+
* `pulp_distribution`
1519

1620
## Using this collection
1721

roles/pulp_distribution/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Role variables
1010
* `pulp_username`: Username used to access Pulp server. Default is `admin`
1111
* `pulp_password`: Password used to access Pulp server. Default is unse
1212
* `pulp_validate_certs`: Whether to validate Pulp server certificate. Default is `true`
13+
* `pulp_distribution_container`: List of distributions for container repositories. Default is an empty list
1314
* `pulp_distribution_rpm`: List of distributions for RPM repositories. Default is an empty list
1415
* `pulp_distribution_rpm_skip_existing`: Whether to skip existing RPM
1516
distributions. If true, new distributions will not be created for a
@@ -30,6 +31,18 @@ Example playbook
3031
pulp_url: "https://pulp.example.com"
3132
pulp_username: admin
3233
pulp_password: "{{ secrets_pulp_admin_password }}"
34+
pulp_distribution_container:
35+
# Distribute the latest version of the pulp/pulp repository.
36+
- name: pulp/pulp
37+
base_path: pulp/pulp
38+
repository: pulp/pulp
39+
state: present
40+
# Distribute version 2 of the pulp/pulp repository.
41+
- name: pulp/pulp
42+
base_path: pulp/pulp
43+
repository: pulp/pulp
44+
version: 2
45+
state: present
3346
pulp_distribution_rpm:
3447
# Distribute the latest version of the centos-baseos repository.
3548
- name: centos-baseos

roles/pulp_distribution/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pulp_username: admin
44
pulp_password:
55
pulp_validate_certs: true
66

7+
pulp_distribution_container: []
78
pulp_distribution_rpm: []
89

910
# Whether to skip existing RPM distributions. If true, new distributions will
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Ensure container distributions are defined
3+
pulp.squeezer.container_distribution:
4+
pulp_url: "{{ pulp_url }}"
5+
username: "{{ pulp_username }}"
6+
password: "{{ pulp_password }}"
7+
validate_certs: "{{ pulp_validate_certs | bool }}"
8+
name: "{{ item.name }}"
9+
base_path: "{{ item.base_path }}"
10+
repository: "{{ item.repository }}"
11+
version: "{{ item.version | default(omit) }}"
12+
state: "{{ item.state }}"
13+
with_items: "{{ pulp_distribution_container }}"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
- import_tasks: precheck.yml
33

4+
- include_tasks: container.yml
5+
when: pulp_distribution_container | length > 0
6+
tags: container
7+
48
- include_tasks: rpm.yml
59
tags: rpm
610
when: pulp_distribution_rpm | length > 0

roles/pulp_repository/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Role variables
1010
* `pulp_username`: Username used to access Pulp server. Default is `admin`
1111
* `pulp_password`: Password used to access Pulp server. Default is unset
1212
* `pulp_validate_certs`: Whether to validate Pulp server certificate. Default is `true`
13+
* `pulp_repository_container_repos`: List of container repositories. Default is an empty list.
1314
* `pulp_repository_rpm_repos`: List of RPM repositories. Default is an empty list.
1415
* `pulp_repository_python_repos`: List of PyPI repositories. Default is an empty list.
1516
* `pulp_repository_deb_repos`: List of Deb respositories. Default is an empty list.
@@ -27,6 +28,12 @@ Example playbook
2728
- role: stackhpc.pulp.pulp_repository
2829
pulp_username: admin
2930
pulp_password: "{{ secrets_pulp_admin_password }}"
31+
pulp_repository_container_repos:
32+
# Create a pulp/pulp repository and sync with Dockerhub.
33+
- name: pulp/pulp
34+
url: https://registry-1.docker.io
35+
policy: on_demand
36+
state: present
3037
pulp_repository_rpm_repos:
3138
- name: centos-baseos
3239
url: http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS&infra=stock

roles/pulp_repository/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pulp_username: admin
44
pulp_password:
55
pulp_validate_certs: true
66

7+
pulp_repository_container_repos: []
78
pulp_repository_deb_repos: []
89
pulp_repository_python_repos: []
910
pulp_repository_rpm_repos: []
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
- name: Setup container repositories
3+
pulp.squeezer.container_repository:
4+
pulp_url: "{{ pulp_url }}"
5+
username: "{{ pulp_username }}"
6+
password: "{{ pulp_password }}"
7+
validate_certs: "{{ pulp_validate_certs | bool }}"
8+
name: "{{ item.name }}"
9+
state: "{{ item.state }}"
10+
with_items: "{{ pulp_repository_container_repos }}"
11+
12+
- name: Setup container remotes
13+
pulp.squeezer.container_remote:
14+
pulp_url: "{{ pulp_url }}"
15+
username: "{{ pulp_username }}"
16+
password: "{{ pulp_password }}"
17+
validate_certs: "{{ pulp_validate_certs | bool }}"
18+
name: "{{ item.name }}-remote"
19+
url: "{{ item.url }}"
20+
policy: "{{ item.policy }}"
21+
upstream_name: "{{ item.upstream_name | default(item.name) }}"
22+
state: "{{ item.state }}"
23+
with_items: "{{ pulp_repository_container_repos }}"
24+
25+
- name: Sync container remotes into repositories
26+
pulp.squeezer.container_sync:
27+
pulp_url: "{{ pulp_url }}"
28+
username: "{{ pulp_username }}"
29+
password: "{{ pulp_password }}"
30+
validate_certs: "{{ pulp_validate_certs | bool }}"
31+
repository: "{{ item.name }}"
32+
remote: "{{ item.name }}-remote"
33+
with_items: "{{ pulp_repository_container_repos }}"
34+
when: item.state == "present"

roles/pulp_repository/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
- include_tasks: container.yml
3+
tags: container
4+
when: pulp_repository_container_repos | length > 0
5+
26
- include_tasks: deb.yml
37
when: pulp_repository_deb_repos | length > 0
48
tags: deb

0 commit comments

Comments
 (0)