From: Zack Cerza Date: Thu, 18 Feb 2016 17:48:26 +0000 (-0700) Subject: Quote variables used by with_items X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ee7298c60157df1ffa382eb48797182814d3a98e;p=ceph-cm-ansible.git Quote variables used by with_items Signed-off-by: Zack Cerza --- diff --git a/roles/ansible-managed/tasks/main.yml b/roles/ansible-managed/tasks/main.yml index 64f3733..cf5f23e 100644 --- a/roles/ansible-managed/tasks/main.yml +++ b/roles/ansible-managed/tasks/main.yml @@ -50,7 +50,7 @@ authorized_key: user: "{{ cm_user }}" key: "{{ item }}" - with_items: cm_user_ssh_keys + with_items: "{{ cm_user_ssh_keys }}" when: cm_user_ssh_keys is defined and cm_user is defined tags: diff --git a/roles/cobbler/tasks/apt_systems.yml b/roles/cobbler/tasks/apt_systems.yml index 85cf3ff..7260d20 100644 --- a/roles/cobbler/tasks/apt_systems.yml +++ b/roles/cobbler/tasks/apt_systems.yml @@ -9,5 +9,5 @@ apt: name: "{{ item }}" state: latest - with_items: cobbler_extra_packages + with_items: "{{ cobbler_extra_packages }}" when: cobbler_extra_packages|length > 0 diff --git a/roles/cobbler/tasks/main.yml b/roles/cobbler/tasks/main.yml index 4e05169..36b7542 100644 --- a/roles/cobbler/tasks/main.yml +++ b/roles/cobbler/tasks/main.yml @@ -20,7 +20,7 @@ content: "{{ item.data }}" dest: "{{ item.path }}" mode: '600' - with_items: cobbler_keys["{{ ansible_hostname }}"] + with_items: "{{ cobbler_keys[ansible_hostname] }}" no_log: true - name: Include package type specific vars. diff --git a/roles/cobbler/tasks/settings.yml b/roles/cobbler/tasks/settings.yml index f4bb0ed..b32135e 100644 --- a/roles/cobbler/tasks/settings.yml +++ b/roles/cobbler/tasks/settings.yml @@ -29,4 +29,4 @@ - name: Update settings command: cobbler setting edit --name={{ item.name }} --value={{ item.value}} - with_items: settings + with_items: "{{ settings }}" diff --git a/roles/cobbler/tasks/upload_templates.yml b/roles/cobbler/tasks/upload_templates.yml index c17b020..99ca039 100644 --- a/roles/cobbler/tasks/upload_templates.yml +++ b/roles/cobbler/tasks/upload_templates.yml @@ -16,7 +16,7 @@ owner: root group: root mode: 0644 - with_items: kickstarts + with_items: "{{ kickstarts }}" tags: - kickstarts @@ -27,7 +27,7 @@ owner: root group: root mode: 0644 - with_items: snippets + with_items: "{{ snippets }}" tags: - snippets @@ -38,7 +38,7 @@ owner: root group: root mode: 0644 - with_items: scripts + with_items: "{{ scripts }}" tags: - scripts @@ -49,7 +49,7 @@ owner: root group: root mode: 0744 - with_items: triggers + with_items: "{{ triggers }}" tags: - triggers @@ -70,6 +70,6 @@ owner: root group: root mode: 0755 - with_items: utils + with_items: "{{ utils }}" tags: - utils diff --git a/roles/cobbler/tasks/yum_systems.yml b/roles/cobbler/tasks/yum_systems.yml index 305d0e0..486cb7b 100644 --- a/roles/cobbler/tasks/yum_systems.yml +++ b/roles/cobbler/tasks/yum_systems.yml @@ -9,7 +9,7 @@ yum: name: "{{ item }}" state: latest - with_items: cobbler_extra_packages + with_items: "{{ cobbler_extra_packages }}" when: cobbler_extra_packages|length > 0 # configure red hat specific things diff --git a/roles/cobbler_systems/tasks/populate_systems.yml b/roles/cobbler_systems/tasks/populate_systems.yml index 9323a45..b366206 100644 --- a/roles/cobbler_systems/tasks/populate_systems.yml +++ b/roles/cobbler_systems/tasks/populate_systems.yml @@ -15,7 +15,7 @@ - name: Add missing systems to cobbler command: cobbler system add --name={{ item.split('.')[0] }} --profile={{ default_profile }} --mac={{ hostvars[item].mac }} --ip-address={{ hostvars[item].ip }} --interface={{ hostvars[item].interface|default(interface) }} --hostname={{ item.split('.')[0] }}.{{ lab_domain }} --kopts="{{ hostvars[item].kernel_options|default(kernel_options) }}" --ksmeta="{{ hostvars[item].kickstart_metadata|default(kickstart_metadata) }}" --power-type={{ hostvars[item].power_type|default(power_type) }} --power-address={{ item.split('.')[0] }}.{{ ipmi_domain }} --power-user={{ hostvars[item].power_user|default(power_user) }} --power-pass={{ hostvars[item].power_pass|default(power_pass) }} --netboot-enabled false - with_items: cobbler_systems_add + with_items: "{{ cobbler_systems_add }}" - name: set cobbler_systems_update set_fact: @@ -24,4 +24,4 @@ - name: Update existing systems in cobbler command: cobbler system edit --name={{ item.split('.')[0] }} --mac={{ hostvars[item].mac }} --ip-address={{ hostvars[item].ip }} --interface={{ hostvars[item].interface|default(interface) }} --hostname={{ item.split('.')[0] }}.{{ lab_domain }} --kopts="{{ hostvars[item].kernel_options|default(kernel_options) }}" --ksmeta="{{ hostvars[item].kickstart_metadata|default(kickstart_metadata) }}" --power-type={{ hostvars[item].power_type|default(power_type) }} --power-address={{ item.split('.')[0] }}.{{ ipmi_domain }} --power-user={{ hostvars[item].power_user|default(power_user) }} --power-pass={{ hostvars[item].power_pass|default(power_pass) }} - with_items: cobbler_systems_update + with_items: "{{ cobbler_systems_update }}" diff --git a/roles/common/tasks/rhel-entitlements.yml b/roles/common/tasks/rhel-entitlements.yml index e51c53e..ec00c09 100644 --- a/roles/common/tasks/rhel-entitlements.yml +++ b/roles/common/tasks/rhel-entitlements.yml @@ -75,7 +75,7 @@ - name: Enable necessary rhsm repos command: subscription-manager repos --enable {{ item }} - with_items: rhsm_repos + with_items: "{{ rhsm_repos }}" when: replace_repos - name: Remove old apt-mirror repository definition. diff --git a/roles/downstream-setup/tasks/disable_yum_repos.yml b/roles/downstream-setup/tasks/disable_yum_repos.yml index 9c214ad..b98382a 100644 --- a/roles/downstream-setup/tasks/disable_yum_repos.yml +++ b/roles/downstream-setup/tasks/disable_yum_repos.yml @@ -6,5 +6,5 @@ regexp: "enabled=1" backrefs: yes state: present - with_items: repos + with_items: "{{ repos }}" ignore_errors: true diff --git a/roles/downstream-setup/tasks/enable_yum_repos.yml b/roles/downstream-setup/tasks/enable_yum_repos.yml index 2c7eb6d..1fa87f4 100644 --- a/roles/downstream-setup/tasks/enable_yum_repos.yml +++ b/roles/downstream-setup/tasks/enable_yum_repos.yml @@ -6,5 +6,5 @@ regexp: "enabled=0" backrefs: yes state: present - with_items: repos + with_items: "{{ repos }}" ignore_errors: true diff --git a/roles/downstream-setup/tasks/remove_yum_repos.yml b/roles/downstream-setup/tasks/remove_yum_repos.yml index 6f249ba..fc3741d 100644 --- a/roles/downstream-setup/tasks/remove_yum_repos.yml +++ b/roles/downstream-setup/tasks/remove_yum_repos.yml @@ -3,4 +3,4 @@ file: path: "/etc/yum.repos.d/{{ item }}.repo" state: absent - with_items: repos + with_items: "{{ repos }}" diff --git a/roles/downstream-setup/tasks/yum_repos.yml b/roles/downstream-setup/tasks/yum_repos.yml index 3625bf9..8cf7243 100644 --- a/roles/downstream-setup/tasks/yum_repos.yml +++ b/roles/downstream-setup/tasks/yum_repos.yml @@ -4,4 +4,4 @@ url: "{{ item.url }}" dest: "/etc/yum.repos.d/{{ item.name }}.repo" force: yes - with_items: repos + with_items: "{{ repos }}" diff --git a/roles/gateway/tasks/packages.yml b/roles/gateway/tasks/packages.yml index 253d71a..8a457b2 100644 --- a/roles/gateway/tasks/packages.yml +++ b/roles/gateway/tasks/packages.yml @@ -7,4 +7,4 @@ name: "{{ item }}" state: latest enablerepo: epel - with_items: packages + with_items: "{{ packages }}" diff --git a/roles/nameserver/tasks/packages.yml b/roles/nameserver/tasks/packages.yml index b162592..f90bb36 100644 --- a/roles/nameserver/tasks/packages.yml +++ b/roles/nameserver/tasks/packages.yml @@ -7,4 +7,4 @@ name: "{{ item }}" state: latest enablerepo: epel - with_items: packages + with_items: "{{ packages }}" diff --git a/roles/packages/tasks/packages.yml b/roles/packages/tasks/packages.yml index 718c840..1eecd09 100644 --- a/roles/packages/tasks/packages.yml +++ b/roles/packages/tasks/packages.yml @@ -4,7 +4,7 @@ update_cache: true name: "{{ item }}" state: "{{ state }}" - with_items: apt_packages + with_items: "{{ apt_packages }}" when: apt_packages|length > 0 and ansible_pkg_mgr == "apt" @@ -12,6 +12,6 @@ yum: name: "{{ item }}" state: "{{ state }}" - with_items: yum_packages + with_items: "{{ yum_packages }}" when: yum_packages|length > 0 and ansible_pkg_mgr == "yum" diff --git a/roles/testnode/tasks/apt/packages.yml b/roles/testnode/tasks/apt/packages.yml index 7a19cb0..74c5aeb 100644 --- a/roles/testnode/tasks/apt/packages.yml +++ b/roles/testnode/tasks/apt/packages.yml @@ -4,7 +4,7 @@ name: "{{ item }}" state: absent force: yes - with_items: ceph_packages_to_remove|list + packages_to_remove|list + with_items: "{{ ceph_packages_to_remove|list + packages_to_remove|list }}" when: ceph_packages_to_remove|length > 0 or packages_to_remove|length > 0 @@ -13,7 +13,7 @@ name: "{{ item }}" state: latest force: yes - with_items: packages_to_upgrade + with_items: "{{ packages_to_upgrade }}" when: packages_to_upgrade|length > 0 - name: Upgrade non aarch64 packages @@ -21,7 +21,7 @@ name: "{{ item }}" state: latest force: yes - with_items: non_aarch64_packages_to_upgrade + with_items: "{{ non_aarch64_packages_to_upgrade }}" when: non_aarch64_packages_to_upgrade|length > 0 and ansible_architecture != "aarch64" @@ -31,7 +31,7 @@ name: "{{ item }}" state: present force: yes - with_items: packages|list + common_packages|list + with_items: "{{ packages|list + common_packages|list }}" when: packages|length > 0 or common_packages|length > 0 @@ -40,5 +40,5 @@ name: "{{ item }}" state: present force: yes - with_items: non_aarch64_packages|list + non_aarch64_common_packages|list + with_items: "{{ non_aarch64_packages|list + non_aarch64_common_packages|list }}" when: ansible_architecture != "aarch64" diff --git a/roles/testnode/tasks/apt/repos.yml b/roles/testnode/tasks/apt/repos.yml index 57c4083..304c631 100644 --- a/roles/testnode/tasks/apt/repos.yml +++ b/roles/testnode/tasks/apt/repos.yml @@ -8,7 +8,7 @@ - name: Remove custom repos file: path=/etc/apt/sources.list.d/{{ item }} state=absent - with_items: custom_repos.stdout_lines + with_items: "{{ custom_repos.stdout_lines }}" # Ignore changes here because we will be removing repos that we end up re-adding later changed_when: false @@ -54,6 +54,6 @@ state: present update_cache: no mode: 0644 - with_items: apt_repos|list + common_apt_repos|list + with_items: "{{ apt_repos|list + common_apt_repos|list }}" register: local_apt_repos when: ansible_architecture != "aarch64" diff --git a/roles/testnode/tasks/yum/packages.yml b/roles/testnode/tasks/yum/packages.yml index c8ad124..abd3dae 100644 --- a/roles/testnode/tasks/yum/packages.yml +++ b/roles/testnode/tasks/yum/packages.yml @@ -28,7 +28,7 @@ yum: name: "{{ item }}" state: absent - with_items: ceph_packages_to_remove + with_items: "{{ ceph_packages_to_remove }}" tags: - remove-ceph @@ -36,7 +36,7 @@ yum: name: "{{ item }}" state: absent - with_items: ceph_dependency_packages_to_remove + with_items: "{{ ceph_dependency_packages_to_remove }}" tags: - remove-ceph-dependency @@ -45,7 +45,7 @@ yum: name: "{{ item }}" state: present - with_items: packages + with_items: "{{ packages }}" when: packages|length > 0 - name: Install epel packages @@ -53,19 +53,19 @@ name: "{{ item }}" state: present enablerepo: epel - with_items: epel_packages + with_items: "{{ epel_packages }}" when: epel_packages|length > 0 - name: Remove packages yum: name: "{{ item }}" state: absent - with_items: packages_to_remove + with_items: "{{ packages_to_remove }}" when: packages_to_remove|length > 0 - name: Upgrade packages yum: name: "{{ item }}" state: latest - with_items: packages_to_upgrade + with_items: "{{ packages_to_upgrade }}" when: packages_to_upgrade|length > 0 diff --git a/roles/users/tasks/create_users.yml b/roles/users/tasks/create_users.yml index 9596c6b..4b94808 100644 --- a/roles/users/tasks/create_users.yml +++ b/roles/users/tasks/create_users.yml @@ -13,11 +13,11 @@ groups: sudo shell: /bin/bash state: present - with_items: managed_admin_users + with_items: "{{ managed_admin_users }}" - name: Create all users without sudo access. user: name: "{{ item.name }}" shell: /bin/bash state: present - with_items: managed_users + with_items: "{{ managed_users }}" diff --git a/roles/users/tasks/revoke_users.yml b/roles/users/tasks/revoke_users.yml index c81ef2b..c730099 100644 --- a/roles/users/tasks/revoke_users.yml +++ b/roles/users/tasks/revoke_users.yml @@ -13,4 +13,4 @@ user: name: "{{ item }}" state: absent - with_items: revoked_users + with_items: "{{ revoked_users }}" diff --git a/roles/vmhost/tasks/libvirt.yml b/roles/vmhost/tasks/libvirt.yml index cca6b24..451ab9a 100644 --- a/roles/vmhost/tasks/libvirt.yml +++ b/roles/vmhost/tasks/libvirt.yml @@ -49,7 +49,7 @@ - name: See which pools are defined and which are not shell: virsh pool-info {{ item }} - with_items: ls_libvirtpool.stdout_lines + with_items: "{{ ls_libvirtpool.stdout_lines }}" register: pool_info when: srv_libvirtpool.stat.exists # don't bother reporting anything about this command; it's not useful