Merge "Convert with_items to loop"

This commit is contained in:
Zuul 2020-06-15 09:40:18 +00:00 committed by Gerrit Code Review
commit 2dab2f5ad9
15 changed files with 29 additions and 29 deletions

View File

@ -29,13 +29,13 @@
file:
state: directory
name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ item }}/"
with_items: "{{ metadata_versions }}"
loop: "{{ metadata_versions }}"
- name: "Place template in each openstack/<version> folder"
template:
src: openstack_meta_data.json.j2
dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ item }}/meta_data.json"
with_items: "{{ metadata_versions }}"
loop: "{{ metadata_versions }}"
- name: "Generate network_data"
network_metadata:
@ -54,7 +54,7 @@
template:
src: network_data.json.j2
dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ item }}/network_data.json"
with_items: "{{ metadata_versions }}"
loop: "{{ metadata_versions }}"
when:
- item in metadata_versions_supporting_network_data
- addressing_mode is undefined or "dhcp" not in addressing_mode
@ -67,7 +67,7 @@
template:
src: network_data.json.j2
dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ item }}/network_info.json"
with_items: "{{ metadata_versions }}"
loop: "{{ metadata_versions }}"
when:
- item in metadata_versions_supporting_network_data
- addressing_mode is undefined or "dhcp" not in addressing_mode

View File

@ -129,7 +129,7 @@
testvm_nodes_json: []
- include: create_vm.yml
with_items: "{{ test_vm_node_names }}"
loop: "{{ test_vm_node_names }}"
- name: write to baremetal json file
copy:

View File

@ -24,7 +24,7 @@
pip:
name: "{{ item }}"
extra_args: "-c {{ upper_constraints_file }}"
with_items:
loop:
- libvirt-python
- lxml
when: enable_venv | bool == false
@ -35,7 +35,7 @@
state: present
virtualenv: "{{ bifrost_venv_dir }}"
virtualenv_command: "{{ venv_command | default(omit) }}"
with_items:
loop:
- libvirt-python
- lxml
when: enable_venv | default(false) | bool

View File

@ -134,7 +134,7 @@
mode: 0755
owner: "ironic"
group: "ironic"
with_items:
loop:
- "{{ ironic_log_dir }}"
- "{{ ironic_agent_deploy_logs_local_path }}"
@ -174,7 +174,7 @@
mode: 0750
owner: "ironic"
group: "ironic"
with_items:
loop:
- "/var/lib/ironic"
- "/var/lib/ironic/master_images"
- "/var/lib/ironic/images"
@ -185,7 +185,7 @@
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
owner: "root"
group: "root"
with_items:
loop:
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
when:
@ -197,7 +197,7 @@
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
owner: "root"
group: "root"
with_items:
loop:
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf --log-file {{ ironic_log_dir }}/ironic-api.log'}
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf --log-file {{ ironic_log_dir }}/ironic-conductor.log'}
when:
@ -310,7 +310,7 @@
destination_port: "{{ item }}"
in_interface: "{{ network_interface }}"
jump: ACCEPT
with_items:
loop:
- "{{ file_url_port }}"
- 6385
- block:

View File

@ -17,7 +17,7 @@
# For now, we need to use it, but we can patch that.
- name: "Set up PXE and iPXE folders"
file: name={{item}} owner=ironic group=ironic state=directory mode=0755
with_items:
loop:
- /tftpboot
- /tftpboot/pxelinux.cfg
- "{{ http_boot_folder }}"

View File

@ -33,7 +33,7 @@
until: ipxe_files_download_done is succeeded
retries: 5
delay: 10
with_items:
loop:
- undionly.kpxe
- ipxe.pxe
environment: "{{ venv }}"
@ -47,7 +47,7 @@
until: ipxe_efi_binary_download_done is succeeded
retries: 5
delay: 10
with_items:
loop:
- "{{ ipxe_efi_binary }}"
environment: "{{ venv }}"
when: enable_uefi_ipxe | bool == true

View File

