forked from infra/ansible
copr: debugging: helper script expands more files
This commit is contained in:
parent
14e43e1533
commit
2e546baf9f
1 changed files with 17 additions and 12 deletions
|
|
@ -12,21 +12,20 @@ outdir=/tmp/pools_debugging
|
|||
|
||||
sourcedir=$(dirname "$0")
|
||||
gitroot=$(cd "$sourcedir" && git rev-parse --show-toplevel)
|
||||
pools=$gitroot/roles/copr/backend/templates/resalloc/pools.yaml.j2
|
||||
|
||||
if ! test -d "$outdir"; then
|
||||
mkdir -p "$outdir"
|
||||
mkdir -p "$outdir/python"
|
||||
(cd "$outdir" && git init .)
|
||||
fi
|
||||
|
||||
instances="devel production"
|
||||
|
||||
for i in devel production; do
|
||||
if test $i = production; then
|
||||
for instance in $instances; do
|
||||
mkdir -p "$outdir/$instance"
|
||||
if test "$instance" = production; then
|
||||
vars=$gitroot/inventory/group_vars/copr_aws
|
||||
file=pools.prod.yaml
|
||||
else
|
||||
vars=$gitroot/inventory/group_vars/copr_dev_aws
|
||||
file=pools.dev.yaml
|
||||
fi
|
||||
|
||||
cat > $pbook <<EOF
|
||||
|
|
@ -42,14 +41,20 @@ for i in devel production; do
|
|||
ibmcloud_token_file: /var/lib/resallocserver/.ibm-cloud-token
|
||||
|
||||
tasks:
|
||||
- name: instantiate $devel
|
||||
- name: instantiate $instance
|
||||
template:
|
||||
src: $pools
|
||||
dest: $outdir/$file
|
||||
|
||||
src: "{{ item.template }}"
|
||||
dest: "{{ item.target }}"
|
||||
loop:
|
||||
- template: $gitroot/roles/copr/backend/templates/resalloc/pools.yaml.j2
|
||||
target: $outdir/$instance-pools.yaml
|
||||
- template: $gitroot/roles/copr/backend/templates/provision/helpers.py.j2
|
||||
target: $outdir/$instance/helpers.py
|
||||
- template: $gitroot/roles/copr/backend/templates/provision/libvirt-new
|
||||
target: $outdir/$instance/libvirt-new
|
||||
EOF
|
||||
|
||||
ansible-playbook $pbook
|
||||
ansible-playbook $pbook -i "$gitroot/inventory"
|
||||
done
|
||||
|
||||
(cd "$outdir" && git add *.yaml && git commit -m "update")
|
||||
(cd "$outdir" && git add *.yaml $instances && git commit -m "update")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue