Auto-fix usage of modules via FQCN

Since ansible-core 2.10 it is recommended to use modules via FQCN
In order to align with recommendation, we perform migration
by applying suggestions made by `ansible-lint --fix=fqcn`

Change-Id: Ibf7bac98d8ca25801a2abd0f4b195d6a248e6589
This commit is contained in:
Dmitriy Rabotyagov
2025-02-12 08:36:03 +01:00
parent 5f1a3b2da1
commit 6f02bcf4af
12 changed files with 76 additions and 78 deletions

View File

@@ -14,13 +14,13 @@
# limitations under the License. # limitations under the License.
- name: Restart sysstat - name: Restart sysstat
service: ansible.builtin.service:
name: "sysstat" name: "sysstat"
state: "restarted" state: "restarted"
enabled: "yes" enabled: "yes"
- name: Restart systemd-journald - name: Restart systemd-journald
service: ansible.builtin.service:
name: systemd-journald name: systemd-journald
state: restarted state: restarted
enabled: true enabled: true
@@ -30,5 +30,5 @@
delay: 2 delay: 2
- name: Systemd daemon reload - name: Systemd daemon reload
systemd: ansible.builtin.systemd:
daemon_reload: true daemon_reload: true

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Check Kernel Version - name: Check Kernel Version
fail: ansible.builtin.fail:
msg: > msg: >
Wrong kernel Version found Wrong kernel Version found
[ {{ ansible_facts['kernel'] }} < {{ openstack_host_required_kernel }} ] [ {{ ansible_facts['kernel'] }} < {{ openstack_host_required_kernel }} ]
@@ -23,7 +23,7 @@
- ansible_facts['kernel'] is version(openstack_host_required_kernel, '<') - ansible_facts['kernel'] is version(openstack_host_required_kernel, '<')
- name: Install distro packages for bare metal nodes - name: Install distro packages for bare metal nodes
package: ansible.builtin.package:
name: "{{ openstack_host_metal_distro_packages }}" name: "{{ openstack_host_metal_distro_packages }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
register: install_packages register: install_packages
@@ -32,7 +32,7 @@
delay: 2 delay: 2
- name: Install user defined extra distro packages for bare metal nodes - name: Install user defined extra distro packages for bare metal nodes
package: ansible.builtin.package:
name: "{{ openstack_host_extra_metal_distro_packages }}" name: "{{ openstack_host_extra_metal_distro_packages }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
when: when:
@@ -43,14 +43,14 @@
delay: 2 delay: 2
- name: Check how kernel modules are implemented (statically builtin, dynamic, not set) - name: Check how kernel modules are implemented (statically builtin, dynamic, not set)
slurp: ansible.builtin.slurp:
src: "/boot/config-{{ ansible_facts['kernel'] }}" src: "/boot/config-{{ ansible_facts['kernel'] }}"
register: modules register: modules
when: when:
- openstack_host_specific_kernel_modules | length > 0 - openstack_host_specific_kernel_modules | length > 0
- name: Fail fast if we can't load a module - name: Fail fast if we can't load a module
fail: ansible.builtin.fail:
msg: "{{ item.pattern }} is not set" msg: "{{ item.pattern }} is not set"
with_items: "{{ openstack_host_specific_kernel_modules }}" with_items: "{{ openstack_host_specific_kernel_modules }}"
when: when:
@@ -58,7 +58,7 @@
- (modules.content | b64decode).find(item.pattern + ' is not set') != -1 - (modules.content | b64decode).find(item.pattern + ' is not set') != -1
- name: "Load kernel module(s)" - name: "Load kernel module(s)"
modprobe: community.general.modprobe:
name: "{{ item.name }}" name: "{{ item.name }}"
with_items: "{{ openstack_host_kernel_modules + openstack_host_specific_kernel_modules }}" with_items: "{{ openstack_host_kernel_modules + openstack_host_specific_kernel_modules }}"
when: when:
@@ -66,13 +66,13 @@
- item.pattern is undefined or (item.pattern is defined and (modules.content | b64decode).find(item.pattern + '=m') != -1) - item.pattern is undefined or (item.pattern is defined and (modules.content | b64decode).find(item.pattern + '=m') != -1)
- name: Write list of modules to load at boot - name: Write list of modules to load at boot
template: ansible.builtin.template:
src: modprobe.conf.j2 src: modprobe.conf.j2
dest: "{{ openstack_host_module_file }}" dest: "{{ openstack_host_module_file }}"
mode: "0644" mode: "0644"
- name: Adding new system tuning - name: Adding new system tuning
sysctl: ansible.posix.sysctl:
name: "{{ item.key }}" name: "{{ item.key }}"
value: "{{ item.value }}" value: "{{ item.value }}"
sysctl_set: "{{ item.set | default('yes') }}" sysctl_set: "{{ item.set | default('yes') }}"
@@ -83,12 +83,12 @@
failed_when: false failed_when: false
- name: Configure sysstat - name: Configure sysstat
include_tasks: openstack_sysstat.yml ansible.builtin.include_tasks: openstack_sysstat.yml
when: when:
- openstack_host_sysstat_enabled | bool - openstack_host_sysstat_enabled | bool
- name: Create a directory to hold systemd journals on disk - name: Create a directory to hold systemd journals on disk
file: ansible.builtin.file:
path: /var/log/journal path: /var/log/journal
state: directory state: directory
owner: root owner: root

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Gather variables for each operating system - name: Gather variables for each operating system
include_vars: "{{ lookup('first_found', params) }}" ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars: vars:
params: params:
files: files:
@@ -29,7 +29,7 @@
- always - always
- name: Allow the usage of local facts - name: Allow the usage of local facts
file: ansible.builtin.file:
path: /etc/ansible/facts.d/ path: /etc/ansible/facts.d/
state: directory state: directory
mode: "0755" mode: "0755"
@@ -38,13 +38,13 @@
# Deploy the release file everywhere # Deploy the release file everywhere
- name: Importing openstack_release tasks - name: Importing openstack_release tasks
import_tasks: openstack_release.yml ansible.builtin.import_tasks: openstack_release.yml
tags: tags:
- openstack_hosts-install - openstack_hosts-install
# Proxy configuration applies to all nodes # Proxy configuration applies to all nodes
- name: Add global_environment_variables to environment file - name: Add global_environment_variables to environment file
blockinfile: ansible.builtin.blockinfile:
dest: "/etc/environment" dest: "/etc/environment"
state: present state: present
marker: "# {mark} Managed by OpenStack-Ansible" marker: "# {mark} Managed by OpenStack-Ansible"
@@ -54,7 +54,7 @@
- openstack_hosts-config - openstack_hosts-config
- name: Ensure environement is applied during sudo - name: Ensure environement is applied during sudo
lineinfile: ansible.builtin.lineinfile:
path: /etc/pam.d/sudo path: /etc/pam.d/sudo
line: "session required pam_env.so readenv=1 user_readenv=0" line: "session required pam_env.so readenv=1 user_readenv=0"
regexp: "session\\s+required\\s+pam_env\\.so" regexp: "session\\s+required\\s+pam_env\\.so"
@@ -62,7 +62,7 @@
when: ansible_facts['distribution'] | lower == 'debian' when: ansible_facts['distribution'] | lower == 'debian'
- name: Create systemd global directory - name: Create systemd global directory
file: ansible.builtin.file:
path: /etc/systemd/system.conf.d/ path: /etc/systemd/system.conf.d/
state: directory state: directory
owner: "root" owner: "root"
@@ -82,7 +82,7 @@
# Configure host files should apply to all nodes # Configure host files should apply to all nodes
- name: Configure etc hosts files - name: Configure etc hosts files
include_tasks: openstack_update_hosts_file.yml ansible.builtin.include_tasks: openstack_update_hosts_file.yml
args: args:
apply: apply:
tags: tags:
@@ -94,7 +94,7 @@
- always - always
- name: Remove the blacklisted packages - name: Remove the blacklisted packages
package: ansible.builtin.package:
name: "{{ openstack_hosts_package_list | selectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}" name: "{{ openstack_hosts_package_list | selectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}"
state: absent state: absent
@@ -103,11 +103,11 @@
# It is also used for installing common packages to # It is also used for installing common packages to
# all nodes # all nodes
- name: Apply package management distro specific configuration - name: Apply package management distro specific configuration
include_tasks: "openstack_hosts_configure_{{ ansible_facts['pkg_mgr'] | lower }}.yml" ansible.builtin.include_tasks: "openstack_hosts_configure_{{ ansible_facts['pkg_mgr'] | lower }}.yml"
# Configure bare metal nodes: Kernel, sysctl, sysstat, hosts files, metal packages # Configure bare metal nodes: Kernel, sysctl, sysstat, hosts files, metal packages
- name: Including configure_metal_hosts tasks - name: Including configure_metal_hosts tasks
include_tasks: configure_metal_hosts.yml ansible.builtin.include_tasks: configure_metal_hosts.yml
args: args:
apply: apply:
tags: tags:
@@ -118,7 +118,7 @@
- always - always
- name: Decreasing tcp_retries2 sysctl - name: Decreasing tcp_retries2 sysctl
sysctl: ansible.posix.sysctl:
name: "net.ipv4.tcp_retries2" name: "net.ipv4.tcp_retries2"
value: "{{ keepalived_sysctl_tcp_retries | default(8) }}" value: "{{ keepalived_sysctl_tcp_retries | default(8) }}"
sysctl_set: true sysctl_set: true
@@ -128,7 +128,7 @@
failed_when: false failed_when: false
- name: Install distro packages - name: Install distro packages
package: ansible.builtin.package:
name: "{{ openstack_host_distro_packages }}" name: "{{ openstack_host_distro_packages }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
when: when:
@@ -139,7 +139,7 @@
delay: 2 delay: 2
- name: Install user defined extra distro packages - name: Install user defined extra distro packages
package: ansible.builtin.package:
name: "{{ openstack_host_extra_distro_packages }}" name: "{{ openstack_host_extra_distro_packages }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
when: when:
@@ -150,12 +150,12 @@
delay: 2 delay: 2
- name: Importing openstack_authorized_keys tasks - name: Importing openstack_authorized_keys tasks
import_tasks: openstack_authorized_keys.yml ansible.builtin.import_tasks: openstack_authorized_keys.yml
tags: tags:
- openstack_hosts-config - openstack_hosts-config
- name: Including PKI role - name: Including PKI role
include_role: ansible.builtin.include_role:
name: pki name: pki
tasks_from: main_ca_install.yml tasks_from: main_ca_install.yml
vars: vars:
@@ -165,14 +165,14 @@
- always - always
- name: Including openstack_gitconfig tasks - name: Including openstack_gitconfig tasks
include_tasks: openstack_gitconfig.yml ansible.builtin.include_tasks: openstack_gitconfig.yml
args: args:
apply: apply:
tags: tags:
- openstack_hosts-config - openstack_hosts-config
- name: Including openstack_hosts_systemd tasks - name: Including openstack_hosts_systemd tasks
include_tasks: openstack_hosts_systemd.yml ansible.builtin.include_tasks: openstack_hosts_systemd.yml
args: args:
apply: apply:
tags: tags:

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Ensure ssh directory - name: Ensure ssh directory
file: ansible.builtin.file:
path: "{{ ansible_facts['env']['HOME'] }}/.ssh" path: "{{ ansible_facts['env']['HOME'] }}/.ssh"
state: "directory" state: "directory"
group: "{{ ansible_facts['user_id'] }}" group: "{{ ansible_facts['user_id'] }}"
@@ -22,7 +22,7 @@
mode: "0700" mode: "0700"
- name: Update SSH keys - name: Update SSH keys
authorized_key: ansible.posix.authorized_key:
user: "{{ ansible_facts['user'] }}" user: "{{ ansible_facts['user'] }}"
state: present state: present
key: "{{ item }}" key: "{{ item }}"

