Creating docs for repo setup role
Creating docs for repo setup role Change-Id: I524d9bed621611caf53609d80c894b4b4e8c2732
This commit is contained in:
parent
2d85013e95
commit
c9ae188d60
@ -15,13 +15,13 @@ Role Variables
|
||||
* `repo_setup_log` - path to repositories setup script log
|
||||
* `repo_run_live`: false/true - where to run repo setup script on host (live host that playbook runs on it) (default: true)
|
||||
* `repo_inject_image_path` - path to image, in case of injecting repositories into the image (default: not defined)
|
||||
* `repo_cmd_before`: false/true - whether to run `yum update` after repositories are set up (default: true)
|
||||
* `repo_cmd_after`: false/true - whether to include Ceph repositories (default: true)
|
||||
* `repo_cmd_before`: - shell commands to run before repos setup
|
||||
* `repo_cmd_after`: - shell commands to run after repos setup
|
||||
* `libvirt_uri` - URI of libvirt in case of using virt-customize to inject repos into the image
|
||||
* `repos` - dictionary or repositories to set, the keys are explained below:
|
||||
* `repos.type` - file / generic / package / rpm_url
|
||||
* `repos.releases` - for which releases to set up this repo, if not defined - for all releases.
|
||||
It support shortcut for all stable releases - '{{ stable }}'
|
||||
It supports shortcut for all stable releases - '{{ stable }}'
|
||||
|
||||
*File*
|
||||
------
|
||||
@ -33,7 +33,7 @@ Role Variables
|
||||
*Generic*
|
||||
------
|
||||
Construct repository file from various parameters and use parameters from downloaded file
|
||||
if required (for example delorean hash).
|
||||
if required (for example DLRN hash).
|
||||
* `repos.filename` - filename for saving the resulting repo (mandatory)
|
||||
* `repos.reponame` - name of repository (mandatory)
|
||||
* `repos.baseurl` - base URL of the repository (mandatory)
|
||||
|
@ -1,17 +1,38 @@
|
||||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
### --start_docs
|
||||
## Setup repositories for the job
|
||||
## ==============================
|
||||
|
||||
## Prepare Your Environment
|
||||
## ------------------------
|
||||
|
||||
## * Execute commands before repositories setup
|
||||
## ::
|
||||
|
||||
{{ repo_cmd_before|default('') }}
|
||||
|
||||
# Make temp dir for files
|
||||
rm -rf /tmp/repo_role_tmp && mkdir -p /tmp/repo_role_tmp
|
||||
|
||||
## * Prepare repositories
|
||||
## ::
|
||||
|
||||
{% for repo in repos %}
|
||||
{% if repo.releases is not defined or release in repo.releases %}
|
||||
|
||||
{% if repo.type == 'file' %}
|
||||
|
||||
## * Download and use file from {{ repo.down_url }}
|
||||
## ::
|
||||
|
||||
curl -Lvo /tmp/repo_role_tmp/{{ repo.filename }} {{ repo.down_url }}
|
||||
{% if repo.priority is defined and repo.priority %}
|
||||
|
||||
## * Change its priority to {{ repo.priority }}
|
||||
## ::
|
||||
|
||||
if ! grep -q "priority" /tmp/repo_role_tmp/{{ repo.filename }}; then
|
||||
sed -i "s/\(baseurl=.*\)/\1\npriority={{ repo.priority }}/g" /tmp/repo_role_tmp/{{ repo.filename }}
|
||||
else
|
||||
@ -22,6 +43,10 @@ sudo cp -f /tmp/repo_role_tmp/{{ repo.filename }} /etc/yum.repos.d/
|
||||
{% endif %}
|
||||
|
||||
{% if repo.type == 'generic' %}
|
||||
|
||||
## * Construct repo file from arguments
|
||||
## ::
|
||||
|
||||
{% if repo.hash_url is defined %}
|
||||
HASH=$(curl {{ repo.hash_url }} 2>/dev/null | grep baseurl | grep -Eo '[^/]*/[^/]*/[^/]*_.*' ||:)
|
||||
{% endif %}
|
||||
@ -45,10 +70,19 @@ sudo cp -f /tmp/repo_role_tmp/{{ repo.filename }} /etc/yum.repos.d/
|
||||
{% endif %}
|
||||
|
||||
{% if repo.type == 'package' %}
|
||||
|
||||
## * Install repo from package {{ repo.pkg_name|default(repo.pkg_url) }}
|
||||
## ::
|
||||
|
||||
{{ repo.custom_cmd|default('sudo yum install -y') }} {{ repo.pkg_name|default(repo.pkg_url) }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
## * Execute commands after repositories setup
|
||||
## ::
|
||||
|
||||
{{ repo_cmd_after|default('') }}
|
||||
|
||||
### --stop_docs
|
Loading…
Reference in New Issue
Block a user