Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve ansible-lint name errors #10253

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@ skip_list:
# (Disabled in Feb 2023)
- 'fqcn-builtins'

# names should start with an uppercase letter
# (Disabled in June 2023 after ansible upgrade; FIXME)
- 'name[casing]'

# Everything should be named
# (Disabled in June 2023 after ansible upgrade; FIXME)
- 'name[play]'
- 'name[missing]'

# templates should only be at the end of 'name'
# (Disabled in June 2023 after ansible upgrade; FIXME)
- 'name[jinja]'
# We use template in names
- 'name[template]'

# order of keys errors
Expand Down
3 changes: 2 additions & 1 deletion contrib/azurerm/generate-inventory.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: localhost
- name: Generate Azure inventory
hosts: localhost
gather_facts: False
roles:
- generate-inventory
3 changes: 2 additions & 1 deletion contrib/azurerm/generate-inventory_2.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: localhost
- name: Generate Azure inventory
hosts: localhost
gather_facts: False
roles:
- generate-inventory_2
3 changes: 2 additions & 1 deletion contrib/azurerm/generate-templates.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: localhost
- name: Generate Azure templates
hosts: localhost
gather_facts: False
roles:
- generate-templates
6 changes: 4 additions & 2 deletions contrib/dind/dind-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
- hosts: localhost
- name: Create nodes as docker containers
hosts: localhost
gather_facts: False
roles:
- { role: dind-host }

- hosts: containers
- name: Customize each node containers
hosts: containers
roles:
- { role: dind-cluster }
6 changes: 3 additions & 3 deletions contrib/dind/roles/dind-cluster/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
- name: set_fact distro_setup
- name: Set_fact distro_setup
set_fact:
distro_setup: "{{ distro_settings[node_distro] }}"

- name: set_fact other distro settings
- name: Set_fact other distro settings
set_fact:
distro_user: "{{ distro_setup['user'] }}"
distro_ssh_service: "{{ distro_setup['ssh_service'] }}"
Expand Down Expand Up @@ -66,7 +66,7 @@
dest: "/etc/sudoers.d/{{ distro_user }}"
mode: 0640

- name: Add my pubkey to "{{ distro_user }}" user authorized keys
- name: "Add my pubkey to {{ distro_user }} user authorized keys"
ansible.posix.authorized_key:
user: "{{ distro_user }}"
state: present
Expand Down
4 changes: 2 additions & 2 deletions contrib/dind/roles/dind-host/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
- name: set_fact distro_setup
- name: Set_fact distro_setup
set_fact:
distro_setup: "{{ distro_settings[node_distro] }}"

- name: set_fact other distro settings
- name: Set_fact other distro settings
set_fact:
distro_image: "{{ distro_setup['image'] }}"
distro_init: "{{ distro_setup['init'] }}"
Expand Down
3 changes: 2 additions & 1 deletion contrib/kvm-setup/kvm-setup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: localhost
- name: Prepare Hypervisor to later install kubespray VMs
hosts: localhost
gather_facts: False
become: yes
vars:
Expand Down
8 changes: 4 additions & 4 deletions contrib/kvm-setup/roles/kvm-setup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
- ntp
when: ansible_os_family == "Debian"

# Create deployment user if required
- include_tasks: user.yml
- name: Create deployment user if required
include_tasks: user.yml
when: k8s_deployment_user is defined

# Set proper sysctl values
- import_tasks: sysctl.yml
- name: Set proper sysctl values
import_tasks: sysctl.yml
11 changes: 6 additions & 5 deletions contrib/mitogen/mitogen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
- name: Check ansible version
import_playbook: kubernetes_sigs.kubespray.ansible_version

- hosts: localhost
- name: Install mitogen
hosts: localhost
strategy: linear
vars:
mitogen_version: 0.3.2
Expand All @@ -19,24 +20,24 @@
- "{{ playbook_dir }}/plugins/mitogen"
- "{{ playbook_dir }}/dist"

- name: download mitogen release
- name: Download mitogen release
get_url:
url: "{{ mitogen_url }}"
dest: "{{ playbook_dir }}/dist/mitogen_{{ mitogen_version }}.tar.gz"
validate_certs: true
mode: 0644

- name: extract archive
- name: Extract archive
unarchive:
src: "{{ playbook_dir }}/dist/mitogen_{{ mitogen_version }}.tar.gz"
dest: "{{ playbook_dir }}/dist/"

- name: copy plugin
- name: Copy plugin
ansible.posix.synchronize:
src: "{{ playbook_dir }}/dist/mitogen-{{ mitogen_version }}/"
dest: "{{ playbook_dir }}/plugins/mitogen"

- name: add strategy to ansible.cfg
- name: Add strategy to ansible.cfg
community.general.ini_file:
path: ansible.cfg
mode: 0644
Expand Down
15 changes: 10 additions & 5 deletions contrib/network-storage/glusterfs/glusterfs.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
---
- hosts: gfs-cluster
- name: Bootstrap hosts
hosts: gfs-cluster
gather_facts: false
vars:
ansible_ssh_pipelining: false
roles:
- { role: bootstrap-os, tags: bootstrap-os}

- hosts: all
- name: Gather facts
hosts: all
gather_facts: true

- hosts: gfs-cluster
- name: Install glusterfs server
hosts: gfs-cluster
vars:
ansible_ssh_pipelining: true
roles:
- { role: glusterfs/server }