View File

@@ -23,14 +23,14 @@
- skip_ansible_lint - skip_ansible_lint
- name: Write git config when git is installed - name: Write git config when git is installed
git_config: community.general.git_config:
scope: system scope: system
name: http.https://opendev.org/.userAgent name: http.https://opendev.org/.userAgent
value: "{{ 'git/' ~ _git_version.stdout.split(' ')[2] ~ ' (osa/' ~ lookup('env', 'OSA_VERSION') ~ '/' ~ component | default('undefined') ~ ')' }}" value: "{{ 'git/' ~ _git_version.stdout.split(' ')[2] ~ ' (osa/' ~ lookup('env', 'OSA_VERSION') ~ '/' ~ component | default('undefined') ~ ')' }}"
when: _git_version.rc == 0 when: _git_version.rc == 0
- name: Configure git safe directories - name: Configure git safe directories
git_config: community.general.git_config:
scope: system scope: system
name: safe.directory name: safe.directory
value: "{{ item }}" value: "{{ item }}"
@@ -40,7 +40,7 @@
- openstack_hosts_git_safe_directories is defined - openstack_hosts_git_safe_directories is defined
- name: Write git config when git is not installed - name: Write git config when git is not installed
template: ansible.builtin.template:
src: gitconfig.j2 src: gitconfig.j2
dest: /etc/gitconfig dest: /etc/gitconfig
mode: "0644" mode: "0644"

