Update ansible-lint to 3.4.1

This patch updates all playbooks to ensure compliance
with ansible-lint 3.4.1 and also implements updates
to the distro/pip package install tasks to ensure
that they use the appropriate variables designed for
setting state.

Additionally the utility playbook is set to use upper
constraints when installing packages.

Change-Id: I534388930317daf370cf6c943d62d1e50184ead9
This commit is contained in:
Logan V 2016-10-28 13:47:30 +02:00 committed by Jesse Pretorius (odyssey4me)
parent 39a10ef644
commit b70a0276f4
12 changed files with 30 additions and 26 deletions

View File

@ -38,6 +38,7 @@ tempest_service_available_swift: "{{ groups['swift_all'] is defined and groups['
# Ensure that the package state matches the global setting
utility_package_state: "{{ package_state }}"
utility_pip_package_state: "latest"
# Distribution packages to be installed into the utility container
utility_distro_packages:

View File

@ -85,7 +85,7 @@
tags:
- always
- name: Add net/tun device to the compute
shell: |
command: |
lxc-device -n {{ container_name }} add /dev/net/tun /dev/net/tun
delegate_to: "{{ physical_host }}"
when:
@ -104,7 +104,7 @@
tags:
- always
- name: Add kvm device to the compute
shell: |
command: |
lxc-device -n {{ container_name }} add /dev/kvm /dev/kvm
delegate_to: "{{ physical_host }}"
register: device_add

View File

@ -21,7 +21,8 @@
key: repo_servers_{{ ansible_architecture }}
tags:
- always
- local_action:
- name: Prepare group of master repo servers
local_action:
module: "add_host"
name: "{{ item }}"
groups: "repo_nodes"
@ -70,7 +71,7 @@
- _local_git_cache.stat.exists
- name: Check if the repo container bind mount is empty
local_action: shell
local_action: command
ls -1A {{ repo_build_git_bind_mount }}
register: _local_repo_bind_mount_contents
when:

View File

@ -59,14 +59,14 @@
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
state: "{{ utility_package_state }}"
with_items: "{{ utility_distro_packages | default([]) }}"
when: ansible_pkg_mgr == 'apt'
- name: Install yum packages
yum:
pkg: "{{ item }}"
state: latest
state: "{{ utility_package_state }}"
with_items: "{{ utility_distro_packages | default([]) }}"
when: ansible_pkg_mgr == 'yum'
@ -82,8 +82,10 @@
- name: Install pip packages
pip:
name: "{{ client_list.stdout_lines | union(utility_pip_packages) | join(' ') }}"
state: latest
extra_args: "{{ pip_install_options|default('') }}"
state: "{{ utility_pip_package_state }}"
extra_args: >-
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
register: install_packages
until: install_packages|success
retries: 5

View File

@ -21,7 +21,7 @@
- apt-install-prerequisites
- name: Determine the existing Ubuntu repo configuration
shell: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }} main)" /etc/apt/sources.list'
command: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }} main)" /etc/apt/sources.list'
register: ubuntu_repo
when:
- bootstrap_host_ubuntu_repo is not defined
@ -30,7 +30,7 @@
- find-apt-repo
- name: Determine the existing Ubuntu Security repo configuration
shell: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }}-security main)" /etc/apt/sources.list'
command: 'grep -oP "^deb \K(\[?.*\]?.*ubuntu\S*\/?)(?= {{ ansible_distribution_release }}-security main)" /etc/apt/sources.list'
register: ubuntu_security_repo
when:
- bootstrap_host_ubuntu_security_repo is not defined

View File

@ -55,7 +55,8 @@
- deploy-user-secrets
- name: Generate any missing values in user_secrets
shell: ../scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
command: ../scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
changed_when: false
tags:
- generate_secrets
@ -84,7 +85,7 @@
register: pip_conf_file
- name: Determine the fastest available OpenStack-Infra wheel mirror
shell: ../scripts/fastest-infra-wheel-mirror.py
command: ../scripts/fastest-infra-wheel-mirror.py
register: fastest_wheel_mirror
when: not pip_conf_file.stat.exists

View File

@ -40,7 +40,7 @@
- "{{ ansible_mounts }}"
- name: Partition the whole data disk for our usage
shell: "{{ item }}"
command: "{{ item }}"
when: data_disk_partitions.rc == 1 or bootstrap_host_data_disk_device_force | bool
with_items:
- "parted --script /dev/{{ bootstrap_host_data_disk_device | regex_replace('!','/') }} mklabel gpt"

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Create sparse Cinder file
shell: "truncate -s {{ bootstrap_host_loopback_cinder_size }}G /openstack/cinder.img"
command: "truncate -s {{ bootstrap_host_loopback_cinder_size }}G /openstack/cinder.img"
args:
creates: /openstack/cinder.img
register: cinder_create
@ -22,14 +22,14 @@
- cinder-file-create
- name: Get a loopback device for cinder file
shell: losetup -f
command: losetup -f
when: cinder_create | changed
register: cinder_losetup
tags:
- cinder-device-get
- name: Create the loopback device
shell: "losetup {{ cinder_losetup.stdout }} /openstack/cinder.img"
command: "losetup {{ cinder_losetup.stdout }} /openstack/cinder.img"
when: cinder_create | changed
tags:
- cinder-device-create
@ -55,7 +55,7 @@
- cinder-rc-config
- name: Make LVM physical volume on the cinder device
shell: "{{ item }}"
command: "{{ item }}"
when: cinder_create | changed
with_items:
- "pvcreate {{ cinder_losetup.stdout }}"
@ -70,4 +70,3 @@
when: cinder_create | changed
tags:
- cinder-lvm-vg

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Create sparse Nova file
shell: "truncate -s {{ bootstrap_host_loopback_nova_size }}G /openstack/nova.img"
command: "truncate -s {{ bootstrap_host_loopback_nova_size }}G /openstack/nova.img"
args:
creates: /openstack/nova.img
register: nova_create

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Create swap file
shell: "fallocate -l {{ bootstrap_host_swap_size }}G /openstack/swap.img"
command: "fallocate -l {{ bootstrap_host_swap_size }}G /openstack/swap.img"
args:
creates: /openstack/swap.img
register: swap_create
@ -29,7 +29,7 @@
- swap-permissions
- name: Format the swap file
shell: mkswap /openstack/swap.img
command: mkswap /openstack/swap.img
when: swap_create | changed
tags:
- swap-format
@ -47,7 +47,8 @@
- swap-fstab
- name: Bring swap file online
shell: swapon /openstack/swap.img
command: swapon /openstack/swap.img
changed_when: false
tags:
- swap-online
@ -58,4 +59,3 @@
state: present
tags:
- swap-sysctl

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Create sparse Swift files
shell: "truncate -s {{ bootstrap_host_loopback_swift_size }}G /openstack/{{ item }}.img"
command: "truncate -s {{ bootstrap_host_loopback_swift_size }}G /openstack/{{ item }}.img"
args:
creates: "/openstack/{{ item }}.img"
with_items:

View File

@ -90,8 +90,8 @@ commands =
[testenv:ansible]
deps =
{[testenv]deps}
ansible==2.1.0
ansible-lint>=2.7.0,<3.0.0
ansible==2.2.0
ansible-lint<=3.4.1
setenv =
{[testenv]setenv}
ANSIBLE_HOST_KEY_CHECKING = False