Fix ansible-lint.sh script for roles.
- According to the ansible-lint documentation, we can pass a role directory as an argument. But due to https://github.com/willthames/ansible-lint/issues/210, the role directory has to contain a trailing slash! - This patch fixes the following ansible-lint rules: * ANSIBLE0004: Git checkouts must contain explicit version * ANSIBLE0008: Deprecated sudo * ANSIBLE0011: All tasks should be named * ANSIBLE0014: Environment variables don't work as part of command * ANSIBLE0015: Using bare variables is deprecated - Temporarily skipping the following ansible-lint rules (Fixes will be part of others patches): * ANSIBLE0007: Using command rather than an argument to e.g file We have a lot of 'rm' command and we should use file module instead * ANSIBLE0012: Commands should not change things if nothing needs doing * ANSIBLE0013: Use Shell only when shell functionality is required Change-Id: I3d5591ea9fd1691e8115d7093db87781a08a6082 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
parent
a1942bceee
commit
7499fb582a
@ -2,19 +2,40 @@
|
||||
|
||||
# ANSIBLE0006: Using command rather than module
|
||||
# we have a few use cases where we need to use curl and rsync
|
||||
# ANSIBLE0007: Using command rather than an argument to e.g file
|
||||
# we have a lot of 'rm' command and we should use file module instead
|
||||
# ANSIBLE0010: Package installs should not use latest.
|
||||
# Sometimes we need to update some packages.
|
||||
# ANSIBLE0012: Commands should not change things if nothing needs doing
|
||||
# ANSIBLE0013: Use Shell only when shell functionality is required
|
||||
# ANSIBLE0016: Tasks that run when changed should likely be handlers
|
||||
# this requires refactoring roles, skipping for now
|
||||
SKIPLIST="ANSIBLE0006,ANSIBLE0016"
|
||||
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
|
||||
|
||||
function lint_error_check {
|
||||
local rc=$?
|
||||
lint_error=0
|
||||
[ $rc -eq 2 ] && lint_error=1
|
||||
return $lint_error
|
||||
}
|
||||
|
||||
# lint the playbooks separately to avoid linting the roles multiple times
|
||||
pushd playbooks
|
||||
find . -type f -regex '.*\.y[a]?ml' -print0 | xargs -0 ansible-lint -x $SKIPLIST || lint_error=1
|
||||
for playbook in `find . -type f -regex '.*\.y[a]?ml' -print0`; do
|
||||
ansible-lint -x $SKIPLIST $playbook
|
||||
lint_error_check
|
||||
done
|
||||
popd
|
||||
|
||||
# lint all the possible roles
|
||||
find ./roles -type d -print0 | xargs -0 ansible-lint -x $SKIPLIST || lint_error=1
|
||||
# Due to https://github.com/willthames/ansible-lint/issues/210, the roles
|
||||
# directories need to contain a trailing slash at the end of the path.
|
||||
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
|
||||
ansible-lint -x $SKIPLIST $rolesdir/
|
||||
lint_error_check
|
||||
done
|
||||
|
||||
# exit with 1 if we had any error so far
|
||||
if [[ -n "$lint_error" ]]; then
|
||||
# exit with 1 if we had a least an error or warning.
|
||||
if [[ "$lint_error" != 0 ]]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
@ -3,7 +3,7 @@
|
||||
- name: Ensure DLRN package dependencies
|
||||
become: yes
|
||||
yum: name={{ item }} state=present
|
||||
with_flattened:
|
||||
with_items:
|
||||
- createrepo
|
||||
- gcc
|
||||
- git
|
||||
@ -43,6 +43,7 @@
|
||||
git:
|
||||
repo: '{{ artg_dlrn_repo_url }}'
|
||||
dest: '{{ ansible_user_dir }}/DLRN'
|
||||
version: master
|
||||
when: not dlrn_cloned.stat.exists
|
||||
|
||||
#Remove the rpm install test to speed up delorean
|
||||
|
@ -4,7 +4,7 @@
|
||||
block:
|
||||
- name: Ensure required rpms for logging are installed
|
||||
yum: name={{ item }} state=present
|
||||
with_flattened:
|
||||
with_items:
|
||||
- gzip
|
||||
- tar
|
||||
|
||||
@ -100,7 +100,10 @@
|
||||
register: dstat_logfile
|
||||
|
||||
- name: Get dstat_graph tool
|
||||
git: repo="https://github.com/Dabz/dstat_graph.git" dest="/tmp/dstat_graph"
|
||||
git:
|
||||
repo: "https://github.com/Dabz/dstat_graph.git"
|
||||
dest: "/tmp/dstat_graph"
|
||||
version: master
|
||||
when: dstat_logfile.stat.exists
|
||||
|
||||
- name: Generate HTML dstat graphs if it exists
|
||||
|
@ -9,8 +9,8 @@
|
||||
tags:
|
||||
- overcloud-scripts
|
||||
|
||||
- block:
|
||||
when: step_delete_overcloud|bool
|
||||
- when: step_delete_overcloud|bool
|
||||
block:
|
||||
- name: Delete the overcloud
|
||||
shell: |
|
||||
{{ working_dir }}/overcloud-delete.sh > {{ delete_log }} 2>&1
|
||||
@ -18,12 +18,11 @@
|
||||
- overcloud-delete
|
||||
|
||||
- name: check for delete command to complete or fail
|
||||
tasks:
|
||||
- shell: |
|
||||
heat stack-show $(cat {{ working_dir }}/overcloud_id)
|
||||
register: heat_stack_show
|
||||
delay: {{ delete_check_delay }}
|
||||
retries: {{ delete_check_retries }}
|
||||
until: {{ heat_show.stdout.find("DELETE_COMPLETE") }}
|
||||
shell: |
|
||||
heat stack-show $(cat {{ working_dir }}/overcloud_id)
|
||||
delay: "{{ delete_check_delay }}"
|
||||
retries: "{{ delete_check_retries }}"
|
||||
until: "{{ heat_show.stdout.find('DELETE_COMPLETE') }}"
|
||||
register: heat_stack_show
|
||||
tags:
|
||||
- overcloud-delete
|
||||
|
@ -21,7 +21,7 @@ repos_url:
|
||||
- http://trunk.rdoproject.org/centos7-{{ target_upgrade_version }}/{{ upgrade_delorean_hash | default('current-passed-ci')}}/delorean.repo
|
||||
- http://trunk.rdoproject.org/centos7-{{ target_upgrade_version }}/delorean-deps.repo
|
||||
# upgrade settings:
|
||||
upgrade_working_dir: {{ working_dir }}
|
||||
upgrade_working_dir: "{{ working_dir }}"
|
||||
tht_dir: tripleo-heat-templates
|
||||
# scripts
|
||||
undercloud_upgrade_script: upgrade-undercloud.sh.j2
|
||||
|
@ -1,14 +1,14 @@
|
||||
- name: Execute pre-task for upgrade
|
||||
hosts: overcloud
|
||||
gather_facts: no
|
||||
sudo: yes
|
||||
become: yes
|
||||
roles:
|
||||
- { role: ansible-role-tripleo-overcloud-upgrade, tags: ['upgrade-pre-tasks'] }
|
||||
|
||||
- name: Set undercloud repo
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
sudo: yes
|
||||
become: yes
|
||||
roles:
|
||||
- { role: ansible-role-tripleo-overcloud-upgrade, tags: ['upgrade-repo'] }
|
||||
|
||||
|
@ -2,21 +2,27 @@
|
||||
# tasks file for undercloud-setup
|
||||
|
||||
# Add a non-root user
|
||||
- include: non_root_user_setup.yml
|
||||
- name: Including non_root_user_setup tasks list
|
||||
include: non_root_user_setup.yml
|
||||
when: non_root_user_setup|bool
|
||||
|
||||
- include: ovb_setup_connectivity.yml
|
||||
- name: Including ovb_setup_connectivity tasks list
|
||||
include: ovb_setup_connectivity.yml
|
||||
when: ovb_setup_connectivity|bool
|
||||
|
||||
- include_role:
|
||||
- name: Including repo-setup role
|
||||
include_role:
|
||||
name: repo-setup
|
||||
|
||||
- include: package_installs.yml
|
||||
- name: Including package_installs tasks
|
||||
include: package_installs.yml
|
||||
when: package_installs|bool
|
||||
|
||||
- include: toci_vxlan_networking.yml
|
||||
- name: Including toci_vxlan_networking tasks
|
||||
include: toci_vxlan_networking.yml
|
||||
when: toci_vxlan_networking|bool
|
||||
|
||||
- include: hostname.yml
|
||||
- name: Including hostname tasks
|
||||
include: hostname.yml
|
||||
when: hostname_correction|bool or step_set_undercloud_hostname|bool
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
---
|
||||
- name: Cloning stackviz from openstack
|
||||
git: repo=git://git.openstack.org/openstack/stackviz dest="{{ working_dir }}/stackviz"
|
||||
git:
|
||||
repo: git://git.openstack.org/openstack/stackviz
|
||||
dest: "{{ working_dir }}/stackviz"
|
||||
version: master
|
||||
|
||||
- name: Copying stackviz static files
|
||||
synchronize:
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
- name: undefine vms
|
||||
virt: command=undefine name={{ item }}
|
||||
with_items: vms.list_vms
|
||||
with_items: "{{ vms.list_vms }}"
|
||||
|
||||
- name: destroy any remaining vms
|
||||
virt : command=destroy name={{ item }}
|
||||
with_items: vms.list_vms
|
||||
with_items: "{{ vms.list_vms }}"
|
||||
|
||||
- name: remove images from /var/lib/libvirt/images
|
||||
shell: rm -rf /var/lib/libvirt/images/*.qcow2
|
||||
@ -57,10 +57,15 @@
|
||||
become: yes
|
||||
shell: rm -rf /home/stack/.config/libvirt
|
||||
|
||||
- name: get user_id for stack user
|
||||
shell: >
|
||||
cat /etc/passwd | grep stack | awk -F ':' '{ print $3 }'
|
||||
register: user_id
|
||||
|
||||
- name: destroy /run/user/ for stack
|
||||
shell: >
|
||||
user_id=`cat /etc/passwd | grep stack | awk -F ':' '{ print $3 }'`;
|
||||
rm -Rf /run/user/$user_id/libvirt
|
||||
rm -Rf /run/user/{{ item }}/libvirt
|
||||
with_items: "{{ user_id.sdtout }}"
|
||||
|
||||
- name: destroy virbr0 network if present
|
||||
command: brctl delbr virbr0
|
||||
@ -127,7 +132,7 @@
|
||||
- name: remove any instack rpms from the host
|
||||
yum: name={{item}} state=absent
|
||||
ignore_errors: yes
|
||||
with_flattened:
|
||||
with_items:
|
||||
- instack-*
|
||||
- rdo-release
|
||||
- rhos-release
|
||||
@ -176,9 +181,9 @@
|
||||
yum: name={{item}} state=absent
|
||||
ignore_errors: yes
|
||||
with_flattened:
|
||||
- director_rpms.stdout_lines
|
||||
- rhos_rpms.stdout_lines
|
||||
- delorean_rpms.stdout_lines
|
||||
- "{{ director_rpms.stdout_lines }}"
|
||||
- "{{ rhos_rpms.stdout_lines }}"
|
||||
- "{{ delorean_rpms.stdout_lines }}"
|
||||
|
||||
# this task *MUST* be the last task that is run
|
||||
- name: remove all the yum repos <nuke>
|
||||
|
Loading…
x
Reference in New Issue
Block a user