View File

@@ -16,7 +16,7 @@
# APT configuration tasks that apply on all nodes. # APT configuration tasks that apply on all nodes.
- name: Ensure /etc/apt/sources.list.d exists - name: Ensure /etc/apt/sources.list.d exists
file: ansible.builtin.file:
path: /etc/apt/sources.list.d path: /etc/apt/sources.list.d
state: directory state: directory
owner: root owner: root
@@ -36,14 +36,14 @@
openstack_hosts_apt_repo_cleanup: openstack_hosts_apt_repo_cleanup:
- uca.list - uca.list
- osbpo.list - osbpo.list
file: ansible.builtin.file:
path: "/etc/apt/sources.list.d/{{ item }}" path: "/etc/apt/sources.list.d/{{ item }}"
state: absent state: absent
register: _cleanup_apt_repositories register: _cleanup_apt_repositories
with_items: "{{ openstack_hosts_apt_repo_cleanup }}" with_items: "{{ openstack_hosts_apt_repo_cleanup }}"
- name: Add requirement packages (repositories gpg keys, toolkits...) - name: Add requirement packages (repositories gpg keys, toolkits...)
apt: ansible.builtin.apt:
name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}" name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
update_cache: true update_cache: true
@@ -81,7 +81,7 @@
register: _manage_apt_repositories register: _manage_apt_repositories
- name: Add apt extra conf - name: Add apt extra conf
copy: ansible.builtin.copy:
content: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}" content: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}"
dest: /etc/apt/apt.conf.d/99openstack-ansible dest: /etc/apt/apt.conf.d/99openstack-ansible
mode: "0644" mode: "0644"
@@ -89,7 +89,7 @@
- openstack_hosts_package_manager_extra_conf | length > 0 or openstack_hosts_package_manager_default_conf | length > 0 - openstack_hosts_package_manager_extra_conf | length > 0 or openstack_hosts_package_manager_default_conf | length > 0
- name: Update Apt cache - name: Update Apt cache
apt: ansible.builtin.apt:
update_cache: true update_cache: true
when: when:
- (_manage_apt_repositories is changed) or (_cleanup_apt_repositories is changed) - (_manage_apt_repositories is changed) or (_cleanup_apt_repositories is changed)