- hosts: k8s_cluster
- name: Install glusterfs servers
hosts: k8s_cluster
roles:
- { role: glusterfs/client }

- hosts: kube_control_plane[0]
- name: Configure Kubernetes to use glusterfs
hosts: kube_control_plane[0]
roles:
- { role: kubernetes-pv }
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# hyperkube and needs to be installed as part of the system.

# Setup/install tasks.
- include_tasks: setup-RedHat.yml
- name: Setup RedHat distros for glusterfs
include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat' and groups['gfs-cluster'] is defined

- include_tasks: setup-Debian.yml
- name: Setup Debian distros for glusterfs
include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian' and groups['gfs-cluster'] is defined

- name: Ensure Gluster mount directories exist.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
include_vars: "{{ ansible_os_family }}.yml"

# Install xfs package
- name: install xfs Debian
- name: Install xfs Debian
apt:
name: xfsprogs
state: present
when: ansible_os_family == "Debian"

- name: install xfs RedHat
- name: Install xfs RedHat
package:
name: xfsprogs
state: present
Expand All @@ -23,18 +23,20 @@
dev: "{{ disk_volume_device_1 }}"

# Mount external volumes
- name: mounting new xfs filesystem
- name: Mounting new xfs filesystem
ansible.posix.mount:
name: "{{ gluster_volume_node_mount_dir }}"
src: "{{ disk_volume_device_1 }}"
fstype: xfs
state: mounted

# Setup/install tasks.
- include_tasks: setup-RedHat.yml
- name: Setup RedHat distros for glusterfs
include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat'

- include_tasks: setup-Debian.yml
- name: Setup Debian distros for glusterfs
include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian'

- name: Ensure GlusterFS is started and enabled at boot.
Expand Down
6 changes: 4 additions & 2 deletions contrib/network-storage/heketi/heketi-tear-down.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
- hosts: kube_control_plane[0]
- name: Tear down heketi
hosts: kube_control_plane[0]
roles:
- { role: tear-down }

- hosts: heketi-node
- name: Teardown disks in heketi
hosts: heketi-node
become: yes
roles:
- { role: tear-down-disks }
6 changes: 4 additions & 2 deletions contrib/network-storage/heketi/heketi.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
- hosts: heketi-node
- name: Prepare heketi install
hosts: heketi-node
roles:
- { role: prepare }

- hosts: kube_control_plane[0]
- name: Provision heketi
hosts: kube_control_plane[0]
tags:
- "provision"
roles:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- name: "stop port forwarding"
- name: "Stop port forwarding"
command: "killall "
6 changes: 4 additions & 2 deletions contrib/offline/generate_list.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: localhost
- name: Collect container images for offline deployment
hosts: localhost
become: no

roles:
Expand All @@ -11,7 +12,8 @@

tasks:
# Generate files.list and images.list files from templates.
- template:
- name: Collect container images for offline deployment
template:
src: ./contrib/offline/temp/{{ item }}.list.template
dest: ./contrib/offline/temp/{{ item }}.list
mode: 0644
Expand Down
3 changes: 2 additions & 1 deletion contrib/os-services/os-services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
- hosts: all
- name: Disable firewalld/ufw
hosts: all
roles:
- { role: prepare }
3 changes: 2 additions & 1 deletion contrib/os-services/roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- block:
- name: Disable firewalld and ufw
block:
- name: List services
service_facts:

Expand Down
6 changes: 4 additions & 2 deletions extra_playbooks/migrate_openstack_provider.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
- hosts: kube_node:kube_control_plane
- name: Remove old cloud provider config
hosts: kube_node:kube_control_plane
tasks:
- name: Remove old cloud provider config
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/kubernetes/cloud_config
- hosts: kube_control_plane[0]
- name: Migrate intree Cinder PV
hosts: kube_control_plane[0]
tasks:
- name: Include kubespray-default variables
include_vars: ../roles/kubespray-defaults/defaults/main.yaml
Expand Down
9 changes: 6 additions & 3 deletions extra_playbooks/upgrade-only-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
### In most cases, you probably want to use upgrade-cluster.yml playbook and
### not this one.

- hosts: localhost
- name: Setup ssh config to use the bastion
hosts: localhost
gather_facts: False
roles:
- { role: kubespray-defaults}
- { role: bastion-ssh-config, tags: ["localhost", "bastion"]}

- hosts: k8s_cluster:etcd:calico_rr
- name: Bootstrap hosts OS for Ansible
hosts: k8s_cluster:etcd:calico_rr
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
gather_facts: false
vars:
Expand All @@ -27,7 +29,8 @@
- { role: kubespray-defaults}
- { role: bootstrap-os, tags: bootstrap-os}

- hosts: k8s_cluster:etcd:calico_rr
- name: Preinstall
hosts: k8s_cluster:etcd:calico_rr
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
roles:
- { role: kubespray-defaults}
Expand Down
3 changes: 2 additions & 1 deletion extra_playbooks/wait-for-cloud-init.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: all
- name: Wait for cloud-init to finish
hosts: all
tasks:
- name: Wait for cloud-init to finish
command: cloud-init status --wait
3 changes: 2 additions & 1 deletion playbooks/ansible_version.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: localhost
- name: Check Ansible version
hosts: localhost
gather_facts: false
become: no
vars:
Expand Down
Loading