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

project: update ansible #10020

Closed
wants to merge 17 commits into from
Closed
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
30 changes: 30 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,36 @@ skip_list:
# Roles in kubespray don't need fully qualified collection names
# (Disabled in Feb 2023)
- 'fqcn-builtins'

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

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

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

# order of keys errors
# (Disabled in April 2023 after ansible upgrade; FIXME)
- 'key-order'

# No changed-when on commands
# (Disabled in April 2023 after ansible upgrade; FIXME)
- 'no-changed-when'

# Disable galaxy rules
# (Disabled in April 2023 after ansible upgrade; FIXME)
- 'galaxy'

# Disable run-once check with free strategy
# (Disabled in April 2023 after ansible upgrade; FIXME)
- 'run-once[task]'
exclude_paths:
# Generated files
- tests/files/custom_cni/cilium.yaml
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ variables:
RECOVER_CONTROL_PLANE_TEST: "false"
RECOVER_CONTROL_PLANE_TEST_GROUPS: "etcd[2:],kube_control_plane[1:]"
TERRAFORM_VERSION: 1.3.7
ANSIBLE_MAJOR_VERSION: "2.11"
PIPELINE_IMAGE: "$CI_REGISTRY_IMAGE/pipeline:${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}"

before_script:
- ./tests/scripts/rebase.sh
- update-alternatives --install /usr/bin/python python /usr/bin/python3 1
- python -m pip uninstall -y ansible ansible-base ansible-core
- python -m pip install -r tests/requirements-${ANSIBLE_MAJOR_VERSION}.txt
- python -m pip install -r tests/requirements.txt
- ansible-galaxy install -r tests/requirements.yml
- mkdir -p /.ssh

.job: &job
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ tox-inventory-builder:
- update-alternatives --install /usr/bin/python python /usr/bin/python3 10
- python -m pip uninstall -y ansible ansible-base ansible-core
- python -m pip install -r tests/requirements.txt
- ansible-galaxy install -r tests/requirements.yml
script:
- pip3 install tox
- cd contrib/inventory_builder && tox
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- update-alternatives --install /usr/bin/python python /usr/bin/python3 10
- python -m pip uninstall -y ansible ansible-base ansible-core
- python -m pip install -r tests/requirements.txt
- ansible-galaxy install -r tests/requirements.yml
- ./tests/scripts/vagrant_clean.sh
script:
- ./tests/scripts/molecule_run.sh
Expand Down
8 changes: 0 additions & 8 deletions .gitlab-ci/packet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ packet_ubuntu20-calico-aio:
variables:
RESET_CHECK: "true"

packet_ubuntu20-calico-aio-ansible-2_11:
stage: deploy-part1
extends: .packet_periodic
when: on_success
variables:
ANSIBLE_MAJOR_VERSION: "2.11"
RESET_CHECK: "true"

# ### PR JOBS PART2