View File

@@ -14,12 +14,12 @@
# limitations under the License. # limitations under the License.
- name: Check to see if yum's fastestmirror plugin is present - name: Check to see if yum's fastestmirror plugin is present
stat: ansible.builtin.stat:
path: /etc/yum/pluginconf.d/fastestmirror.conf path: /etc/yum/pluginconf.d/fastestmirror.conf
register: fastestmirror_plugin_check register: fastestmirror_plugin_check
- name: Configure yum's fastestmirror plugin - name: Configure yum's fastestmirror plugin
ini_file: community.general.ini_file:
path: /etc/yum/pluginconf.d/fastestmirror.conf path: /etc/yum/pluginconf.d/fastestmirror.conf
section: main section: main
option: enabled option: enabled
@@ -30,7 +30,7 @@
- fastestmirror_plugin_check.stat.exists - fastestmirror_plugin_check.stat.exists
- name: Disable requiretty for root sudo on centos - name: Disable requiretty for root sudo on centos
template: ansible.builtin.template:
dest: /etc/sudoers.d/openstack-ansible dest: /etc/sudoers.d/openstack-ansible
owner: root owner: root
group: root group: root
@@ -41,20 +41,19 @@
# KeyID 764429E6 from https://raw.githubusercontent.com/rdo-infra/centos-release-openstack/ocata-rdo/RPM-GPG-KEY-CentOS-SIG-Cloud # KeyID 764429E6 from https://raw.githubusercontent.com/rdo-infra/centos-release-openstack/ocata-rdo/RPM-GPG-KEY-CentOS-SIG-Cloud
# KeyID 61E8806C from keyserver for rdo-qemu-ev # KeyID 61E8806C from keyserver for rdo-qemu-ev
- name: If a keyfile is provided, copy the gpg keyfile to the key location - name: If a keyfile is provided, copy the gpg keyfile to the key location
copy: ansible.builtin.copy:
src: "{{ item.keyfile }}" src: "{{ item.keyfile }}"
dest: "{{ item.key }}" dest: "{{ item.key }}"
mode: "0644" mode: "0644"
with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile', 'defined') | list }}" with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile', 'defined') | list }}"
- name: Ensure GPG keys have the correct SELinux contexts applied - name: Ensure GPG keys have the correct SELinux contexts applied
command: restorecon -Rv /etc/pki/rpm-gpg/ ansible.builtin.command: restorecon -Rv /etc/pki/rpm-gpg/
# TODO(evrardjp): Be more idempotent
changed_when: false changed_when: false
# Handle gpg keys manually # Handle gpg keys manually
- name: Install gpg keys - name: Install gpg keys
rpm_key: ansible.builtin.rpm_key:
key: "{{ key.key }}" key: "{{ key.key }}"
validate_certs: "{{ key.validate_certs | default(omit) }}" validate_certs: "{{ key.validate_certs | default(omit) }}"
state: "{{ key.state | default('present') }}" state: "{{ key.state | default('present') }}"
@@ -67,12 +66,12 @@
delay: 2 delay: 2
- name: Add requirement packages (repositories gpg keys packages, toolkits...) - name: Add requirement packages (repositories gpg keys packages, toolkits...)
package: ansible.builtin.package:
name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}" name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
- name: Add yum repositories if they do not exist - name: Add yum repositories if they do not exist
yum_repository: ansible.builtin.yum_repository:
name: "{{ repo.name }}" name: "{{ repo.name }}"
file: "{{ repo.file | default(omit) }}" file: "{{ repo.file | default(omit) }}"
description: "{{ repo.description | default(omit) }}" description: "{{ repo.description | default(omit) }}"
@@ -94,7 +93,7 @@
delay: 2 delay: 2
- name: Add dnf extra conf - name: Add dnf extra conf
blockinfile: ansible.builtin.blockinfile:
block: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}" block: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}"
path: /etc/dnf/dnf.conf path: /etc/dnf/dnf.conf
marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK" marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK"
@@ -104,7 +103,7 @@
- openstack_hosts_package_manager_extra_conf | length > 0 or openstack_hosts_package_manager_default_conf | length > 0 - openstack_hosts_package_manager_extra_conf | length > 0 or openstack_hosts_package_manager_default_conf | length > 0
- name: Add rdo repositories via url for trunk based installation - name: Add rdo repositories via url for trunk based installation
get_url: ansible.builtin.get_url:
url: "{{ openstack_hosts_rdo_repo_url }}/delorean.repo" url: "{{ openstack_hosts_rdo_repo_url }}/delorean.repo"
dest: /etc/yum.repos.d/rdo.repo dest: /etc/yum.repos.d/rdo.repo
mode: "0640" mode: "0640"
@@ -117,7 +116,7 @@
- openstack_hosts_rdo_repo_type == 'trunk' - openstack_hosts_rdo_repo_type == 'trunk'
- name: Install centos-release-openstack package for cloudsig based installation - name: Install centos-release-openstack package for cloudsig based installation
package: ansible.builtin.package:
name: name:
- centos-release-openstack-{{ openstack_distrib_code_name | lower }} - centos-release-openstack-{{ openstack_distrib_code_name | lower }}
when: when:
@@ -125,14 +124,14 @@
- openstack_hosts_rdo_repo_type == 'cloudsig' - openstack_hosts_rdo_repo_type == 'cloudsig'
- name: Enable CodeReadyBuilder repository - name: Enable CodeReadyBuilder repository
command: dnf config-manager --set-enabled "crb" ansible.builtin.command: dnf config-manager --set-enabled "crb"
changed_when: false changed_when: false
when: when:
- openstack_hosts_power_tool_enable | bool - openstack_hosts_power_tool_enable | bool
- ansible_facts['distribution_major_version'] == "9" - ansible_facts['distribution_major_version'] == "9"
- name: Create SSL certificate and key directories - name: Create SSL certificate and key directories
file: ansible.builtin.file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
owner: "{{ item.owner | default(root) }}" owner: "{{ item.owner | default(root) }}"
@@ -143,7 +142,7 @@
- { path: "/etc/pki/tls/private", owner: "root", group: "root" } - { path: "/etc/pki/tls/private", owner: "root", group: "root" }
- name: Create SSL certificate and key directory symlinks - name: Create SSL certificate and key directory symlinks
file: ansible.builtin.file:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
state: "link" state: "link"

