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

Initial commit for ubuntu 22.04 #755

Merged
merged 1 commit into from
Aug 29, 2024
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
3 changes: 2 additions & 1 deletion playbooks/files/rax-maas/plugins/openmanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from maas_common import status_ok

SUPPORTED_VERSIONS = set(["7.1.0", "7.4.0", "8.3.0", "8.4.0", "9.1.0",
"9.2.0", "9.3.0", "9.4.0", "9.5.0", "10.1.0.1"])
"9.2.0", "9.3.0", "9.4.0", "9.5.0", "10.1.0.1",
"11.0.1.0"])
OM_PATTERN = r'(?:%(field)s)\s+:\s+(%(group_pattern)s)'
CHASSIS = re.compile(OM_PATTERN %
{'field': '^Health', 'group_pattern': r'\w+'},
Expand Down
2 changes: 1 addition & 1 deletion playbooks/maas-infra-rabbitmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
become: true
tasks:
- name: Ensure MaaS rabbitmq user as administrator with rabbitmqctl
rabbitmq_user:
community.rabbitmq.rabbitmq_user:
user: "{{ maas_rabbitmq_user }}"
password: "{{ maas_rabbitmq_password }}"
vhost: "/"
Expand Down
2 changes: 1 addition & 1 deletion playbooks/maas-openstack-nova.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
- name: Skip deprecated checks on newer OpenStack versions
set_fact:
skip_deprecated_check: true
when: "openstack_release in ['victoria', 'wallaby', 'xena']"
when: "openstack_release in ['victoria', 'wallaby', 'xena', 'yoga', 'zed', 'antelope']"

tasks:
- name: Install nova nova-console-auth checks
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible==2.9.0
ansible-core==2.11.6
MarkupSafe==1.1.1
Jinja2<3.0
click
Expand Down
94 changes: 94 additions & 0 deletions scripts/maas-ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env bash
# Copyright 2024, Rackspace Technology, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

source /opt/rpc-maas/scripts/maas-ansible.rc

function info {
if [ "${ANSIBLE_NOCOLOR:-0}" -eq "1" ]; then
echo -e "${@}"
else
echo -e "\e[0;35m${@}\e[0m"
fi
}

# Figure out which binary was executed
RUN_CMD=$(basename ${0})

if [ -d "${OSA_ROOT}" -a -f "/usr/local/bin/openstack-ansible.rc" ]; then

# Source the Ansible configuration.
#. /usr/local/bin/openstack-ansible.rc
export ANSIBLE_PYTHON_INTERPRETER="auto_legacy"

# Load ARA into callback plugins if it is installed
# Dynamically retrieve the location of the ARA callback so we are able to find
# it on both py2 and py3
ara_location=$(python -m ara.setup.callback_plugins 2>/dev/null || true)
if [[ -n "$ara_location" ]]; then
export ANSIBLE_CALLBACK_PLUGINS="${ANSIBLE_CALLBACK_PLUGINS}:${ara_location}"
fi

# Load userspace group vars
if [[ -d ${OSA_CONFIG_DIR}/group_vars || -d ${OSA_CONFIG_DIR}/host_vars ]]; then
if [[ ! -f ${OSA_CONFIG_DIR}/inventory.ini ]]; then
echo '[all]' > ${OSA_CONFIG_DIR}/inventory.ini
fi
fi

OSA_USER_RC="${OSA_USER_RC:-${OSA_CONFIG_DIR}/user.rc}"

if [[ -f ${OSA_USER_RC} ]]; then
source ${OSA_USER_RC}
fi

# Check whether there are any user configuration files
if ls -1 ${OSA_CONFIG_DIR}/user_*.yml &> /dev/null; then

# Discover the variable files.
VAR1="$(for i in $(ls ${OSA_CONFIG_DIR}/user_*.yml); do echo -ne "-e @$i "; done)"

# Provide information on the discovered variables.
info "Variable files: \"${VAR1}\""

fi

else

# Assuming we are running outside OSA and pre-configure
# the extra vars for OSP.
VAR1="/home/stack/user_maas_variables.yml"

fi

. /root/ansible_venv/bin/activate

# Execute the Ansible playbook or command
if [ "${RUN_CMD}" == "maas-ansible" ] || [ "${RUN_CMD}" == "ansible-playbook" ]; then
ansible-playbook ${VAR1} "${@}"
PLAYBOOK_RC="$?"

if [[ "${PLAYBOOK_RC}" -ne "0" ]]; then
echo -e "\nEXIT NOTICE [Playbook execution failure] **************************************"
else
echo -e "\nEXIT NOTICE [Playbook execution success] **************************************"
fi
echo "==============================================================================="
exit "${PLAYBOOK_RC}"

else

${RUN_CMD} ${VAR1} "${@}"
fi
45 changes: 45 additions & 0 deletions scripts/maas-ansible.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Copyright 2024, Rackspace Technology, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

export OSA_ROOT="${OSA_ROOT:-/opt/openstack-ansible}"
export OSA_CONFIG_DIR="${OSA_CONFIG_DIR:-/etc/openstack_deploy}"

export ANSIBLE_RETRY_FILES_ENABLED="${ANSIBLE_RETRY_FILES_ENABLED:-False}"
export ANSIBLE_INVENTORY="${ANSIBLE_INVENTORY:-/opt/openstack-ansible/inventory/dynamic_inventory.py,/opt/openstack-ansible/inventory/inventory.ini,${OSA_CONFIG_DIR}/inventory.ini}"
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_PATH:-/openstack/log/ansible-logging/ansible.log}"

