ce570691e7
* Test against galaxy_ng * Switch container image * Remove redundant |default * Re-enable * Update image * Update wording * Don't use pulp as the container name
165 lines
4.8 KiB
YAML
165 lines
4.8 KiB
YAML
# These tasks configure pulp/pulp_ansible so that we can use the container
|
|
# This will also reset pulp between iterations
|
|
|
|
# The pulp container has a long start up time
|
|
# The first task to interact with pulp needs to wait until it responds appropriately
|
|
- name: list pulp distributions
|
|
uri:
|
|
url: '{{ pulp_api }}/pulp/api/v3/distributions/ansible/ansible/'
|
|
status_code:
|
|
- 200
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_distributions
|
|
until: pulp_distributions is successful
|
|
delay: 1
|
|
retries: 60
|
|
|
|
- when: pulp_distributions.json.count > 0
|
|
block:
|
|
- name: delete pulp distributions
|
|
uri:
|
|
url: '{{ pulp_api }}{{ distribution.pulp_href }}'
|
|
method: DELETE
|
|
status_code:
|
|
- 202
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_distribution_delete_tasks
|
|
loop: '{{ pulp_distributions.json.results }}'
|
|
loop_control:
|
|
loop_var: distribution
|
|
label: '{{ distribution.name }}'
|
|
|
|
- name: wait for distribution delete
|
|
uri:
|
|
url: '{{ pulp_api }}{{ task.json.task }}'
|
|
method: GET
|
|
status_code:
|
|
- 200
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_distribution_delete
|
|
until: pulp_distribution_delete is successful and pulp_distribution_delete.json.state|default("MISSING") == "completed"
|
|
delay: 1
|
|
retries: 25
|
|
loop: '{{ pulp_distribution_delete_tasks.results }}'
|
|
loop_control:
|
|
loop_var: task
|
|
label: '{{ task.json.task }}'
|
|
|
|
- name: delete pulp repository
|
|
uri:
|
|
url: '{{ pulp_api }}{{ distribution.repository }}'
|
|
method: DELETE
|
|
status_code:
|
|
- 202
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_repository_delete_tasks
|
|
loop: '{{ pulp_distributions.json.results }}'
|
|
loop_control:
|
|
loop_var: distribution
|
|
label: '{{ distribution.name }}'
|
|
|
|
- name: wait for repository delete
|
|
uri:
|
|
url: '{{ pulp_api }}{{ task.json.task }}'
|
|
method: GET
|
|
status_code:
|
|
- 200
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_repository_delete
|
|
until: pulp_repository_delete is successful and pulp_repository_delete.json.state|default("MISSING") == "completed"
|
|
delay: 1
|
|
retries: 25
|
|
loop: '{{ pulp_repository_delete_tasks.results }}'
|
|
loop_control:
|
|
loop_var: task
|
|
label: '{{ task.json.task }}'
|
|
|
|
- name: delete pulp orphans
|
|
uri:
|
|
url: '{{ pulp_api }}/pulp/api/v3/orphans/'
|
|
method: DELETE
|
|
status_code:
|
|
- 202
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_orphans_delete_task
|
|
|
|
- name: wait for orphan delete
|
|
uri:
|
|
url: '{{ pulp_api }}{{ pulp_orphans_delete_task.json.task }}'
|
|
method: GET
|
|
status_code:
|
|
- 200
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_orphans_delete
|
|
until: pulp_orphans_delete is successful and pulp_orphans_delete.json.state|default("MISSING") == "completed"
|
|
delay: 1
|
|
retries: 25
|
|
|
|
- name: create pulp repos
|
|
uri:
|
|
url: '{{ pulp_api }}/pulp/api/v3/repositories/ansible/ansible/'
|
|
method: POST
|
|
body_format: json
|
|
body:
|
|
name: '{{ repo_name }}'
|
|
status_code:
|
|
- 201
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_repo
|
|
loop:
|
|
- automation-hub
|
|
loop_control:
|
|
loop_var: repo_name
|
|
|
|
- name: create pulp distributions
|
|
uri:
|
|
url: '{{ pulp_api }}/pulp/api/v3/distributions/ansible/ansible/'
|
|
method: POST
|
|
body_format: json
|
|
body:
|
|
name: '{{ repo.repo_name }}'
|
|
base_path: '{{ repo.repo_name }}'
|
|
repository: '{{ pulp_api }}{{ repo.json.pulp_href }}'
|
|
status_code:
|
|
- 202
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
register: pulp_distribution_task
|
|
loop: '{{ pulp_repo.results }}'
|
|
loop_control:
|
|
loop_var: repo
|
|
|
|
- name: wait for distribution creation
|
|
uri:
|
|
url: '{{ pulp_api }}{{ task.json.task }}'
|
|
method: GET
|
|
status_code:
|
|
- 200
|
|
user: '{{ pulp_user }}'
|
|
password: '{{ pulp_password }}'
|
|
force_basic_auth: true
|
|
until: pulp_distribution is successful and pulp_distribution.json.state|default("MISSING") == "completed"
|
|
delay: 1
|
|
retries: 25
|
|
register: pulp_distribution
|
|
loop: '{{ pulp_distribution_task.results }}'
|
|
loop_control:
|
|
loop_var: task
|
|
label: '{{ task.json.task }}'
|