View File

@@ -14,12 +14,12 @@
# limitations under the License. # limitations under the License.
- name: Check to see if yum's fastestmirror plugin is present - name: Check to see if yum's fastestmirror plugin is present
stat: ansible.builtin.stat:
path: /etc/yum/pluginconf.d/fastestmirror.conf path: /etc/yum/pluginconf.d/fastestmirror.conf
register: fastestmirror_plugin_check register: fastestmirror_plugin_check
- name: Configure yum's fastestmirror plugin - name: Configure yum's fastestmirror plugin
ini_file: community.general.ini_file:
path: /etc/yum/pluginconf.d/fastestmirror.conf path: /etc/yum/pluginconf.d/fastestmirror.conf
section: main section: main
option: enabled option: enabled
@@ -30,7 +30,7 @@
- fastestmirror_plugin_check.stat.exists - fastestmirror_plugin_check.stat.exists
- name: Disable requiretty for root sudo on centos - name: Disable requiretty for root sudo on centos
template: ansible.builtin.template:
dest: /etc/sudoers.d/openstack-ansible dest: /etc/sudoers.d/openstack-ansible
owner: root owner: root
group: root group: root
@@ -41,20 +41,19 @@
# KeyID 764429E6 from https://raw.githubusercontent.com/rdo-infra/centos-release-openstack/ocata-rdo/RPM-GPG-KEY-CentOS-SIG-Cloud # KeyID 764429E6 from https://raw.githubusercontent.com/rdo-infra/centos-release-openstack/ocata-rdo/RPM-GPG-KEY-CentOS-SIG-Cloud
# KeyID 61E8806C from keyserver for rdo-qemu-ev # KeyID 61E8806C from keyserver for rdo-qemu-ev
- name: If a keyfile is provided, copy the gpg keyfile to the key location - name: If a keyfile is provided, copy the gpg keyfile to the key location
copy: ansible.builtin.copy:
src: "{{ item.keyfile }}" src: "{{ item.keyfile }}"
dest: "{{ item.key }}" dest: "{{ item.key }}"
mode: "0644" mode: "0644"
with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile', 'defined') | list }}" with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile', 'defined') | list }}"
- name: Ensure GPG keys have the correct SELinux contexts applied - name: Ensure GPG keys have the correct SELinux contexts applied
command: restorecon -Rv /etc/pki/rpm-gpg/ ansible.builtin.command: restorecon -Rv /etc/pki/rpm-gpg/
# TODO(evrardjp): Be more idempotent
changed_when: false changed_when: false
# Handle gpg keys manually # Handle gpg keys manually
- name: Install gpg keys - name: Install gpg keys
rpm_key: ansible.builtin.rpm_key:
key: "{{ key.key }}" key: "{{ key.key }}"
validate_certs: "{{ key.validate_certs | default(omit) }}" validate_certs: "{{ key.validate_certs | default(omit) }}"
state: "{{ key.state | default('present') }}" state: "{{ key.state | default('present') }}"
@@ -67,12 +66,12 @@
delay: 2 delay: 2
- name: Add requirement packages (repositories gpg keys packages, toolkits...) - name: Add requirement packages (repositories gpg keys packages, toolkits...)
package: ansible.builtin.package:
name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}" name: "{{ openstack_hosts_package_list | rejectattr('state', 'equalto', 'absent') | map(attribute='name') | list }}"
state: "{{ openstack_hosts_package_state }}" state: "{{ openstack_hosts_package_state }}"
- name: Add yum repositories if they do not exist - name: Add yum repositories if they do not exist
yum_repository: ansible.builtin.yum_repository:
name: "{{ repo.name }}" name: "{{ repo.name }}"
file: "{{ repo.file | default(omit) }}" file: "{{ repo.file | default(omit) }}"
description: "{{ repo.description | default(omit) }}" description: "{{ repo.description | default(omit) }}"
@@ -92,7 +91,7 @@
delay: 2 delay: 2
- name: Add yum extra conf - name: Add yum extra conf
blockinfile: ansible.builtin.blockinfile:
block: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}" block: "{{ openstack_hosts_package_manager_default_conf + openstack_hosts_package_manager_extra_conf }}"
path: /etc/yum.conf path: /etc/yum.conf
marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK" marker: "# {mark} OPENSTACK-ANSIBLE-OPENSTACK_HOSTS MANAGED BLOCK"

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Run the systemd-networkd role - name: Run the systemd-networkd role
include_role: ansible.builtin.include_role:
name: systemd_networkd name: systemd_networkd
vars: vars:
systemd_networkd_prefix: "{{ openstack_hosts_systemd_networkd_prefix }}" systemd_networkd_prefix: "{{ openstack_hosts_systemd_networkd_prefix }}"
@@ -27,7 +27,7 @@
- is_metal - is_metal
- name: Run the systemd-service role - name: Run the systemd-service role
include_role: ansible.builtin.include_role:
name: systemd_service name: systemd_service
vars: vars:
systemd_slice_name: "{{ openstack_hosts_systemd_slice }}" systemd_slice_name: "{{ openstack_hosts_systemd_slice }}"
@@ -36,7 +36,7 @@
- openstack_hosts_systemd_services - openstack_hosts_systemd_services
- name: Run the systemd mount role - name: Run the systemd mount role
include_role: ansible.builtin.include_role:
name: systemd_mount name: systemd_mount
vars: vars:
systemd_mounts: "{{ openstack_hosts_systemd_mounts }}" systemd_mounts: "{{ openstack_hosts_systemd_mounts }}"
@@ -47,7 +47,7 @@
when: openstack_hosts_journald_config when: openstack_hosts_journald_config
block: block:
- name: Create /etc/systemd/journald.conf.d directory - name: Create /etc/systemd/journald.conf.d directory
file: ansible.builtin.file:
path: /etc/systemd/journald.conf.d path: /etc/systemd/journald.conf.d
state: directory state: directory
owner: root owner: root
@@ -55,7 +55,7 @@
mode: "0755" mode: "0755"
- name: Define journald configuration - name: Define journald configuration
copy: ansible.builtin.copy:
content: |- content: |-
[Journal] [Journal]
{% for key, value in openstack_hosts_journald_config.items() %} {% for key, value in openstack_hosts_journald_config.items() %}

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Drop openstack release file - name: Drop openstack release file
template: ansible.builtin.template:
src: "openstack-release.j2" src: "openstack-release.j2"
dest: "{{ openstack_distrib_file_path }}" dest: "{{ openstack_distrib_file_path }}"
owner: "root" owner: "root"
@@ -24,7 +24,7 @@
- openstack_distrib_file | bool - openstack_distrib_file | bool
- name: Remove legacy openstack release file - name: Remove legacy openstack release file
file: ansible.builtin.file:
path: "{{ openstack_distrib_file_path }}" path: "{{ openstack_distrib_file_path }}"
state: absent state: absent
when: when:

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Enable sysstat config - name: Enable sysstat config
template: ansible.builtin.template:
src: "sysstat.default.j2" src: "sysstat.default.j2"
dest: "{{ openstack_host_sysstat_file }}" dest: "{{ openstack_host_sysstat_file }}"
mode: "0644" mode: "0644"
@@ -23,14 +23,14 @@
notify: Restart sysstat notify: Restart sysstat
- name: Enable sysstat cron - name: Enable sysstat cron
template: ansible.builtin.template:
src: "{{ openstack_host_cron_template }}" src: "{{ openstack_host_cron_template }}"
dest: "{{ openstack_host_sysstat_cron_file }}" dest: "{{ openstack_host_sysstat_cron_file }}"
mode: "{{ openstack_host_sysstat_cron_mode }}" mode: "{{ openstack_host_sysstat_cron_mode }}"
setype: "{{ (ansible_facts['selinux']['status'] == 'enabled') | ternary('system_cron_spool_t', omit) }}" setype: "{{ (ansible_facts['selinux']['status'] == 'enabled') | ternary('system_cron_spool_t', omit) }}"
- name: Start and enable the sysstat service - name: Start and enable the sysstat service
service: ansible.builtin.service:
name: sysstat name: sysstat
state: started state: started
enabled: true enabled: true