mkdir -p "$(dirname ${ANSIBLE_LOG_PATH})" || unset ANSIBLE_LOG_PATH
export ANSIBLE_PYTHON_INTERPRETER="auto_legacy"

export ANSIBLE_GATHERING="${ANSIBLE_GATHERING:-smart}"
export ANSIBLE_GATHER_SUBSET="${ANSIBLE_GATHER_SUBSET:-!all,min}"

export ANSIBLE_CACHE_PLUGIN="${ANSIBLE_CACHE_PLUGIN:-jsonfile}"
export ANSIBLE_CACHE_PLUGIN_CONNECTION="${ANSIBLE_CACHE_PLUGIN_CONNECTION:-${OSA_CONFIG_DIR}/ansible_facts}"
export ANSIBLE_CACHE_PLUGIN_TIMEOUT="${ANSIBLE_CACHE_PLUGIN_TIMEOUT:-86400}"

if [[ "${ANSIBLE_CACHE_PLUGIN}" == "memcached" ]];then
if ! echo stats | nc -w 1 $(echo ${ANSIBLE_CACHE_PLUGIN_CONNECTION}|awk -F',' '{print $1}'|sed 's/:/ /') > /dev/null; then
export ANSIBLE_CACHE_PLUGIN="memory"
fi
fi

export ANSIBLE_HOST_KEY_CHECKING="${ANSIBLE_HOST_KEY_CHECKING:-False}"
export ANSIBLE_TIMEOUT="${ANSIBLE_TIMEOUT:-5}"
export ANSIBLE_SSH_PIPELINING="${ANSIBLE_SSH_PIPELINING:-True}"
export ANSIBLE_SSH_RETRIES="${ANSIBLE_SSH_RETRIES:-5}"
export ANSIBLE_SSH_ARGS="${ANSIBLE_SSH_ARGS:--C -o ControlMaster=auto -o ControlPersist=300}"
export ANSIBLE_PIPELINING="${ANSIBLE_SSH_PIPELINING}"
export ANSIBLE_FORKS="${ANSIBLE_FORKS:-10}"
13 changes: 8 additions & 5 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ fi
# Install required packages
. /root/ansible_venv/bin/activate
pip install -r /opt/rpc-maas/requirements.txt

ansible-galaxy collection install community.rabbitmq
ansible-galaxy collection install openstack.cloud

deactivate

# Generate a token(non core testing when we have the vars set)
Expand Down Expand Up @@ -53,17 +57,16 @@ fi

echo
echo "Example Playbook Usage Post Configuration:
cd /opt/rpc-maas/
. /root/ansible_venv/bin/activate"
cd /opt/rpc-maas/"

if [ $isRH ]; then
echo "ansible-playbook -i /opt/rpc-maas/inventory/rpcr_dynamic_inventory.py -e @/home/stack/user_maas_variables.yml playbooks/site.yml"
echo "scripts/maas-ansible -i /opt/rpc-maas/inventory/rpcr_dynamic_inventory.py playbooks/site.yml"
else
echo ". /usr/local/bin/openstack-ansible.rc"
echo "# When present add the Ceph inventory to update the maas checks on"
echo "# the ceph nodes"
echo 'export ANSIBLE_INVENTORY="$ANSIBLE_INVENTORY,/tmp/inventory-ceph.ini"'
echo ""
echo "openstack-ansible playbooks/site.yml"
echo "scripts/maas-ansible playbooks/site.yml"
fi

echo "deactivate"
Expand Down
Loading