- hosts: localhost vars: config_root: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}" zuul_config: "{{ config_root }}/zuul/main.yaml" zuul_connections: "{{ lookup('file', 'zuul-connections.txt') }}" nodepool_launcher_config: "{{ config_root }}/nodepool/nodepool.yaml" nodepool_builder_config: "{{ config_root }}/nodepool/nodepool-builder.yaml" tasks: - name: Ensure Zuul tenant config exists shell: | if ! test -f "{{ zuul_config }}"; then mkdir -p "{{ config_root }}/zuul/" echo [] > "{{ zuul_config }}" fi - name: Setup Zuul config.conf file ansible.builtin.copy: dest: "{{ zuul_config }}.conf" content: | {{ zuul_connections }} [scheduler] tenant_config={{ zuul_config }} - name: Reveal computed config ansible.builtin.command: cat {{ zuul_config }}.conf - name: Validate Zuul tenant config # note: ansible appears to be messing with the env, resulting in: # ModuleNotFoundError: No module named 'zuul.cmd' # clearing the env fixes that issue. command: env - PATH=/usr/local/bin:/bin zuul-admin -c "{{ zuul_config }}.conf" tenant-conf-check - name: Ensure Nodepool launcher config exists shell: | if ! test -f "{{ nodepool_launcher_config }}"; then mkdir -p "{{ config_root }}/nodepool/" echo {} > "{{ nodepool_launcher_config }}" fi - name: Validate Nodepool launcher config command: env - PATH=/usr/local/bin:/bin nodepool -c "{{ nodepool_launcher_config }}" config-validate - name: Ensure Nodepool builder config exists shell: | if ! test -f "{{ nodepool_builder_config }}"; then mkdir -p "{{ config_root }}/nodepool/" echo {} > "{{ nodepool_builder_config }}" fi - name: Validate Nodepool builder config command: env - PATH=/usr/local/bin:/bin nodepool -c "{{ nodepool_builder_config }}" config-validate