View File

@@ -15,7 +15,7 @@
- name: Generate hosts file records - name: Generate hosts file records
run_once: true run_once: true
set_fact: ansible.builtin.set_fact:
_etc_hosts_content: |- _etc_hosts_content: |-
{% set records = [] %} {% set records = [] %}
{% set _groups = groups['all'] %} {% set _groups = groups['all'] %}
@@ -40,7 +40,7 @@
{{ records }} {{ records }}
- name: Update hosts file - name: Update hosts file
blockinfile: ansible.builtin.blockinfile:
dest: /etc/hosts dest: /etc/hosts
block: "{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\n') }}" block: "{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\n') }}"
marker: "### {mark} OPENSTACK-ANSIBLE MANAGED BLOCK ###" marker: "### {mark} OPENSTACK-ANSIBLE MANAGED BLOCK ###"
@@ -48,7 +48,7 @@
- openstack_host_manage_hosts_file | bool - openstack_host_manage_hosts_file | bool
- name: Update hosts file on deploy host - name: Update hosts file on deploy host
blockinfile: ansible.builtin.blockinfile:
dest: /etc/hosts dest: /etc/hosts
block: "{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\n') }}" block: "{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\n') }}"
marker: "### {mark} OPENSTACK-ANSIBLE {{ lookup('env', 'OSA_CONFIG_DIR') }} MANAGED BLOCK ###" marker: "### {mark} OPENSTACK-ANSIBLE {{ lookup('env', 'OSA_CONFIG_DIR') }} MANAGED BLOCK ###"