packet_ubuntu18-aio-docker:
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- update-alternatives --install /usr/bin/python python /usr/bin/python3 10
- python -m pip uninstall -y ansible ansible-base ansible-core
- python -m pip install -r tests/requirements.txt
- ansible-galaxy install -r tests/requirements.yml
- ./tests/scripts/vagrant_clean.sh
script:
- ./tests/scripts/testcases_run.sh
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To install development dependencies you can set up a python virtual env with the
virtualenv venv
source venv/bin/activate
pip install -r tests/requirements.txt
ansible-galaxy install -r tests/requirements.yml
```

#### Linting
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:jammy-20230308
# Some tools like yamllint need this
# Pip needs this as well at the moment to install ansible
# (and potentially other packages)
# (and potentially other packages)
# See: https://github.com/pypa/pip/issues/10219
ENV LANG=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
Expand All @@ -25,8 +25,8 @@ RUN apt update -q \
rsync \
openssh-client \
&& pip install --no-compile --no-cache-dir \
ansible==5.7.1 \
ansible-core==2.12.5 \
ansible==7.4.0 \
ansible-core==2.14.4 \
cryptography==3.4.8 \
jinja2==3.1.2 \
netaddr==0.8.0 \
Expand Down
4 changes: 2 additions & 2 deletions contrib/dind/roles/dind-cluster/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
package:
name: "{{ item }}"
state: present
with_items: "{{ distro_extra_packages }} + [ 'rsyslog', 'openssh-server' ]"
with_items: "{{ distro_extra_packages + [ 'rsyslog', 'openssh-server' ] }}"

- name: Start needed services
service:
Expand All @@ -67,7 +67,7 @@
mode: 0640

- name: Add my pubkey to "{{ distro_user }}" user authorized keys
authorized_key:
ansible.posix.authorized_key:
user: "{{ distro_user }}"
state: present
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
2 changes: 1 addition & 1 deletion contrib/dind/roles/dind-host/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
distro_agetty_svc: "{{ distro_setup['agetty_svc'] }}"

- name: Create dind node containers from "containers" inventory section
docker_container:
community.docker.docker_container:
image: "{{ distro_image }}"
name: "{{ item }}"
state: started
Expand Down
14 changes: 10 additions & 4 deletions contrib/inventory_builder/tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = pep8, py33
envlist = pep8

[testenv]
whitelist_externals = py.test
allowlist_externals = py.test
usedevelop = True
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
setenv = VIRTUAL_ENV={envdir}
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
passenv =
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
commands = pytest -vv #{posargs:./tests}

[testenv:pep8]
usedevelop = False
whitelist_externals = bash
allowlist_externals = bash
commands =
bash -c "find {toxinidir}/* -type f -name '*.py' -print0 | xargs -0 flake8"

Expand Down
4 changes: 2 additions & 2 deletions contrib/kvm-setup/kvm-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
gather_facts: False
become: yes
vars:
- bootstrap_os: none
bootstrap_os: none
roles:
- kvm-setup
- { role: kvm-setup }
4 changes: 2 additions & 2 deletions contrib/kvm-setup/roles/kvm-setup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
when: ansible_os_family == "Debian"

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

# Set proper sysctl values
- include: sysctl.yml
- import_tasks: sysctl.yml
6 changes: 3 additions & 3 deletions contrib/kvm-setup/roles/kvm-setup/tasks/sysctl.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Load br_netfilter module
modprobe:
community.general.modprobe:
name: br_netfilter
state: present
register: br_netfilter
Expand All @@ -25,15 +25,15 @@


- name: Enable net.ipv4.ip_forward in sysctl
sysctl:
ansible.posix.sysctl:
name: net.ipv4.ip_forward
value: 1
sysctl_file: "{{ sysctl_file_path }}"
state: present
reload: yes

- name: Set bridge-nf-call-{arptables,iptables} to 0
sysctl:
ansible.posix.sysctl:
name: "{{ item }}"
state: present
value: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ galaxy_info:
description: GlusterFS installation for Linux.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
min_ansible_version: "2.0"
platforms:
- name: EL
versions:
- 6
- 7
- "6"
- "7"
- name: Ubuntu
versions:
- precise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
# hyperkube and needs to be installed as part of the system.

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

- include: setup-Debian.yml
- include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian' and groups['gfs-cluster'] is defined

- name: Ensure Gluster mount directories exist.
file: "path={{ item }} state=directory mode=0775"
file:
path: "{{ item }}"
state: directory
mode: 0775
with_items:
- "{{ gluster_mount_dir }}"
when: ansible_os_family in ["Debian","RedHat"] and groups['gfs-cluster'] is defined
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
- name: Install Prerequisites
package: name={{ item }} state=present
package:
name: "{{ item }}"
state: present
with_items:
- "centos-release-gluster{{ glusterfs_default_release }}"

- name: Install Packages
package: name={{ item }} state=present
package:
name: "{{ item }}"
state: present
with_items:
- glusterfs-client
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ galaxy_info:
description: GlusterFS installation for Linux.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
min_ansible_version: "2.0"
platforms:
- name: EL
versions:
- 6
- 7
- "6"
- "7"
- name: Ubuntu
versions:
- precise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,55 @@

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

- name: install xfs RedHat
package: name=xfsprogs state=present
package:
name: xfsprogs
state: present
when: ansible_os_family == "RedHat"

# Format external volumes in xfs
- name: Format volumes in xfs
filesystem: "fstype=xfs dev={{ disk_volume_device_1 }}"
community.general.filesystem:
fstype: xfs
dev: "{{ disk_volume_device_1 }}"

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

# Setup/install tasks.
- include: setup-RedHat.yml
- include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat'

- include: setup-Debian.yml
- include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian'

- name: Ensure GlusterFS is started and enabled at boot.
service: "name={{ glusterfs_daemon }} state=started enabled=yes"
service:
name: "{{ glusterfs_daemon }}"
state: started
enabled: yes

- name: Ensure Gluster brick and mount directories exist.
file: "path={{ item }} state=directory mode=0775"
file:
path: "{{ item }}"
state: directory
mode: 0775
with_items:
- "{{ gluster_brick_dir }}"
- "{{ gluster_mount_dir }}"

- name: Configure Gluster volume with replicas
gluster_volume:
gluster.gluster.gluster_volume:
state: present
name: "{{ gluster_brick_name }}"
brick: "{{ gluster_brick_dir }}"
Expand All @@ -49,7 +65,7 @@
when: groups['gfs-cluster']|length > 1

- name: Configure Gluster volume without replicas
gluster_volume:
gluster.gluster.gluster_volume:
state: present
name: "{{ gluster_brick_name }}"
brick: "{{ gluster_brick_dir }}"
Expand All @@ -60,7 +76,7 @@
when: groups['gfs-cluster']|length <= 1

- name: Mount glusterfs to retrieve disk size
mount:
ansible.posix.mount:
name: "{{ gluster_mount_dir }}"
src: "{{ ip|default(ansible_default_ipv4['address']) }}:/gluster"
fstype: glusterfs
Expand All @@ -69,7 +85,8 @@
when: groups['gfs-cluster'] is defined and inventory_hostname == groups['gfs-cluster'][0]

- name: Get Gluster disk size
setup: filter=ansible_mounts
setup:
filter: ansible_mounts
register: mounts_data
when: groups['gfs-cluster'] is defined and inventory_hostname == groups['gfs-cluster'][0]

Expand All @@ -86,7 +103,7 @@
when: groups['gfs-cluster'] is defined and inventory_hostname == groups['gfs-cluster'][0]

- name: Unmount glusterfs
mount:
ansible.posix.mount:
name: "{{ gluster_mount_dir }}"
fstype: glusterfs
src: "{{ ip|default(ansible_default_ipv4['address']) }}:/gluster"
Expand Down
Loading