@ -100,7 +100,7 @@
dest: "{{ init_dest_dir }}{{item.service_name}}.service"
owner: root
group: root
with_items:
loop:
- { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-inspector', username: 'ironic', args: '--config-file /etc/ironic-inspector/inspector.conf'}
- name: "Inspector - Explicitly permit TCP/5050 for ironic-inspector callback"
command: iptables -I INPUT -p tcp --dport 5050 -i {{network_interface}} -j ACCEPT

View File

@ -114,7 +114,7 @@
- name: "Install extra packages for ironic"
include: pip_install.yml
package={{ item }}
with_items: "{{ ironic_extra_packages }}"
loop: "{{ ironic_extra_packages }}"
- name: "Install Ironic using pip"
include: pip_install.yml

View File

@ -43,7 +43,7 @@
owner: root
group: root
when: enable_venv | bool == true
with_items:
loop:
- "{{ bifrost_venv_dir }}/bin/ironic-rootwrap"
- "{{ bifrost_venv_dir }}/bin/ironic-inspector-rootwrap"
- name: "Set sudoers for rootwrap"
@ -51,6 +51,6 @@
dest: /etc/sudoers
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
loop:
- { regexp: '^ironic(.*)/ironic-rootwrap /etc/ironic/rootwrap.conf(.*)', line: "ironic ALL = (root) NOPASSWD: {{ ironic_rootwrap_dir }}/ironic-rootwrap /etc/ironic/rootwrap.conf *" }
- { regexp: '^ironic(.*)/ironic-inspector-rootwrap /etc/ironic-inspector/rootwrap.conf(.*)', line: "ironic ALL = (root) NOPASSWD: {{ ironic_rootwrap_dir }}/ironic-inspector-rootwrap /etc/ironic-inspector/rootwrap.conf *" }

View File

@ -46,7 +46,7 @@
- name: "Ensure services are running with current config"
service: name={{ item }} state=restarted enabled=yes
with_items:
loop:
- xinetd
- nginx
@ -65,13 +65,13 @@
- name: "Ensure dnsmasq is running with current config"
service: name={{ item }} state=restarted enabled=yes
with_items:
loop:
- dnsmasq
when: include_dhcp_server | bool == true
- name: "Send services a reload signal"
service: name={{ item }} state=reloaded
with_items:
loop:
- xinetd
- nginx

View File

@ -272,7 +272,7 @@
dest: "{{ init_dest_dir }}{{ item.service_name }}.service"
owner: "root"
group: "root"
with_items:
loop:
- { service_path: "{{ uwsgi_install_prefix.stdout | default('') }}",
service_name: 'uwsgi',
username: "{{ nginx_user }}",

View File

@ -16,6 +16,6 @@
- name: "Ensure services are running with current config"
service: name={{ item }} state=restarted enabled=yes
with_items:
loop:
- nginx
- uwsgi

View File

@ -29,10 +29,10 @@
version: "{{ item.git_branch }}"
update: "{{ update_repos | bool }}"
clone: yes
with_items: "{{ bifrost_install_sources }}"
loop: "{{ bifrost_install_sources }}"
when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false
- name: "Copy from local path"
command: cp -a {{ item.git_url }} {{ item.git_folder }} creates={{ item.git_folder }}
with_items: "{{ bifrost_install_sources }}"
loop: "{{ bifrost_install_sources }}"
when: ci_testing_zuul | bool == true or copy_from_local_path | bool == true

View File

@ -23,7 +23,7 @@
# NOTE(TheJulia): add_host only triggers once per play. Since we need to
# add all hosts, we need to use a loop.
add_host: name="{{ hostvars[item]['ipv4_address'] }}:22" groups=test
with_items: "{{ groups['baremetal'] }}"
loop: "{{ groups['baremetal'] }}"
when: ipv4_address is defined
- name: "Ensure ~/.ssh/known_hosts is present"
file:

View File

@ -22,7 +22,7 @@
dest: "/etc/hosts"
regexp: "{{ item.regexp }}.*({{ ansible_hostname }}|localhost).*"
line: "{{ item.contents }}"
with_items:
loop:
- { regexp: '^127\.0\.0\.1', contents: '127.0.0.1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost' }
- { regexp: '^::1', contents: '::1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost ipv6-localhost ipv6-loopback' }
when: not skip_bootstrap | bool
@ -44,7 +44,7 @@
- systemd: daemon_reload=yes
- service: name={{ item }} state=stopped enabled=no
with_items:
loop:
- epmd.socket
- epmd
when: