WIP: Modify the zuul inventory to pass to the reproducer
Substitute CI values for with those relevant to the environment in which the reproducer is running. Change-Id: If55b5615b713287cb3dab140026ae6f46477ad9e Story: https://tree.taiga.io/project/tripleo-ci-board/task/350
This commit is contained in:
parent
eac8c24e92
commit
862d863a89
|
@ -21,3 +21,50 @@ packages_list:
|
|||
- vim
|
||||
- wget
|
||||
- iptables-services
|
||||
provider_node_label_primary: >-
|
||||
{% if environment_type == 'ovb' -%}
|
||||
tripleo-ovb-centos-7
|
||||
{%- else -%}
|
||||
upstream-centos-7
|
||||
{%- endif -%}
|
||||
env_hosts_block: >-
|
||||
#
|
||||
primary:
|
||||
ansible_connection: ssh
|
||||
ansible_host: "{{ hostvars[groups['subnodes'][0]].ansible_host }}"
|
||||
ansible_private_key_file: "{{ hostvars[groups['subnodes'][0]].ansible_private_key_file }}"
|
||||
ansible_port: 22
|
||||
ansible_user: zuul
|
||||
nodepool:
|
||||
az: nova
|
||||
cloud: "{{ provider_cloud_name | default('rdo-cloud-tripleo') }}"
|
||||
interface_ip: "{{ hostvars[groups['subnodes'][0]].ansible_host }}"
|
||||
label: "{{ provider_node_label_primary }}"
|
||||
private_ipv4: "{{ hostvars[groups['subnodes'][0]].subnode_private_ip }}"
|
||||
provider: "{{ provider_name | default('rdo-cloud-tripleo') }}"
|
||||
public_ipv4: "{{ hostvars[groups['subnodes'][0]].subnode_public_ip }}"
|
||||
public_ipv6: "{{ hostvars[groups['subnodes'][0]].subnode_public_ipv6 | default('') }}"
|
||||
region: "{{ provider_region_name | default('regionOne') }}"
|
||||
{{ secondary_vars }}
|
||||
vars:
|
||||
secondary_vars: >-
|
||||
{% if environment_type == 'multinode' -%}
|
||||
secondary:
|
||||
ansible_connection: ssh
|
||||
ansible_host: "{{ hostvars[groups['subnodes'][1]].ansible_host }}"
|
||||
ansible_private_key_file: "{{ hostvars[groups['subnodes'][1]].ansible_private_key_file }}"
|
||||
ansible_port: 22
|
||||
ansible_user: zuul
|
||||
nodepool:
|
||||
az: nova
|
||||
cloud: "{{ provider_cloud_name | default('rdo-cloud-tripleo') }}"
|
||||
interface_ip: "{{ hostvars[groups['subnodes'][1]].ansible_host }}"
|
||||
label: "{{ provider_node_label_primary }}"
|
||||
private_ipv4: "{{ hostvars[groups['subnodes'][1]].subnode_private_ip }}"
|
||||
provider: "{{ provider_name | default('rdo-cloud-tripleo') }}"
|
||||
public_ipv4: "{{ hostvars[groups['subnodes'][1]].subnode_public_ip }}"
|
||||
public_ipv6: "{{ hostvars[groups['subnodes'][1]].subnode_public_ipv6 | default('') }}"
|
||||
region: "{{ provider_region_name | default('regionOne') }}"
|
||||
{%- else -%}
|
||||
#
|
||||
{%- endif -%}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
- include: modify-zuul-inventory.yml
|
||||
|
||||
# Below this to be partly deleted
|
||||
- include: etc-nodepool.yml
|
||||
become: true
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
- delegate_to: localhost
|
||||
block:
|
||||
|
||||
- name: Check if inventory file exists
|
||||
stat:
|
||||
path: "{{ lookup('env', 'WORKSPACE') }}/zuul_inventory.yaml"
|
||||
register: zuul_inventory_file
|
||||
|
||||
- name: Fail if file does not exist
|
||||
fail:
|
||||
msg: "zuul_inventory file does not exist in the workspace."
|
||||
when: not zuul_inventory_file.stat.exists|bool
|
||||
|
||||
- name: Remove CI hosts values
|
||||
shell: "sed -i '/ primary:/,/ vars:/d' {{ lookup('env', 'WORKSPACE') }}/zuul_inventory.yaml"
|
||||
|
||||
- name: Add env host values
|
||||
blockinfile:
|
||||
path: "{{ lookup('env', 'WORKSPACE') }}/zuul_inventory.yaml"
|
||||
block: "{{ env_hosts_block }}"
|
||||
insertafter: '^ hosts:$'
|
||||
|
||||
- name: Modify zuul.executor hostname value
|
||||
lineinfile:
|
||||
path: "{{ lookup('env', 'WORKSPACE') }}/zuul_inventory.yaml"
|
||||
regexp: '^ hostname:'
|
||||
line: " hostname: localhost"
|
||||
insertafter: '^ executor:$'
|
||||
|
||||
- name: Modify zuul.executor dir values
|
||||
replace:
|
||||
path: "{{ lookup('env', 'WORKSPACE') }}/zuul_inventory.yaml"
|
||||
regexp: "{{ item.start }}: .*/{{ item.end }}"
|
||||
replace: "{{ item.start }}: {{ local_working_dir }}/zuul_tmp/{{ item.end }}"
|
||||
with_items:
|
||||
- { start: "inventory_file", end: "ansible/inventory.yaml" }
|
||||
- { start: "log_root", end: "work/logs" }
|
||||
- { start: "result_data_file", end: "work/results.json" }
|
||||
- { start: "src_root", end: "work/src" }
|
||||
- { start: "work_root", end: "work" }
|
||||
|
||||
- name: Check if zuul_tmp exists
|
||||
stat:
|
||||
path: "{{ local_working_dir }}/zuul_tmp/"
|
||||
register: zuul_tmp_dir
|
||||
|
||||
- name: Create dir for zuul executor files if it does not exist
|
||||
file :
|
||||
path: "{{ local_working_dir }}/zuul_tmp/"
|
||||
state: directory
|
||||
when: not zuul_tmp_dir.stat.exists|bool
|
||||
|
||||
- name: Create sub dirs in zuul_tmp_dir
|
||||
file:
|
||||
path: "{{ local_working_dir }}/zuul_tmp/{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "ansible"
|
||||
- "work"
|
||||
- "work/logs"
|
||||
- "work/src"
|
||||
when: not zuul_tmp_dir.stat.exists|bool
|
||||
|
Loading…
Reference in New Issue