diff --git a/README.md b/README.md index 0350715..bc9aec1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # Openstack Deployment +## Scripts and Guides for enviroment setup + +### 1. create-journal-on-ssd.sh ### +This script used for creating joudnal partitions (4 partitions hardcoded) on drive, that alredy have other partition. + +partition that created are logical, firstly created extended partition for all logical. + +SYNTAX: + +```create-journal-on-ssd.sh {device} {size in %}``` + +example: + +``` #./create-journal-on-ssd.sh /dev/sde 10``` + +### 2. create-journal-on-ssd-gpt.sh ### +This script used for creating joudnal partitions (4 partitions hardcoded) on GPT drive, that alredy have other partition. + + +SYNTAX: + +```create-journal-on-ssd-gpt.sh {device} {size in %}``` + +example: + +``` #./create-journal-on-ssd-gpt.sh /dev/sde 10``` diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..1bccd57 --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,496 @@ +# config file for ansible -- https://ansible.com/ +# =============================================== + +# nearly all parameters can be overridden in ansible-playbook +# or with command line flags. ansible will read ANSIBLE_CONFIG, +# ansible.cfg in the current working directory, .ansible.cfg in +# the home directory or /etc/ansible/ansible.cfg, whichever it +# finds first + +[defaults] + +# some basic default values... + +#inventory = /etc/ansible/hosts +#library = /usr/share/my_modules/ +#module_utils = /usr/share/my_module_utils/ +#remote_tmp = ~/.ansible/tmp +#local_tmp = ~/.ansible/tmp +#plugin_filters_cfg = /etc/ansible/plugin_filters.yml +#forks = 5 +#poll_interval = 15 +#sudo_user = root +#ask_sudo_pass = True +#ask_pass = True +#transport = smart +#remote_port = 22 +#module_lang = C +#module_set_locale = False + +# plays will gather facts by default, which contain information about +# the remote system. +# +# smart - gather by default, but don't regather if already gathered +# implicit - gather by default, turn off with gather_facts: False +# explicit - do not gather by default, must say gather_facts: True +#gathering = implicit + +# This only affects the gathering done by a play's gather_facts directive, +# by default gathering retrieves all facts subsets +# all - gather all subsets +# network - gather min and network facts +# hardware - gather hardware facts (longest facts to retrieve) +# virtual - gather min and virtual facts +# facter - import facts from facter +# ohai - import facts from ohai +# You can combine them using comma (ex: network,virtual) +# You can negate them using ! (ex: !hardware,!facter,!ohai) +# A minimal set of facts is always gathered. +#gather_subset = all + +# some hardware related facts are collected +# with a maximum timeout of 10 seconds. This +# option lets you increase or decrease that +# timeout to something more suitable for the +# environment. +# gather_timeout = 10 + +# Ansible facts are available inside the ansible_facts.* dictionary +# namespace. This setting maintains the behaviour which was the default prior +# to 2.5, duplicating these variables into the main namespace, each with a +# prefix of 'ansible_'. +# This variable is set to True by default for backwards compatibility. It +# will be changed to a default of 'False' in a future release. +# ansible_facts. +# inject_facts_as_vars = True + +# additional paths to search for roles in, colon separated +#roles_path = /etc/ansible/roles + +# uncomment this to disable SSH key host checking +#host_key_checking = False + +# change the default callback, you can only have one 'stdout' type enabled at a time. +#stdout_callback = skippy + + +## Ansible ships with some plugins that require whitelisting, +## this is done to avoid running all of a type by default. +## These setting lists those that you want enabled for your system. +## Custom plugins should not need this unless plugin author specifies it. + +# enable callback plugins, they can output to stdout but cannot be 'stdout' type. +#callback_whitelist = timer, mail + +# Determine whether includes in tasks and handlers are "static" by +# default. As of 2.0, includes are dynamic by default. Setting these +# values to True will make includes behave more like they did in the +# 1.x versions. +#task_includes_static = False +#handler_includes_static = False + +# Controls if a missing handler for a notification event is an error or a warning +#error_on_missing_handler = True + +# change this for alternative sudo implementations +#sudo_exe = sudo + +# What flags to pass to sudo +# WARNING: leaving out the defaults might create unexpected behaviours +#sudo_flags = -H -S -n + +# SSH timeout +#timeout = 10 + +# default user to use for playbooks if user is not specified +# (/usr/bin/ansible will use current user as default) +#remote_user = root + +# logging is off by default unless this path is defined +# if so defined, consider logrotate +#log_path = /var/log/ansible.log + +# default module name for /usr/bin/ansible +#module_name = command + +# use this shell for commands executed under sudo +# you may need to change this to bin/bash in rare instances +# if sudo is constrained +#executable = /bin/sh + +# if inventory variables overlap, does the higher precedence one win +# or are hash values merged together? The default is 'replace' but +# this can also be set to 'merge'. +#hash_behaviour = replace + +# by default, variables from roles will be visible in the global variable +# scope. To prevent this, the following option can be enabled, and only +# tasks and handlers within the role will see the variables there +#private_role_vars = yes + +# list any Jinja2 extensions to enable here: +#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n + +# if set, always use this private key file for authentication, same as +# if passing --private-key to ansible or ansible-playbook +#private_key_file = /path/to/file + +# If set, configures the path to the Vault password file as an alternative to +# specifying --vault-password-file on the command line. +#vault_password_file = /path/to/vault_password_file + +# format of string {{ ansible_managed }} available within Jinja2 +# templates indicates to users editing templates files will be replaced. +# replacing {file}, {host} and {uid} and strftime codes with proper values. +#ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} +# {file}, {host}, {uid}, and the timestamp can all interfere with idempotence +# in some situations so the default is a static string: +#ansible_managed = Ansible managed + +# by default, ansible-playbook will display "Skipping [host]" if it determines a task +# should not be run on a host. Set this to "False" if you don't want to see these "Skipping" +# messages. NOTE: the task header will still be shown regardless of whether or not the +# task is skipped. +#display_skipped_hosts = True + +# by default, if a task in a playbook does not include a name: field then +# ansible-playbook will construct a header that includes the task's action but +# not the task's args. This is a security feature because ansible cannot know +# if the *module* considers an argument to be no_log at the time that the +# header is printed. If your environment doesn't have a problem securing +# stdout from ansible-playbook (or you have manually specified no_log in your +# playbook on all of the tasks where you have secret information) then you can +# safely set this to True to get more informative messages. +#display_args_to_stdout = False + +# by default (as of 1.3), Ansible will raise errors when attempting to dereference +# Jinja2 variables that are not set in templates or action lines. Uncomment this line +# to revert the behavior to pre-1.3. +#error_on_undefined_vars = False + +# by default (as of 1.6), Ansible may display warnings based on the configuration of the +# system running ansible itself. This may include warnings about 3rd party packages or +# other conditions that should be resolved if possible. +# to disable these warnings, set the following value to False: +#system_warnings = True + +# by default (as of 1.4), Ansible may display deprecation warnings for language +# features that should no longer be used and will be removed in future versions. +# to disable these warnings, set the following value to False: +#deprecation_warnings = True + +# (as of 1.8), Ansible can optionally warn when usage of the shell and +# command module appear to be simplified by using a default Ansible module +# instead. These warnings can be silenced by adjusting the following +# setting or adding warn=yes or warn=no to the end of the command line +# parameter string. This will for example suggest using the git module +# instead of shelling out to the git command. +# command_warnings = False + + +# set plugin path directories here, separate with colons +#action_plugins = /usr/share/ansible/plugins/action +#cache_plugins = /usr/share/ansible/plugins/cache +#callback_plugins = /usr/share/ansible/plugins/callback +#connection_plugins = /usr/share/ansible/plugins/connection +#lookup_plugins = /usr/share/ansible/plugins/lookup +#inventory_plugins = /usr/share/ansible/plugins/inventory +#vars_plugins = /usr/share/ansible/plugins/vars +#filter_plugins = /usr/share/ansible/plugins/filter +#test_plugins = /usr/share/ansible/plugins/test +#terminal_plugins = /usr/share/ansible/plugins/terminal +#strategy_plugins = /usr/share/ansible/plugins/strategy + + +# by default, ansible will use the 'linear' strategy but you may want to try +# another one +#strategy = free + +# by default callbacks are not loaded for /bin/ansible, enable this if you +# want, for example, a notification or logging callback to also apply to +# /bin/ansible runs +#bin_ansible_callbacks = False + + +# don't like cows? that's unfortunate. +# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1 +#nocows = 1 + +# set which cowsay stencil you'd like to use by default. When set to 'random', +# a random stencil will be selected for each task. The selection will be filtered +# against the `cow_whitelist` option below. +#cow_selection = default +#cow_selection = random + +# when using the 'random' option for cowsay, stencils will be restricted to this list. +# it should be formatted as a comma-separated list with no spaces between names. +# NOTE: line continuations here are for formatting purposes only, as the INI parser +# in python does not support them. +#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\ +# hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\ +# stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www + +# don't like colors either? +# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1 +#nocolor = 1 + +# if set to a persistent type (not 'memory', for example 'redis') fact values +# from previous runs in Ansible will be stored. This may be useful when +# wanting to use, for example, IP information from one group of servers +# without having to talk to them in the same playbook run to get their +# current IP information. +#fact_caching = memory + +#This option tells Ansible where to cache facts. The value is plugin dependent. +#For the jsonfile plugin, it should be a path to a local directory. +#For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0 + +#fact_caching_connection=/tmp + + + +# retry files +# When a playbook fails by default a .retry file will be created in ~/ +# You can disable this feature by setting retry_files_enabled to False +# and you can change the location of the files by setting retry_files_save_path + +#retry_files_enabled = False +#retry_files_save_path = ~/.ansible-retry + +# squash actions +# Ansible can optimise actions that call modules with list parameters +# when looping. Instead of calling the module once per with_ item, the +# module is called once with all items at once. Currently this only works +# under limited circumstances, and only with parameters named 'name'. +#squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper + +# prevents logging of task data, off by default +#no_log = False + +# prevents logging of tasks, but only on the targets, data is still logged on the master/controller +#no_target_syslog = False + +# controls whether Ansible will raise an error or warning if a task has no +# choice but to create world readable temporary files to execute a module on +# the remote machine. This option is False by default for security. Users may +# turn this on to have behaviour more like Ansible prior to 2.1.x. See +# https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user +# for more secure ways to fix this than enabling this option. +#allow_world_readable_tmpfiles = False + +# controls the compression level of variables sent to +# worker processes. At the default of 0, no compression +# is used. This value must be an integer from 0 to 9. +#var_compression_level = 9 + +# controls what compression method is used for new-style ansible modules when +# they are sent to the remote system. The compression types depend on having +# support compiled into both the controller's python and the client's python. +# The names should match with the python Zipfile compression types: +# * ZIP_STORED (no compression. available everywhere) +# * ZIP_DEFLATED (uses zlib, the default) +# These values may be set per host via the ansible_module_compression inventory +# variable +#module_compression = 'ZIP_DEFLATED' + +# This controls the cutoff point (in bytes) on --diff for files +# set to 0 for unlimited (RAM may suffer!). +#max_diff_size = 1048576 + +# This controls how ansible handles multiple --tags and --skip-tags arguments +# on the CLI. If this is True then multiple arguments are merged together. If +# it is False, then the last specified argument is used and the others are ignored. +# This option will be removed in 2.8. +#merge_multiple_cli_flags = True + +# Controls showing custom stats at the end, off by default +#show_custom_stats = True + +# Controls which files to ignore when using a directory as inventory with +# possibly multiple sources (both static and dynamic) +#inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo + +# This family of modules use an alternative execution path optimized for network appliances +# only update this setting if you know how this works, otherwise it can break module execution +#network_group_modules=eos, nxos, ios, iosxr, junos, vyos + +# When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as +# a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain +# jinja2 templating language which will be run through the templating engine. +# ENABLING THIS COULD BE A SECURITY RISK +#allow_unsafe_lookups = False + +# set default errors for all plays +#any_errors_fatal = False + +[inventory] +# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini' +#enable_plugins = host_list, virtualbox, yaml, constructed + +# ignore these extensions when parsing a directory as inventory source +#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry + +# ignore files matching these patterns when parsing a directory as inventory source +#ignore_patterns= + +# If 'true' unparsed inventory sources become fatal errors, they are warnings otherwise. +#unparsed_is_failed=False + +[privilege_escalation] +#become=True +#become_method=sudo +#become_user=root +#become_ask_pass=False + +[paramiko_connection] + +# uncomment this line to cause the paramiko connection plugin to not record new host +# keys encountered. Increases performance on new host additions. Setting works independently of the +# host key checking setting above. +#record_host_keys=False + +# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this +# line to disable this behaviour. +#pty=False + +# paramiko will default to looking for SSH keys initially when trying to +# authenticate to remote devices. This is a problem for some network devices +# that close the connection after a key failure. Uncomment this line to +# disable the Paramiko look for keys function +#look_for_keys = False + +# When using persistent connections with Paramiko, the connection runs in a +# background process. If the host doesn't already have a valid SSH key, by +# default Ansible will prompt to add the host key. This will cause connections +# running in background processes to fail. Uncomment this line to have +# Paramiko automatically add host keys. +#host_key_auto_add = True + +[ssh_connection] + +# ssh arguments to use +# Leaving off ControlPersist will result in poor performance, so use +# paramiko on older platforms rather than removing it, -C controls compression use +#ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s + +# The base directory for the ControlPath sockets. +# This is the "%(directory)s" in the control_path option +# +# Example: +# control_path_dir = /tmp/.ansible/cp +#control_path_dir = ~/.ansible/cp + +# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname, +# port and username (empty string in the config). The hash mitigates a common problem users +# found with long hostames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format. +# In those cases, a "too long for Unix domain socket" ssh error would occur. +# +# Example: +# control_path = %(directory)s/%%h-%%r +#control_path = + +# Enabling pipelining reduces the number of SSH operations required to +# execute a module on the remote server. This can result in a significant +# performance improvement when enabled, however when using "sudo:" you must +# first disable 'requiretty' in /etc/sudoers +# +# By default, this option is disabled to preserve compatibility with +# sudoers configurations that have requiretty (the default on many distros). +# +#pipelining = False + +# Control the mechanism for transferring files (old) +# * smart = try sftp and then try scp [default] +# * True = use scp only +# * False = use sftp only +#scp_if_ssh = smart + +# Control the mechanism for transferring files (new) +# If set, this will override the scp_if_ssh option +# * sftp = use sftp to transfer files +# * scp = use scp to transfer files +# * piped = use 'dd' over SSH to transfer files +# * smart = try sftp, scp, and piped, in that order [default] +#transfer_method = smart + +# if False, sftp will not use batch mode to transfer files. This may cause some +# types of file transfer failures impossible to catch however, and should +# only be disabled if your sftp version has problems with batch mode +#sftp_batch_mode = False + +# The -tt argument is passed to ssh when pipelining is not enabled because sudo +# requires a tty by default. +#use_tty = True + +# Number of times to retry an SSH connection to a host, in case of UNREACHABLE. +# For each retry attempt, there is an exponential backoff, +# so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max). +#retries = 3 + +[persistent_connection] + +# Configures the persistent connection timeout value in seconds. This value is +# how long the persistent connection will remain idle before it is destroyed. +# If the connection doesn't receive a request before the timeout value +# expires, the connection is shutdown. The default value is 30 seconds. +#connect_timeout = 30 + +# Configures the persistent connection retry timeout. This value configures the +# the retry timeout that ansible-connection will wait to connect +# to the local domain socket. This value must be larger than the +# ssh timeout (timeout) and less than persistent connection idle timeout (connect_timeout). +# The default value is 15 seconds. +#connect_retry_timeout = 15 + +# The command timeout value defines the amount of time to wait for a command +# or RPC call before timing out. The value for the command timeout must +# be less than the value of the persistent connection idle timeout (connect_timeout) +# The default value is 10 second. +#command_timeout = 10 + +[accelerate] +#accelerate_port = 5099 +#accelerate_timeout = 30 +#accelerate_connect_timeout = 5.0 + +# The daemon timeout is measured in minutes. This time is measured +# from the last activity to the accelerate daemon. +#accelerate_daemon_timeout = 30 + +# If set to yes, accelerate_multi_key will allow multiple +# private keys to be uploaded to it, though each user must +# have access to the system via SSH to add a new key. The default +# is "no". +#accelerate_multi_key = yes + +[selinux] +# file systems that require special treatment when dealing with security context +# the default behaviour that copies the existing context or uses the user default +# needs to be changed to use the file system dependent context. +#special_context_filesystems=nfs,vboxsf,fuse,ramfs,9p + +# Set this to yes to allow libvirt_lxc connections to work without SELinux. +#libvirt_lxc_noseclabel = yes + +[colors] +#highlight = white +#verbose = blue +#warn = bright purple +#error = red +#debug = dark gray +#deprecate = purple +#skip = cyan +#unreachable = red +#ok = green +#changed = yellow +#diff_add = green +#diff_remove = red +#diff_lines = cyan + + +[diff] +# Always print diff when running ( same as always running with -D/--diff ) +# always = no + +# Set how many context lines to show in diff +# context = 3 diff --git a/ansible/files/ceilometer.conf b/ansible/files/ceilometer.conf new file mode 100644 index 0000000..2784168 --- /dev/null +++ b/ansible/files/ceilometer.conf @@ -0,0 +1,34 @@ +[DEFAULT] +transport_url = rabbit://openstack:GAQ5q55LTj9D@controller-virt +[compute] +[coordination] +[dispatcher_gnocchi] +[event] +[hardware] +[ipmi] +[matchmaker_redis] +[meter] +[notification] +[oslo_concurrency] +[oslo_messaging_amqp] +[oslo_messaging_kafka] +[oslo_messaging_notifications] +[oslo_messaging_rabbit] +[oslo_messaging_zmq] +[polling] +[publisher] +[publisher_notifier] +[rgw_admin_credentials] +[service_credentials] +auth_url = http://controller-virt:5000 +project_domain_id = default +user_domain_id = default +auth_type = password +username = ceilometer +project_name = service +password = PhCiXGXFlL +interface = internalURL +region_name = RegionOne +[service_types] +[vmware] +[xenapi] diff --git a/ansible/files/ceph.client.vms.keyring b/ansible/files/ceph.client.vms.keyring new file mode 100644 index 0000000..2743cc6 --- /dev/null +++ b/ansible/files/ceph.client.vms.keyring @@ -0,0 +1,2 @@ +[client.vms] + key = AQBFsIFbK1PlGhAAA7dg70FdghDmIZGF32157Q== diff --git a/ansible/files/chrony.conf b/ansible/files/chrony.conf new file mode 100644 index 0000000..e9a6981 --- /dev/null +++ b/ansible/files/chrony.conf @@ -0,0 +1,6 @@ +server 172.16.4.11 iburst +server 172.16.4.95 iburst +driftfile /var/lib/chrony/drift +makestep 1.0 3 +rtcsync +logdir /var/log/chrony diff --git a/ansible/files/client.cinder.key b/ansible/files/client.cinder.key new file mode 100644 index 0000000..fb5b647 --- /dev/null +++ b/ansible/files/client.cinder.key @@ -0,0 +1 @@ +AQCBF4BbaRoNIxAAZXoWxwAnQdgdScJrpR054w== \ No newline at end of file diff --git a/ansible/files/client.vms.key b/ansible/files/client.vms.key new file mode 100644 index 0000000..b921eac --- /dev/null +++ b/ansible/files/client.vms.key @@ -0,0 +1 @@ +AQBFsIFbK1PlGhAAA7dg70FdghDmIZGF32157Q== \ No newline at end of file diff --git a/ansible/files/dpdk.conf b/ansible/files/dpdk.conf new file mode 100644 index 0000000..1a683b0 --- /dev/null +++ b/ansible/files/dpdk.conf @@ -0,0 +1 @@ +uio_pci_generic diff --git a/ansible/files/hugetlb-gigantic-pages.service b/ansible/files/hugetlb-gigantic-pages.service new file mode 100644 index 0000000..616954b --- /dev/null +++ b/ansible/files/hugetlb-gigantic-pages.service @@ -0,0 +1,14 @@ +[Unit] +Description=HugeTLB Gigantic Pages Reservation +DefaultDependencies=no +Before=dev-hugepages.mount +ConditionPathExists=/sys/devices/system/node + + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/lib/systemd/hugetlb-reserve-pages.sh + +[Install] +WantedBy=sysinit.target diff --git a/ansible/files/hugetlb-reserve-pages.sh b/ansible/files/hugetlb-reserve-pages.sh new file mode 100644 index 0000000..4683d98 --- /dev/null +++ b/ansible/files/hugetlb-reserve-pages.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +nodes_path=/sys/devices/system/node/ +if [ ! -d $nodes_path ]; then + echo "ERROR: $nodes_path does not exist" + exit 1 +fi + +reserve_pages() +{ + echo $1 > $nodes_path/$2/hugepages/hugepages-2048kB/nr_hugepages +} + + +nodes=$(ls /sys/devices/system/node/ | grep node) + + +for i in $nodes; do + if [[ $i == node0 ]] + then + reserve_pages 512 $i + else + reserve_pages 0 $i + fi +done diff --git a/ansible/files/ifcfg-br2 b/ansible/files/ifcfg-br2 new file mode 100644 index 0000000..71b8234 --- /dev/null +++ b/ansible/files/ifcfg-br2 @@ -0,0 +1,8 @@ +TYPE=Bridge +NAME=br2 +DEVICE=br2 +ONBOOT=yes +BOOTPROTO=none +NOZEROCONF=yes +ZONE=public +MTU=9000 diff --git a/ansible/files/ifcfg-vlan165 b/ansible/files/ifcfg-vlan165 new file mode 100644 index 0000000..8c579a8 --- /dev/null +++ b/ansible/files/ifcfg-vlan165 @@ -0,0 +1,7 @@ +VLAN=yes +NAME=vlan165 +DEVICE=vlan165 +PHYSDEV=bond0 +VLAN_NAME_TYPE=VLAN_PLUS_VID_PAD +BRIDGE=br2 +VLAN_ID=165 diff --git a/ansible/files/kvm-nested.conf b/ansible/files/kvm-nested.conf new file mode 100644 index 0000000..42261eb --- /dev/null +++ b/ansible/files/kvm-nested.conf @@ -0,0 +1,4 @@ +options kvm-intel nested=1 +options kvm-intel enable_shadow_vmcs=1 +options kvm-intel enable_apicv=1 +options kvm-intel ept=1 diff --git a/ansible/files/libvirtd b/ansible/files/libvirtd new file mode 100644 index 0000000..e587d88 --- /dev/null +++ b/ansible/files/libvirtd @@ -0,0 +1,33 @@ +# Override the default config file +# NOTE: This setting is no longer honoured if using +# systemd. Set '--config /etc/libvirt/libvirtd.conf' +# in LIBVIRTD_ARGS instead. +#LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf + +# Listen for TCP/IP connections +# NB. must setup TLS/SSL keys prior to using this +LIBVIRTD_ARGS="--listen" + +# Override Kerberos service keytab for SASL/GSSAPI +#KRB5_KTNAME=/etc/libvirt/krb5.tab + +# Override the QEMU/SDL default audio driver probing when +# starting virtual machines using SDL graphics +# +# NB these have no effect for VMs using VNC, unless vnc_allow_host_audio +# is enabled in /etc/libvirt/qemu.conf +#QEMU_AUDIO_DRV=sdl +# +#SDL_AUDIODRIVER=pulse + +# Override the maximum number of opened files. +# This only works with traditional init scripts. +# In the systemd world, the limit can only be changed by overriding +# LimitNOFILE for libvirtd.service. To do that, just create a *.conf +# file in /etc/systemd/system/libvirtd.service.d/ (for example +# /etc/systemd/system/libvirtd.service.d/openfiles.conf) and write +# the following two lines in it: +# [Service] +# LimitNOFILE=2048 +# +#LIBVIRTD_NOFILES_LIMIT=2048 diff --git a/ansible/files/libvirtd.conf b/ansible/files/libvirtd.conf new file mode 100644 index 0000000..94c4177 --- /dev/null +++ b/ansible/files/libvirtd.conf @@ -0,0 +1,468 @@ +# Master libvirt daemon configuration file +# +# For further information consult https://libvirt.org/format.html +# +# NOTE: the tests/daemon-conf regression test script requires +# that each "PARAMETER = VALUE" line in this file have the parameter +# name just after a leading "#". + +################################################################# +# +# Network connectivity controls +# + +# Flag listening for secure TLS connections on the public TCP/IP port. +# NB, must pass the --listen flag to the libvirtd process for this to +# have any effect. +# +# It is necessary to setup a CA and issue server certificates before +# using this capability. +# +# This is enabled by default, uncomment this to disable it +listen_tls = 0 + +# Listen for unencrypted TCP connections on the public TCP/IP port. +# NB, must pass the --listen flag to the libvirtd process for this to +# have any effect. +# +# Using the TCP socket requires SASL authentication by default. Only +# SASL mechanisms which support data encryption are allowed. This is +# DIGEST_MD5 and GSSAPI (Kerberos5) +# +# This is disabled by default, uncomment this to enable it. +listen_tcp = 1 + + + +# Override the port for accepting secure TLS connections +# This can be a port number, or service name +# +#tls_port = "16514" + +# Override the port for accepting insecure TCP connections +# This can be a port number, or service name +# +#tcp_port = "16509" + + +# Override the default configuration which binds to all network +# interfaces. This can be a numeric IPv4/6 address, or hostname +# +# If the libvirtd service is started in parallel with network +# startup (e.g. with systemd), binding to addresses other than +# the wildcards (0.0.0.0/::) might not be available yet. +# +#listen_addr = "192.168.0.1" + + +# Flag toggling mDNS advertizement of the libvirt service. +# +# Alternatively can disable for all services on a host by +# stopping the Avahi daemon +# +# This is disabled by default, uncomment this to enable it +#mdns_adv = 1 + +# Override the default mDNS advertizement name. This must be +# unique on the immediate broadcast network. +# +# The default is "Virtualization Host HOSTNAME", where HOSTNAME +# is substituted for the short hostname of the machine (without domain) +# +#mdns_name = "Virtualization Host Joe Demo" + + +################################################################# +# +# UNIX socket access controls +# + +# Set the UNIX domain socket group ownership. This can be used to +# allow a 'trusted' set of users access to management capabilities +# without becoming root. +# +# This is restricted to 'root' by default. +#unix_sock_group = "libvirt" + +# Set the UNIX socket permissions for the R/O socket. This is used +# for monitoring VM status only +# +# Default allows any user. If setting group ownership, you may want to +# restrict this too. +#unix_sock_ro_perms = "0777" + +# Set the UNIX socket permissions for the R/W socket. This is used +# for full management of VMs +# +# Default allows only root. If PolicyKit is enabled on the socket, +# the default will change to allow everyone (eg, 0777) +# +# If not using PolicyKit and setting group ownership for access +# control, then you may want to relax this too. +#unix_sock_rw_perms = "0770" + +# Set the UNIX socket permissions for the admin interface socket. +# +# Default allows only owner (root), do not change it unless you are +# sure to whom you are exposing the access to. +#unix_sock_admin_perms = "0700" + +# Set the name of the directory in which sockets will be found/created. +#unix_sock_dir = "/var/run/libvirt" + + + +################################################################# +# +# Authentication. +# +# - none: do not perform auth checks. If you can connect to the +# socket you are allowed. This is suitable if there are +# restrictions on connecting to the socket (eg, UNIX +# socket permissions), or if there is a lower layer in +# the network providing auth (eg, TLS/x509 certificates) +# +# - sasl: use SASL infrastructure. The actual auth scheme is then +# controlled from /etc/sasl2/libvirt.conf. For the TCP +# socket only GSSAPI & DIGEST-MD5 mechanisms will be used. +# For non-TCP or TLS sockets, any scheme is allowed. +# +# - polkit: use PolicyKit to authenticate. This is only suitable +# for use on the UNIX sockets. The default policy will +# require a user to supply their own password to gain +# full read/write access (aka sudo like), while anyone +# is allowed read/only access. +# +# Set an authentication scheme for UNIX read-only sockets +# By default socket permissions allow anyone to connect +# +# To restrict monitoring of domains you may wish to enable +# an authentication mechanism here +#auth_unix_ro = "none" + +# Set an authentication scheme for UNIX read-write sockets +# By default socket permissions only allow root. If PolicyKit +# support was compiled into libvirt, the default will be to +# use 'polkit' auth. +# +# If the unix_sock_rw_perms are changed you may wish to enable +# an authentication mechanism here +#auth_unix_rw = "none" + +# Change the authentication scheme for TCP sockets. +# +# If you don't enable SASL, then all TCP traffic is cleartext. +# Don't do this outside of a dev/test scenario. For real world +# use, always enable SASL and use the GSSAPI or DIGEST-MD5 +# mechanism in /etc/sasl2/libvirt.conf +auth_tcp = "none" + +# Change the authentication scheme for TLS sockets. +# +# TLS sockets already have encryption provided by the TLS +# layer, and limited authentication is done by certificates +# +# It is possible to make use of any SASL authentication +# mechanism as well, by using 'sasl' for this option +#auth_tls = "none" + + +# Change the API access control scheme +# +# By default an authenticated user is allowed access +# to all APIs. Access drivers can place restrictions +# on this. By default the 'nop' driver is enabled, +# meaning no access control checks are done once a +# client has authenticated with libvirtd +# +#access_drivers = [ "polkit" ] + +################################################################# +# +# TLS x509 certificate configuration +# + + +# Override the default server key file path +# +#key_file = "/etc/pki/libvirt/private/serverkey.pem" + +# Override the default server certificate file path +# +#cert_file = "/etc/pki/libvirt/servercert.pem" + +# Override the default CA certificate path +# +#ca_file = "/etc/pki/CA/cacert.pem" + +# Specify a certificate revocation list. +# +# Defaults to not using a CRL, uncomment to enable it +#crl_file = "/etc/pki/CA/crl.pem" + + + +################################################################# +# +# Authorization controls +# + + +# Flag to disable verification of our own server certificates +# +# When libvirtd starts it performs some sanity checks against +# its own certificates. +# +# Default is to always run sanity checks. Uncommenting this +# will disable sanity checks which is not a good idea +#tls_no_sanity_certificate = 1 + +# Flag to disable verification of client certificates +# +# Client certificate verification is the primary authentication mechanism. +# Any client which does not present a certificate signed by the CA +# will be rejected. +# +# Default is to always verify. Uncommenting this will disable +# verification - make sure an IP whitelist is set +#tls_no_verify_certificate = 1 + + +# A whitelist of allowed x509 Distinguished Names +# This list may contain wildcards such as +# +# "C=GB,ST=London,L=London,O=Red Hat,CN=*" +# +# See the POSIX fnmatch function for the format of the wildcards. +# +# NB If this is an empty list, no client can connect, so comment out +# entirely rather than using empty list to disable these checks +# +# By default, no DN's are checked +#tls_allowed_dn_list = ["DN1", "DN2"] + + +# A whitelist of allowed SASL usernames. The format for username +# depends on the SASL authentication mechanism. Kerberos usernames +# look like username@REALM +# +# This list may contain wildcards such as +# +# "*@EXAMPLE.COM" +# +# See the POSIX fnmatch function for the format of the wildcards. +# +# NB If this is an empty list, no client can connect, so comment out +# entirely rather than using empty list to disable these checks +# +# By default, no Username's are checked +#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ] + + +# Override the compile time default TLS priority string. The +# default is usually "NORMAL" unless overridden at build time. +# Only set this is it is desired for libvirt to deviate from +# the global default settings. +# +#tls_priority="NORMAL" + + +################################################################# +# +# Processing controls +# + +# The maximum number of concurrent client connections to allow +# over all sockets combined. +#max_clients = 5000 + +# The maximum length of queue of connections waiting to be +# accepted by the daemon. Note, that some protocols supporting +# retransmission may obey this so that a later reattempt at +# connection succeeds. +#max_queued_clients = 1000 + +# The maximum length of queue of accepted but not yet +# authenticated clients. The default value is 20. Set this to +# zero to turn this feature off. +#max_anonymous_clients = 20 + +# The minimum limit sets the number of workers to start up +# initially. If the number of active clients exceeds this, +# then more threads are spawned, up to max_workers limit. +# Typically you'd want max_workers to equal maximum number +# of clients allowed +#min_workers = 5 +#max_workers = 20 + + +# The number of priority workers. If all workers from above +# pool are stuck, some calls marked as high priority +# (notably domainDestroy) can be executed in this pool. +#prio_workers = 5 + +# Limit on concurrent requests from a single client +# connection. To avoid one client monopolizing the server +# this should be a small fraction of the global max_workers +# parameter. +#max_client_requests = 5 + +# Same processing controls, but this time for the admin interface. +# For description of each option, be so kind to scroll few lines +# upwards. + +#admin_min_workers = 1 +#admin_max_workers = 5 +#admin_max_clients = 5 +#admin_max_queued_clients = 5 +#admin_max_client_requests = 5 + +################################################################# +# +# Logging controls +# + +# Logging level: 4 errors, 3 warnings, 2 information, 1 debug +# basically 1 will log everything possible +# Note: Journald may employ rate limiting of the messages logged +# and thus lock up the libvirt daemon. To use the debug level with +# journald you have to specify it explicitly in 'log_outputs', otherwise +# only information level messages will be logged. +#log_level = 3 + +# Logging filters: +# A filter allows to select a different logging level for a given category +# of logs +# The format for a filter is one of: +# x:name +# x:+name + +# where name is a string which is matched against the category +# given in the VIR_LOG_INIT() at the top of each libvirt source +# file, e.g., "remote", "qemu", or "util.json" (the name in the +# filter can be a substring of the full category name, in order +# to match multiple similar categories), the optional "+" prefix +# tells libvirt to log stack trace for each message matching +# name, and x is the minimal level where matching messages should +# be logged: + +# 1: DEBUG +# 2: INFO +# 3: WARNING +# 4: ERROR +# +# Multiple filters can be defined in a single @filters, they just need to be +# separated by spaces. +# +# e.g. to only get warning or errors from the remote layer and only errors +# from the event layer: +#log_filters="3:remote 4:event" + +# Logging outputs: +# An output is one of the places to save logging information +# The format for an output can be: +# x:stderr +# output goes to stderr +# x:syslog:name +# use syslog for the output and use the given name as the ident +# x:file:file_path +# output to a file, with the given filepath +# x:journald +# output to journald logging system +# In all case the x prefix is the minimal level, acting as a filter +# 1: DEBUG +# 2: INFO +# 3: WARNING +# 4: ERROR +# +# Multiple outputs can be defined, they just need to be separated by spaces. +# e.g. to log all warnings and errors to syslog under the libvirtd ident: +#log_outputs="3:syslog:libvirtd" +# + +# Log debug buffer size: +# +# This configuration option is no longer used, since the global +# log buffer functionality has been removed. Please configure +# suitable log_outputs/log_filters settings to obtain logs. +#log_buffer_size = 64 + + +################################################################## +# +# Auditing +# +# This setting allows usage of the auditing subsystem to be altered: +# +# audit_level == 0 -> disable all auditing +# audit_level == 1 -> enable auditing, only if enabled on host (default) +# audit_level == 2 -> enable auditing, and exit if disabled on host +# +#audit_level = 2 +# +# If set to 1, then audit messages will also be sent +# via libvirt logging infrastructure. Defaults to 0 +# +#audit_logging = 1 + +################################################################### +# UUID of the host: +# Host UUID is read from one of the sources specified in host_uuid_source. +# +# - 'smbios': fetch the UUID from 'dmidecode -s system-uuid' +# - 'machine-id': fetch the UUID from /etc/machine-id +# +# The host_uuid_source default is 'smbios'. If 'dmidecode' does not provide +# a valid UUID a temporary UUID will be generated. +# +# Another option is to specify host UUID in host_uuid. +# +# Keep the format of the example UUID below. UUID must not have all digits +# be the same. + +# NB This default all-zeros UUID will not work. Replace +# it with the output of the 'uuidgen' command and then +# uncomment this entry +#host_uuid = "00000000-0000-0000-0000-000000000000" +#host_uuid_source = "smbios" + +################################################################### +# Keepalive protocol: +# This allows libvirtd to detect broken client connections or even +# dead clients. A keepalive message is sent to a client after +# keepalive_interval seconds of inactivity to check if the client is +# still responding; keepalive_count is a maximum number of keepalive +# messages that are allowed to be sent to the client without getting +# any response before the connection is considered broken. In other +# words, the connection is automatically closed approximately after +# keepalive_interval * (keepalive_count + 1) seconds since the last +# message received from the client. If keepalive_interval is set to +# -1, libvirtd will never send keepalive requests; however clients +# can still send them and the daemon will send responses. When +# keepalive_count is set to 0, connections will be automatically +# closed after keepalive_interval seconds of inactivity without +# sending any keepalive messages. +# +#keepalive_interval = 5 +#keepalive_count = 5 + +# +# These configuration options are no longer used. There is no way to +# restrict such clients from connecting since they first need to +# connect in order to ask for keepalive. +# +#keepalive_required = 1 +#admin_keepalive_required = 1 + +# Keepalive settings for the admin interface +#admin_keepalive_interval = 5 +#admin_keepalive_count = 5 + +################################################################### +# Open vSwitch: +# This allows to specify a timeout for openvswitch calls made by +# libvirt. The ovs-vsctl utility is used for the configuration and +# its timeout option is set by default to 5 seconds to avoid +# potential infinite waits blocking libvirt. +# +#ovs_timeout = 5 diff --git a/ansible/files/linuxbridge_agent.ini b/ansible/files/linuxbridge_agent.ini new file mode 100644 index 0000000..9733c6e --- /dev/null +++ b/ansible/files/linuxbridge_agent.ini @@ -0,0 +1,9 @@ +[DEFAULT] +[agent] +[linux_bridge] +physical_interface_mappings = provider-nat:vlan165 +[securitygroup] +firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver +enable_ipset = true +[vxlan] +l2_population = true diff --git a/ansible/files/ml2_conf.ini b/ansible/files/ml2_conf.ini new file mode 100644 index 0000000..56152ca --- /dev/null +++ b/ansible/files/ml2_conf.ini @@ -0,0 +1,21 @@ +[DEFAULT] +[l2pop] +[ml2] +path_mtu = 9000 +tenant_network_types = vxlan +type_drivers = flat,vlan,vxlan +extension_drivers = port_security +mechanism_drivers = openvswitch,l2population +physical_network_mtus = provider:9000 +[ml2_type_flat] +[ml2_type_geneve] +[ml2_type_gre] +[ml2_type_vlan] +network_vlan_ranges = provider:160:165,212 +[ml2_type_vxlan] +vni_ranges = 65537:69999 +[securitygroup] +enable_security_group = True +firewall_driver = ovs_learn_action +[agent] +extensions = qos diff --git a/ansible/files/networks/ifcfg-bond0 b/ansible/files/networks/ifcfg-bond0 new file mode 100644 index 0000000..38bd5a5 --- /dev/null +++ b/ansible/files/networks/ifcfg-bond0 @@ -0,0 +1,11 @@ +TYPE=OVSBond +DEVICETYPE=ovs +NAME=bond0 +DEVICE=bond0 +ONBOOT=yes +BOOTPROTO=none +OVS_BRIDGE=br-ext-main +BOND_IFACES="{{ firstport.stdout }} {{ secondport.stdout }}" +OVS_OPTIONS="bond_mode=balance-tcp lacp=active" +NOZEROCONF=yes +HOTPUG=no diff --git a/ansible/files/networks/ifcfg-br-ext-main b/ansible/files/networks/ifcfg-br-ext-main new file mode 100644 index 0000000..bf9cbf4 --- /dev/null +++ b/ansible/files/networks/ifcfg-br-ext-main @@ -0,0 +1,7 @@ +DEVICE=br-ext-main +DEVICETYPE=ovs +TYPE=OVSBridge +BOOTPROTO=none +OVS_EXTRA="set int $DEVICE mtu_request=9000" +ONBOOT=yes +HOTPLUG=no diff --git a/ansible/files/networks/ifcfg-mgmt0 b/ansible/files/networks/ifcfg-mgmt0 new file mode 100644 index 0000000..fc56745 --- /dev/null +++ b/ansible/files/networks/ifcfg-mgmt0 @@ -0,0 +1,14 @@ +TYPE=OVSIntPort +DEVICETYPE=ovs +DEVICE=mgmt0 +ONBOOT=yes +OVS_BRIDGE=br-ext-main +OVS_OPTIONS="tag=161" +BOOTPROTO=static +IPADDR={{ public_ip.stdout }} +DNS1=172.17.1.10 +GATEWAY=172.17.1.1 +OVS_EXTRA="set int $DEVICE mtu_request=9000" +NOZEROCONF=yes +PREFIX=24 +HOTPLUG="no" diff --git a/ansible/files/networks/ifcfg-patch-main-ext01 b/ansible/files/networks/ifcfg-patch-main-ext01 new file mode 100644 index 0000000..c1cc9b9 --- /dev/null +++ b/ansible/files/networks/ifcfg-patch-main-ext01 @@ -0,0 +1,8 @@ +DEVICE=patch-main-ext01 +ONBOOT=yes +DEVICETYPE=ovs +TYPE=OVSPatchPort +OVS_OPTIONS="tag=160" +OVS_EXTRA="set int $DEVICE mtu_request=9000" +OVS_BRIDGE=br-main +OVS_PATCH_PEER=patch-ext01-main diff --git a/ansible/files/networks/ifcfg-patch-main-ext02 b/ansible/files/networks/ifcfg-patch-main-ext02 new file mode 100644 index 0000000..b4ba5a8 --- /dev/null +++ b/ansible/files/networks/ifcfg-patch-main-ext02 @@ -0,0 +1,8 @@ +DEVICE=patch-main-ext02 +ONBOOT=yes +DEVICETYPE=ovs +TYPE=OVSPatchPort +OVS_OPTIONS="tag=165" +OVS_EXTRA="set int $DEVICE mtu_request=9000" +OVS_BRIDGE=br-main +OVS_PATCH_PEER=patch-ext02-main diff --git a/ansible/files/networks/ifcfg-patch-main-slave b/ansible/files/networks/ifcfg-patch-main-slave new file mode 100644 index 0000000..baa88e4 --- /dev/null +++ b/ansible/files/networks/ifcfg-patch-main-slave @@ -0,0 +1,7 @@ +DEVICE=patch-main-slave +ONBOOT=yes +DEVICETYPE=ovs +TYPE=OVSPatchPort +OVS_EXTRA="set int $DEVICE mtu_request=9000" +OVS_BRIDGE=br-ext-main +OVS_PATCH_PEER=patch-slave-main diff --git a/ansible/files/networks/ifcfg-physicalif01 b/ansible/files/networks/ifcfg-physicalif01 new file mode 100644 index 0000000..63c15d3 --- /dev/null +++ b/ansible/files/networks/ifcfg-physicalif01 @@ -0,0 +1,5 @@ +TYPE=Ethernet +DEVICE={{ firstport.stdout }} +ONBOOT=yes +MTU=9000 +ETHTOOL_OPTS="-K ${DEVICE} rx off tx off; -K ${DEVICE} tso off; -K ${DEVICE} gso off" diff --git a/ansible/files/networks/ifcfg-physicalif02 b/ansible/files/networks/ifcfg-physicalif02 new file mode 100644 index 0000000..c389124 --- /dev/null +++ b/ansible/files/networks/ifcfg-physicalif02 @@ -0,0 +1,5 @@ +TYPE=Ethernet +DEVICE={{ secondport.stdout }} +ONBOOT=yes +MTU=9000 +ETHTOOL_OPTS="-K ${DEVICE} rx off tx off; -K ${DEVICE} tso off; -K ${DEVICE} gso off" diff --git a/ansible/files/networks/ifcfg-port-int b/ansible/files/networks/ifcfg-port-int new file mode 100644 index 0000000..0cd630a --- /dev/null +++ b/ansible/files/networks/ifcfg-port-int @@ -0,0 +1,12 @@ +TYPE=OVSIntPort +DEVICETYPE=ovs +DEVICE=port-int +ONBOOT=yes +OVS_BRIDGE=br-ext-main +OVS_OPTIONS="tag=162" +BOOTPROTO=static +OVS_EXTRA="set int $DEVICE mtu_request=9000" +IPADDR={{ private_ip.stdout }} +NOZEROCONF=yes +PREFIX=24 +HOTPLUG="no" diff --git a/ansible/files/networks/ifcfg-port-tun b/ansible/files/networks/ifcfg-port-tun new file mode 100644 index 0000000..814b79d --- /dev/null +++ b/ansible/files/networks/ifcfg-port-tun @@ -0,0 +1,12 @@ +TYPE=OVSIntPort +DEVICETYPE=ovs +DEVICE=port-tun +ONBOOT=yes +OVS_BRIDGE=br-dpdk +OVS_OPTIONS="tag=163" +BOOTPROTO=static +OVS_EXTRA="set int $DEVICE mtu_request=9000" +IPADDR={{ tun_ip.stdout }} +NOZEROCONF=yes +PREFIX=24 +HOTPLUG="no" diff --git a/ansible/files/neutron.conf b/ansible/files/neutron.conf new file mode 100644 index 0000000..cdf26e9 --- /dev/null +++ b/ansible/files/neutron.conf @@ -0,0 +1,29 @@ +[DEFAULT] +auth_strategy = keystone +transport_url = rabbit://openstack:GAQ5q55LTj9D@controller-virt +[agent] +[cors] +[database] +[keystone_authtoken] +auth_uri = http://controller-virt:5000 +auth_url = http://controller-virt:35357 +memcached_servers = controller-virt:11211 +auth_type = password +project_domain_name = Default +user_domain_name = Default +project_name = service +username = neutron +password = 9hEFkAtYY +[matchmaker_redis] +[nova] +[oslo_concurrency] +lock_path = /var/lib/neutron/tmp +[oslo_messaging_amqp] +[oslo_messaging_kafka] +[oslo_messaging_notifications] +[oslo_messaging_rabbit] +[oslo_messaging_zmq] +[oslo_middleware] +[oslo_policy] +[quotas] +[ssl] diff --git a/ansible/files/nova.conf b/ansible/files/nova.conf new file mode 100644 index 0000000..ef46356 --- /dev/null +++ b/ansible/files/nova.conf @@ -0,0 +1,111 @@ +[DEFAULT] +my_ip={{ public_ip.stdout }} +use_neutron=true +firewall_driver = nova.virt.firewall.NoopFirewallDriver +enabled_apis=osapi_compute,metadata +transport_url = rabbit://openstack:GAQ5q55LTj9D@controller-virt +force_raw_images = True +security_group_api = neutron +instance_usage_audit = True +instance_usage_audit_period = hour +notify_on_state_change = vm_and_task_state +compute_monitors = cpu.virt_driver, numa_mem_bw.virt_driver +[api] +auth_strategy=keystone +[api_database] +[barbican] +[cache] +[cells] +[cinder] +os_region_name = RegionOne +[compute] +[conductor] +[console] +[consoleauth] +[cors] +[crypto] +[database] +[ephemeral_storage_encryption] +[filter_scheduler] +[glance] +api_servers = http://controller-ceph:9292 +[guestfs] +[healthcheck] +[hyperv] +[ironic] +[key_manager] +[keystone] +[keystone_authtoken] +auth_url = http://controller-virt:5000 +auth_url = http://controller-virt:35357 +memcached_servers = controller-virt:11211 +auth_type = password +project_domain_name = Default +user_domain_name = Default +project_name = service +username = nova +password = AFdhNTV4Pj +[libvirt] +virt_type=kvm +images_type = rbd +images_rbd_pool = vms +images_rbd_ceph_conf = /etc/ceph/ceph.conf +rbd_user = vms +rbd_secret_uuid = 565f7a01-3486-4a62-85bf-fbcc8490d7ca +disk_cachemodes = writeback +[matchmaker_redis] +[metrics] +[mks] +[neutron] +url = http://controller-net:9696 +auth_url = http://controller-virt:35357 +auth_type = password +project_domain_name = Default +user_domain_name = Default +region_name = RegionOne +project_name = service +username = neutron +password = 9hEFkAtYYa +[notifications] +notify_on_state_change = vm_and_task_state +[osapi_v21] +[oslo_concurrency] +lock_path=/var/lib/nova/tmp +[oslo_messaging_amqp] +[oslo_messaging_kafka] +[oslo_messaging_notifications] +driver = messagingv2 +[oslo_messaging_rabbit] +[oslo_messaging_zmq] +[oslo_middleware] +[oslo_policy] +[pci] +[placement] +os_region_name = RegionOne +project_domain_name = Default +project_name = service +auth_type = password +user_domain_name = Default +auth_url = http://controller-virt:35357/v3 +username = placement +password = jxjuhBKRQ9 +[quota] +[rdp] +[remote_debug] +[scheduler] +[serial_console] +[service_user] +[spice] +[trusted_computing] +[upgrade_levels] +[vendordata_dynamic_auth] +[vmware] +[vnc] +enabled = True +vncserver_listen = 0.0.0.0 +vncserver_proxyclient_address = $my_ip +novncproxy_base_url = http://controller-virt:6080/vnc_auto.html +[workarounds] +[wsgi] +[xenserver] +[xvp] diff --git a/ansible/files/openvswitch_agent.ini b/ansible/files/openvswitch_agent.ini new file mode 100644 index 0000000..e5dda97 --- /dev/null +++ b/ansible/files/openvswitch_agent.ini @@ -0,0 +1,11 @@ +[DEFAULT] +[agent] +tunnel_types = vxlan +l2_population = true +arp_responder = True +[ovs] +local_ip = {{ tunnel_ip.stdout }} +bridge_mappings = provider:br-ext-main +[securitygroup] +firewall_driver = openvswitch +[xenapi] diff --git a/ansible/files/ovs-vswitchd.pp b/ansible/files/ovs-vswitchd.pp new file mode 100644 index 0000000..e71c13f Binary files /dev/null and b/ansible/files/ovs-vswitchd.pp differ diff --git a/ansible/files/ovsdb-server.pp b/ansible/files/ovsdb-server.pp new file mode 100644 index 0000000..4084570 Binary files /dev/null and b/ansible/files/ovsdb-server.pp differ diff --git a/ansible/files/secret.xml b/ansible/files/secret.xml new file mode 100644 index 0000000..533a6d9 --- /dev/null +++ b/ansible/files/secret.xml @@ -0,0 +1,6 @@ + +da3a1f59-cb17-4259-9351-0b30cc54d778 + + client.cinder secret + + diff --git a/ansible/files/snmpd.conf b/ansible/files/snmpd.conf new file mode 100644 index 0000000..cac486c --- /dev/null +++ b/ansible/files/snmpd.conf @@ -0,0 +1,464 @@ +############################################################################### +# +# snmpd.conf: +# An example configuration file for configuring the ucd-snmp snmpd agent. +# +############################################################################### +# +# This file is intended to only be as a starting point. Many more +# configuration directives exist than are mentioned in this file. For +# full details, see the snmpd.conf(5) manual page. +# +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +############################################################################### +# Access Control +############################################################################### + +# As shipped, the snmpd demon will only respond to queries on the +# system mib group until this file is replaced or modified for +# security purposes. Examples are shown below about how to increase the +# level of access. + +# By far, the most common question I get about the agent is "why won't +# it work?", when really it should be "how do I configure the agent to +# allow me to access it?" +# +# By default, the agent responds to the "public" community for read +# only access, if run out of the box without any configuration file in +# place. The following examples show you other ways of configuring +# the agent so that you can change the community names, and give +# yourself write access to the mib tree as well. +# +# For more information, read the FAQ as well as the snmpd.conf(5) +# manual page. + +#### +# First, map the community name "public" into a "security name" + +# sec.name source community +com2sec notConfigUser default public + +#### +# Second, map the security name into a group name: + +# groupName securityModel securityName +group notConfigGroup v1 notConfigUser +group notConfigGroup v2c notConfigUser + +#### +# Third, create a view for us to let the group have rights to: + +# Make at least snmpwalk -v 1 localhost -c public system fast again. +# name incl/excl subtree mask(optional) +view systemview included .1.3.6.1.2.1 +view systemview included .1.3.6.1.4.1.2021 +view systemview included .1.3.6.1.2.1.1 +view systemview included .1.3.6.1.2.1.25.1.1 + +#### +# Finally, grant the group read-only access to the systemview view. + +# group context sec.model sec.level prefix read write notif +access notConfigGroup "" any noauth exact systemview none none + +# ----------------------------------------------------------------------------- + +# Here is a commented out example configuration that allows less +# restrictive access. + +# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY +# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO +# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. + +## sec.name source community +#com2sec local localhost COMMUNITY +#com2sec mynetwork NETWORK/24 COMMUNITY + +## group.name sec.model sec.name +#group MyRWGroup any local +#group MyROGroup any mynetwork +# +#group MyRWGroup any otherv3user +#... + +## incl/excl subtree mask +#view all included .1 80 + +## -or just the mib2 tree- + +#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc + + +## context sec.model sec.level prefix read write notif +#access MyROGroup "" any noauth 0 all none none +#access MyRWGroup "" any noauth 0 all all all + + +############################################################################### +# Sample configuration to make net-snmpd RFC 1213. +# Unfortunately v1 and v2c don't allow any user based authentification, so +# opening up the default config is not an option from a security point. +# +# WARNING: If you uncomment the following lines you allow write access to your +# snmpd daemon from any source! To avoid this use different names for your +# community or split out the write access to a different community and +# restrict it to your local network. +# Also remember to comment the syslocation and syscontact parameters later as +# otherwise they are still read only (see FAQ for net-snmp). +# + +# First, map the community name "public" into a "security name" +# sec.name source community +#com2sec notConfigUser default public + +# Second, map the security name into a group name: +# groupName securityModel securityName +#group notConfigGroup v1 notConfigUser +#group notConfigGroup v2c notConfigUser + +# Third, create a view for us to let the group have rights to: +# Open up the whole tree for ro, make the RFC 1213 required ones rw. +# name incl/excl subtree mask(optional) +#view roview included .1 +#view rwview included system.sysContact +#view rwview included system.sysName +#view rwview included system.sysLocation +#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus +#view rwview included at.atTable.atEntry.atPhysAddress +#view rwview included at.atTable.atEntry.atNetAddress +#view rwview included ip.ipForwarding +#view rwview included ip.ipDefaultTTL +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5 +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType +#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState +#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger +#view rwview included snmp.snmpEnableAuthenTraps + +# Finally, grant the group read-only access to the systemview view. +# group context sec.model sec.level prefix read write notif +#access notConfigGroup "" any noauth exact roview rwview none + + + +############################################################################### +# System contact information +# + +# It is also possible to set the sysContact and sysLocation system +# variables through the snmpd.conf file: + +syslocation Unknown (edit /etc/snmp/snmpd.conf) +syscontact Root (configure /etc/snmp/snmp.local.conf) + +# Example output of snmpwalk: +# % snmpwalk -v 1 localhost -c public system +# system.sysDescr.0 = "SunOS name sun4c" +# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 +# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 +# system.sysContact.0 = "Me " +# system.sysName.0 = "name" +# system.sysLocation.0 = "Right here, right now." +# system.sysServices.0 = 72 + + +############################################################################### +# Logging +# + +# We do not want annoying "Connection from UDP: " messages in syslog. +# If the following option is commented out, snmpd will print each incoming +# connection, which can be useful for debugging. + +dontLogTCPWrappersConnects yes + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Process checks. +# +# The following are examples of how to use the agent to check for +# processes running on the host. The syntax looks something like: +# +# proc NAME [MAX=0] [MIN=0] +# +# NAME: the name of the process to check for. It must match +# exactly (ie, http will not find httpd processes). +# MAX: the maximum number allowed to be running. Defaults to 0. +# MIN: the minimum number to be running. Defaults to 0. + +# +# Examples (commented out by default): +# + +# Make sure mountd is running +#proc mountd + +# Make sure there are no more than 4 ntalkds running, but 0 is ok too. +#proc ntalkd 4 + +# Make sure at least one sendmail, but less than or equal to 10 are running. +#proc sendmail 10 1 + +# A snmpwalk of the process mib tree would look something like this: +# +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2 +# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 +# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 +# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" +# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" +# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" +# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 +# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 +# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." +# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" +# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" +# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 +# +# Note that the errorFlag for mountd is set to 1 because one is not +# running (in this case an rpc.mountd is, but thats not good enough), +# and the ErrMessage tells you what's wrong. The configuration +# imposed in the snmpd.conf file is also shown. +# +# Special Case: When the min and max numbers are both 0, it assumes +# you want a max of infinity and a min of 1. +# + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Executables/scripts +# + +# +# You can also have programs run by the agent that return a single +# line of output and an exit code. Here are two examples. +# +# exec NAME PROGRAM [ARGS ...] +# +# NAME: A generic name. The name must be unique for each exec statement. +# PROGRAM: The program to run. Include the path! +# ARGS: optional arguments to be passed to the program + +# a simple hello world + +#exec echotest /bin/echo hello world + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +#exec shelltest /bin/sh /tmp/shtest + +# Then, +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8 +# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 +# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 +# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" +# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" +# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" +# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 +# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 + +# Note that the second line of the /tmp/shtest shell script is cut +# off. Also note that the exit status of 35 was returned. + +# ----------------------------------------------------------------------------- + + +############################################################################### +# disk checks +# + +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. + +# disk PATH [MIN=100000] +# +# PATH: mount path to the disk in question. +# MIN: Disks with space below this value will have the Mib's errorFlag set. +# Default value = 100000. + +# Check the / partition and make sure it contains at least 10 megs. + +#disk / 10000 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 +# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F +# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" +# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 +# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 +# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 +# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 +# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# load average checks +# + +# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] +# +# 1MAX: If the 1 minute load average is above this limit at query +# time, the errorFlag will be set. +# 5MAX: Similar, but for 5 min average. +# 15MAX: Similar, but for 15 min average. + +# Check for loads: +#load 12 14 14 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Extensible sections. +# + +# This alleviates the multiple line output problem found in the +# previous executable mib by placing each mib in its own mib table: + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50 +# enterprises.ucdavis.50.1.1 = 1 +# enterprises.ucdavis.50.2.1 = "shelltest" +# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.50.100.1 = 35 +# enterprises.ucdavis.50.101.1 = "hello world." +# enterprises.ucdavis.50.101.2 = "hi there." +# enterprises.ucdavis.50.102.1 = 0 + +# Now the Output has grown to two lines, and we can see the 'hi +# there.' output as the second line from our shell script. +# +# Note that you must alter the mib.txt file to be correct if you want +# the .50.* outputs above to change to reasonable text descriptions. + +# Other ideas: +# +# exec .1.3.6.1.4.1.2021.51 ps /bin/ps +# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top +# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Pass through control. +# + +# Usage: +# pass MIBOID EXEC-COMMAND +# +# This will pass total control of the mib underneath the MIBOID +# portion of the mib to the EXEC-COMMAND. +# +# Note: You'll have to change the path of the passtest script to your +# source directory or install it in the given location. +# +# Example: (see the script for details) +# (commented out here since it requires that you place the +# script in the right location. (its not installed by default)) + +# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255 +# enterprises.ucdavis.255.1 = "life the universe and everything" +# enterprises.ucdavis.255.2.1 = 42 +# enterprises.ucdavis.255.2.2 = OID: 42.42.42 +# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 +# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 +# enterprises.ucdavis.255.5 = 42 +# enterprises.ucdavis.255.6 = Gauge: 42 +# +# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 +# enterprises.ucdavis.255.5 = 42 +# +# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" +# enterprises.ucdavis.255.1 = "New string" +# + +# For specific usage information, see the man/snmpd.conf.5 manual page +# as well as the local/passtest script used in the above example. + +############################################################################### +# Further Information +# +# See the snmpd.conf manual page, and the output of "snmpd -H". diff --git a/ansible/files/snmpd.new b/ansible/files/snmpd.new new file mode 100644 index 0000000..e03886c --- /dev/null +++ b/ansible/files/snmpd.new @@ -0,0 +1,484 @@ +############################################################################### +# +# snmpd.conf: +# An example configuration file for configuring the ucd-snmp snmpd agent. +# +############################################################################### +# +# This file is intended to only be as a starting point. Many more +# configuration directives exist than are mentioned in this file. For +# full details, see the snmpd.conf(5) manual page. +# +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +############################################################################### +# Access Control +############################################################################### + +# As shipped, the snmpd demon will only respond to queries on the +# system mib group until this file is replaced or modified for +# security purposes. Examples are shown below about how to increase the +# level of access. + +# By far, the most common question I get about the agent is "why won't +# it work?", when really it should be "how do I configure the agent to +# allow me to access it?" +# +# By default, the agent responds to the "public" community for read +# only access, if run out of the box without any configuration file in +# place. The following examples show you other ways of configuring +# the agent so that you can change the community names, and give +# yourself write access to the mib tree as well. +# +# For more information, read the FAQ as well as the snmpd.conf(5) +# manual page. + +#### +# First, map the community name "public" into a "security name" + +# sec.name source community +com2sec notConfigUser default public + +#### +# Second, map the security name into a group name: + +# groupName securityModel securityName +group notConfigGroup v1 notConfigUser +group notConfigGroup v2c notConfigUser + +#### +# Third, create a view for us to let the group have rights to: + +# Make at least snmpwalk -v 1 localhost -c public system fast again. +# name incl/excl subtree mask(optional) +#view systemview included .1.3.6.1.2.1 +#view systemview included .1.3.6.1.4.1.2021 + +view systemview included .1.3.6.1.4.1.2021.10.1.3.1 +view systemview included .1.3.6.1.4.1.2021.10.1.3.2 +view systemview included .1.3.6.1.4.1.2021.10.1.3.3 +view systemview included .1.3.6.1.4.1.2021.11.9.0 +view systemview included .1.3.6.1.4.1.2021.4.5.0 +view systemview included .1.3.6.1.4.1.2021.4.6.0 +view systemview included .1.3.6.1.4.1.2021.4.3.0 +view systemview included .1.3.6.1.4.1.2021.4.4.0 +view systemview included .1.3.6.1.4.1.2021.4.14.0 +view systemview included .1.3.6.1.4.1.2021.4.15.0 +view systemview included .1.3.6.1.2.1.2.2.1.10 +view systemview included .1.3.6.1.2.1.2.2.1.2 +view systemview included .1.3.6.1.2.1.2.2.1.5 +view systemview included .1.3.6.1.2.1.2.2.1.6 +view systemview included .1.3.6.1.2.1.2.2.1.16 +view systemview included .1.3.6.1.2.1.2.2.1.20 +view systemview included .1.3.6.1.2.1.4.10.0 +view systemview included .1.3.6.1.2.1.4.3.0 +view systemview included .1.3.6.1.4.1.2021.11.11.0 +view systemview included .1.3.6.1.2.1.1 +view systemview included .1.3.6.1.2.1.25.1.1 + +#### +# Finally, grant the group read-only access to the systemview view. + +# group context sec.model sec.level prefix read write notif +access notConfigGroup "" any noauth exact systemview none none + +# ----------------------------------------------------------------------------- + +# Here is a commented out example configuration that allows less +# restrictive access. + +# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY +# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO +# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. + +## sec.name source community +#com2sec local localhost COMMUNITY +#com2sec mynetwork NETWORK/24 COMMUNITY + +## group.name sec.model sec.name +#group MyRWGroup any local +#group MyROGroup any mynetwork +# +#group MyRWGroup any otherv3user +#... + +## incl/excl subtree mask +#view all included .1 80 + +## -or just the mib2 tree- + +#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc + + +## context sec.model sec.level prefix read write notif +#access MyROGroup "" any noauth 0 all none none +#access MyRWGroup "" any noauth 0 all all all + + +############################################################################### +# Sample configuration to make net-snmpd RFC 1213. +# Unfortunately v1 and v2c don't allow any user based authentification, so +# opening up the default config is not an option from a security point. +# +# WARNING: If you uncomment the following lines you allow write access to your +# snmpd daemon from any source! To avoid this use different names for your +# community or split out the write access to a different community and +# restrict it to your local network. +# Also remember to comment the syslocation and syscontact parameters later as +# otherwise they are still read only (see FAQ for net-snmp). +# + +# First, map the community name "public" into a "security name" +# sec.name source community +#com2sec notConfigUser default public + +# Second, map the security name into a group name: +# groupName securityModel securityName +#group notConfigGroup v1 notConfigUser +#group notConfigGroup v2c notConfigUser + +# Third, create a view for us to let the group have rights to: +# Open up the whole tree for ro, make the RFC 1213 required ones rw. +# name incl/excl subtree mask(optional) +#view roview included .1 +#view rwview included system.sysContact +#view rwview included system.sysName +#view rwview included system.sysLocation +#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus +#view rwview included at.atTable.atEntry.atPhysAddress +#view rwview included at.atTable.atEntry.atNetAddress +#view rwview included ip.ipForwarding +#view rwview included ip.ipDefaultTTL +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5 +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType +#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState +#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger +#view rwview included snmp.snmpEnableAuthenTraps + +# Finally, grant the group read-only access to the systemview view. +# group context sec.model sec.level prefix read write notif +#access notConfigGroup "" any noauth exact roview rwview none + + + +############################################################################### +# System contact information +# + +# It is also possible to set the sysContact and sysLocation system +# variables through the snmpd.conf file: + +syslocation Unknown (edit /etc/snmp/snmpd.conf) +syscontact Root (configure /etc/snmp/snmp.local.conf) + +# Example output of snmpwalk: +# % snmpwalk -v 1 localhost -c public system +# system.sysDescr.0 = "SunOS name sun4c" +# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 +# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 +# system.sysContact.0 = "Me " +# system.sysName.0 = "name" +# system.sysLocation.0 = "Right here, right now." +# system.sysServices.0 = 72 + + +############################################################################### +# Logging +# + +# We do not want annoying "Connection from UDP: " messages in syslog. +# If the following option is commented out, snmpd will print each incoming +# connection, which can be useful for debugging. + +dontLogTCPWrappersConnects yes + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Process checks. +# +# The following are examples of how to use the agent to check for +# processes running on the host. The syntax looks something like: +# +# proc NAME [MAX=0] [MIN=0] +# +# NAME: the name of the process to check for. It must match +# exactly (ie, http will not find httpd processes). +# MAX: the maximum number allowed to be running. Defaults to 0. +# MIN: the minimum number to be running. Defaults to 0. + +# +# Examples (commented out by default): +# + +# Make sure mountd is running +#proc mountd + +# Make sure there are no more than 4 ntalkds running, but 0 is ok too. +#proc ntalkd 4 + +# Make sure at least one sendmail, but less than or equal to 10 are running. +#proc sendmail 10 1 + +# A snmpwalk of the process mib tree would look something like this: +# +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2 +# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 +# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 +# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" +# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" +# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" +# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 +# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 +# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." +# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" +# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" +# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 +# +# Note that the errorFlag for mountd is set to 1 because one is not +# running (in this case an rpc.mountd is, but thats not good enough), +# and the ErrMessage tells you what's wrong. The configuration +# imposed in the snmpd.conf file is also shown. +# +# Special Case: When the min and max numbers are both 0, it assumes +# you want a max of infinity and a min of 1. +# + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Executables/scripts +# + +# +# You can also have programs run by the agent that return a single +# line of output and an exit code. Here are two examples. +# +# exec NAME PROGRAM [ARGS ...] +# +# NAME: A generic name. The name must be unique for each exec statement. +# PROGRAM: The program to run. Include the path! +# ARGS: optional arguments to be passed to the program + +# a simple hello world + +#exec echotest /bin/echo hello world + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +#exec shelltest /bin/sh /tmp/shtest + +# Then, +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8 +# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 +# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 +# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" +# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" +# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" +# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 +# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 + +# Note that the second line of the /tmp/shtest shell script is cut +# off. Also note that the exit status of 35 was returned. + +# ----------------------------------------------------------------------------- + + +############################################################################### +# disk checks +# + +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. + +# disk PATH [MIN=100000] +# +# PATH: mount path to the disk in question. +# MIN: Disks with space below this value will have the Mib's errorFlag set. +# Default value = 100000. + +# Check the / partition and make sure it contains at least 10 megs. + +#disk / 10000 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 +# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F +# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" +# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 +# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 +# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 +# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 +# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# load average checks +# + +# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] +# +# 1MAX: If the 1 minute load average is above this limit at query +# time, the errorFlag will be set. +# 5MAX: Similar, but for 5 min average. +# 15MAX: Similar, but for 15 min average. + +# Check for loads: +#load 12 14 14 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Extensible sections. +# + +# This alleviates the multiple line output problem found in the +# previous executable mib by placing each mib in its own mib table: + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50 +# enterprises.ucdavis.50.1.1 = 1 +# enterprises.ucdavis.50.2.1 = "shelltest" +# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.50.100.1 = 35 +# enterprises.ucdavis.50.101.1 = "hello world." +# enterprises.ucdavis.50.101.2 = "hi there." +# enterprises.ucdavis.50.102.1 = 0 + +# Now the Output has grown to two lines, and we can see the 'hi +# there.' output as the second line from our shell script. +# +# Note that you must alter the mib.txt file to be correct if you want +# the .50.* outputs above to change to reasonable text descriptions. + +# Other ideas: +# +# exec .1.3.6.1.4.1.2021.51 ps /bin/ps +# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top +# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Pass through control. +# + +# Usage: +# pass MIBOID EXEC-COMMAND +# +# This will pass total control of the mib underneath the MIBOID +# portion of the mib to the EXEC-COMMAND. +# +# Note: You'll have to change the path of the passtest script to your +# source directory or install it in the given location. +# +# Example: (see the script for details) +# (commented out here since it requires that you place the +# script in the right location. (its not installed by default)) + +# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255 +# enterprises.ucdavis.255.1 = "life the universe and everything" +# enterprises.ucdavis.255.2.1 = 42 +# enterprises.ucdavis.255.2.2 = OID: 42.42.42 +# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 +# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 +# enterprises.ucdavis.255.5 = 42 +# enterprises.ucdavis.255.6 = Gauge: 42 +# +# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 +# enterprises.ucdavis.255.5 = 42 +# +# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" +# enterprises.ucdavis.255.1 = "New string" +# + +# For specific usage information, see the man/snmpd.conf.5 manual page +# as well as the local/passtest script used in the above example. + +############################################################################### +# Further Information +# +# See the snmpd.conf manual page, and the output of "snmpd -H". diff --git a/ansible/files/snmpd.original b/ansible/files/snmpd.original new file mode 100644 index 0000000..cac486c --- /dev/null +++ b/ansible/files/snmpd.original @@ -0,0 +1,464 @@ +############################################################################### +# +# snmpd.conf: +# An example configuration file for configuring the ucd-snmp snmpd agent. +# +############################################################################### +# +# This file is intended to only be as a starting point. Many more +# configuration directives exist than are mentioned in this file. For +# full details, see the snmpd.conf(5) manual page. +# +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +############################################################################### +# Access Control +############################################################################### + +# As shipped, the snmpd demon will only respond to queries on the +# system mib group until this file is replaced or modified for +# security purposes. Examples are shown below about how to increase the +# level of access. + +# By far, the most common question I get about the agent is "why won't +# it work?", when really it should be "how do I configure the agent to +# allow me to access it?" +# +# By default, the agent responds to the "public" community for read +# only access, if run out of the box without any configuration file in +# place. The following examples show you other ways of configuring +# the agent so that you can change the community names, and give +# yourself write access to the mib tree as well. +# +# For more information, read the FAQ as well as the snmpd.conf(5) +# manual page. + +#### +# First, map the community name "public" into a "security name" + +# sec.name source community +com2sec notConfigUser default public + +#### +# Second, map the security name into a group name: + +# groupName securityModel securityName +group notConfigGroup v1 notConfigUser +group notConfigGroup v2c notConfigUser + +#### +# Third, create a view for us to let the group have rights to: + +# Make at least snmpwalk -v 1 localhost -c public system fast again. +# name incl/excl subtree mask(optional) +view systemview included .1.3.6.1.2.1 +view systemview included .1.3.6.1.4.1.2021 +view systemview included .1.3.6.1.2.1.1 +view systemview included .1.3.6.1.2.1.25.1.1 + +#### +# Finally, grant the group read-only access to the systemview view. + +# group context sec.model sec.level prefix read write notif +access notConfigGroup "" any noauth exact systemview none none + +# ----------------------------------------------------------------------------- + +# Here is a commented out example configuration that allows less +# restrictive access. + +# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY +# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO +# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. + +## sec.name source community +#com2sec local localhost COMMUNITY +#com2sec mynetwork NETWORK/24 COMMUNITY + +## group.name sec.model sec.name +#group MyRWGroup any local +#group MyROGroup any mynetwork +# +#group MyRWGroup any otherv3user +#... + +## incl/excl subtree mask +#view all included .1 80 + +## -or just the mib2 tree- + +#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc + + +## context sec.model sec.level prefix read write notif +#access MyROGroup "" any noauth 0 all none none +#access MyRWGroup "" any noauth 0 all all all + + +############################################################################### +# Sample configuration to make net-snmpd RFC 1213. +# Unfortunately v1 and v2c don't allow any user based authentification, so +# opening up the default config is not an option from a security point. +# +# WARNING: If you uncomment the following lines you allow write access to your +# snmpd daemon from any source! To avoid this use different names for your +# community or split out the write access to a different community and +# restrict it to your local network. +# Also remember to comment the syslocation and syscontact parameters later as +# otherwise they are still read only (see FAQ for net-snmp). +# + +# First, map the community name "public" into a "security name" +# sec.name source community +#com2sec notConfigUser default public + +# Second, map the security name into a group name: +# groupName securityModel securityName +#group notConfigGroup v1 notConfigUser +#group notConfigGroup v2c notConfigUser + +# Third, create a view for us to let the group have rights to: +# Open up the whole tree for ro, make the RFC 1213 required ones rw. +# name incl/excl subtree mask(optional) +#view roview included .1 +#view rwview included system.sysContact +#view rwview included system.sysName +#view rwview included system.sysLocation +#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus +#view rwview included at.atTable.atEntry.atPhysAddress +#view rwview included at.atTable.atEntry.atNetAddress +#view rwview included ip.ipForwarding +#view rwview included ip.ipDefaultTTL +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5 +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType +#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState +#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger +#view rwview included snmp.snmpEnableAuthenTraps + +# Finally, grant the group read-only access to the systemview view. +# group context sec.model sec.level prefix read write notif +#access notConfigGroup "" any noauth exact roview rwview none + + + +############################################################################### +# System contact information +# + +# It is also possible to set the sysContact and sysLocation system +# variables through the snmpd.conf file: + +syslocation Unknown (edit /etc/snmp/snmpd.conf) +syscontact Root (configure /etc/snmp/snmp.local.conf) + +# Example output of snmpwalk: +# % snmpwalk -v 1 localhost -c public system +# system.sysDescr.0 = "SunOS name sun4c" +# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 +# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 +# system.sysContact.0 = "Me " +# system.sysName.0 = "name" +# system.sysLocation.0 = "Right here, right now." +# system.sysServices.0 = 72 + + +############################################################################### +# Logging +# + +# We do not want annoying "Connection from UDP: " messages in syslog. +# If the following option is commented out, snmpd will print each incoming +# connection, which can be useful for debugging. + +dontLogTCPWrappersConnects yes + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Process checks. +# +# The following are examples of how to use the agent to check for +# processes running on the host. The syntax looks something like: +# +# proc NAME [MAX=0] [MIN=0] +# +# NAME: the name of the process to check for. It must match +# exactly (ie, http will not find httpd processes). +# MAX: the maximum number allowed to be running. Defaults to 0. +# MIN: the minimum number to be running. Defaults to 0. + +# +# Examples (commented out by default): +# + +# Make sure mountd is running +#proc mountd + +# Make sure there are no more than 4 ntalkds running, but 0 is ok too. +#proc ntalkd 4 + +# Make sure at least one sendmail, but less than or equal to 10 are running. +#proc sendmail 10 1 + +# A snmpwalk of the process mib tree would look something like this: +# +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2 +# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 +# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 +# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" +# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" +# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" +# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 +# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 +# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." +# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" +# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" +# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 +# +# Note that the errorFlag for mountd is set to 1 because one is not +# running (in this case an rpc.mountd is, but thats not good enough), +# and the ErrMessage tells you what's wrong. The configuration +# imposed in the snmpd.conf file is also shown. +# +# Special Case: When the min and max numbers are both 0, it assumes +# you want a max of infinity and a min of 1. +# + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Executables/scripts +# + +# +# You can also have programs run by the agent that return a single +# line of output and an exit code. Here are two examples. +# +# exec NAME PROGRAM [ARGS ...] +# +# NAME: A generic name. The name must be unique for each exec statement. +# PROGRAM: The program to run. Include the path! +# ARGS: optional arguments to be passed to the program + +# a simple hello world + +#exec echotest /bin/echo hello world + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +#exec shelltest /bin/sh /tmp/shtest + +# Then, +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8 +# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 +# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 +# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" +# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" +# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" +# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 +# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 + +# Note that the second line of the /tmp/shtest shell script is cut +# off. Also note that the exit status of 35 was returned. + +# ----------------------------------------------------------------------------- + + +############################################################################### +# disk checks +# + +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. + +# disk PATH [MIN=100000] +# +# PATH: mount path to the disk in question. +# MIN: Disks with space below this value will have the Mib's errorFlag set. +# Default value = 100000. + +# Check the / partition and make sure it contains at least 10 megs. + +#disk / 10000 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 +# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F +# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" +# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 +# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 +# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 +# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 +# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# load average checks +# + +# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] +# +# 1MAX: If the 1 minute load average is above this limit at query +# time, the errorFlag will be set. +# 5MAX: Similar, but for 5 min average. +# 15MAX: Similar, but for 15 min average. + +# Check for loads: +#load 12 14 14 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Extensible sections. +# + +# This alleviates the multiple line output problem found in the +# previous executable mib by placing each mib in its own mib table: + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50 +# enterprises.ucdavis.50.1.1 = 1 +# enterprises.ucdavis.50.2.1 = "shelltest" +# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.50.100.1 = 35 +# enterprises.ucdavis.50.101.1 = "hello world." +# enterprises.ucdavis.50.101.2 = "hi there." +# enterprises.ucdavis.50.102.1 = 0 + +# Now the Output has grown to two lines, and we can see the 'hi +# there.' output as the second line from our shell script. +# +# Note that you must alter the mib.txt file to be correct if you want +# the .50.* outputs above to change to reasonable text descriptions. + +# Other ideas: +# +# exec .1.3.6.1.4.1.2021.51 ps /bin/ps +# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top +# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Pass through control. +# + +# Usage: +# pass MIBOID EXEC-COMMAND +# +# This will pass total control of the mib underneath the MIBOID +# portion of the mib to the EXEC-COMMAND. +# +# Note: You'll have to change the path of the passtest script to your +# source directory or install it in the given location. +# +# Example: (see the script for details) +# (commented out here since it requires that you place the +# script in the right location. (its not installed by default)) + +# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255 +# enterprises.ucdavis.255.1 = "life the universe and everything" +# enterprises.ucdavis.255.2.1 = 42 +# enterprises.ucdavis.255.2.2 = OID: 42.42.42 +# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 +# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 +# enterprises.ucdavis.255.5 = 42 +# enterprises.ucdavis.255.6 = Gauge: 42 +# +# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 +# enterprises.ucdavis.255.5 = 42 +# +# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" +# enterprises.ucdavis.255.1 = "New string" +# + +# For specific usage information, see the man/snmpd.conf.5 manual page +# as well as the local/passtest script used in the above example. + +############################################################################### +# Further Information +# +# See the snmpd.conf manual page, and the output of "snmpd -H". diff --git a/ansible/files/vms-secret.xml b/ansible/files/vms-secret.xml new file mode 100644 index 0000000..45298f4 --- /dev/null +++ b/ansible/files/vms-secret.xml @@ -0,0 +1,6 @@ + +565f7a01-3486-4a62-85bf-fbcc8490d7ca + + client.vms secret + + diff --git a/ansible/group_vars/bonchvisors b/ansible/group_vars/bonchvisors new file mode 100644 index 0000000..fe25657 --- /dev/null +++ b/ansible/group_vars/bonchvisors @@ -0,0 +1,2 @@ +--- +ansible_ssh_user: cephadmin diff --git a/ansible/hosts b/ansible/hosts new file mode 100644 index 0000000..5d2b2b1 --- /dev/null +++ b/ansible/hosts @@ -0,0 +1,71 @@ +# This is the default ansible 'hosts' file. +# +# It should live in /etc/ansible/hosts +# +# - Comments begin with the '#' character +# - Blank lines are ignored +# - Groups of hosts are delimited by [header] elements +# - You can enter hostnames or ip addresses +# - A hostname/ip can be a member of multiple groups + +# Ex 1: Ungrouped hosts, specify before any group headers. + +## green.example.com +## blue.example.com +## 192.168.100.1 +## 192.168.100.10 + +# Ex 2: A collection of hosts belonging to the 'webservers' group + +## [webservers] +## alpha.example.org +## beta.example.org +## 192.168.1.100 +## 192.168.1.110 + +# If you have multiple hosts following a pattern you can specify +# them like this: + +## www[001:006].example.com + +# Ex 3: A collection of database servers in the 'dbservers' group + +## [dbservers] +## +## db01.intranet.mydomain.net +## db02.intranet.mydomain.net +## 10.25.1.56 +## 10.25.1.57 + +# Here's another example of host ranges, this time there are no +# leading 0s: + +## db-[99:101]-node.example.com + +[bonchvisors] +bonchvisor04 ansible_ssh_host=172.17.2.54 ansible_user=cephadmin +bonchvisor05 ansible_ssh_host=172.17.2.55 ansible_user=cephadmin +bonchvisor06 ansible_ssh_host=172.17.2.56 ansible_user=cephadmin +bonchvisor07 ansible_ssh_host=172.17.2.57 ansible_user=cephadmin +bonchvisor08 ansible_ssh_host=172.17.2.58 ansible_user=cephadmin +bonchvisor09 ansible_ssh_host=172.17.2.59 ansible_user=cephadmin +bonchvisor10 ansible_ssh_host=172.17.2.60 ansible_user=cephadmin +bonchvisor11 ansible_ssh_host=172.17.2.61 ansible_user=cephadmin +bonchvisor12 ansible_ssh_host=172.17.2.62 ansible_user=cephadmin + +[bonchvisors-small] +bonchvisor05 ansible_ssh_host=172.17.2.55 +bonchvisor06 ansible_ssh_host=172.17.2.56 +bonchvisor07 ansible_ssh_host=172.17.2.57 +bonchvisor08 ansible_ssh_host=172.17.2.58 +bonchvisor09 ansible_ssh_host=172.17.2.59 +bonchvisor10 ansible_ssh_host=172.17.2.60 +bonchvisor11 ansible_ssh_host=172.17.2.61 +bonchvisor12 ansible_ssh_host=172.17.2.62 + +[bonchvisor-dpdk] + +[controllers] +controller-ceph ansible_ssh_host=172.17.2.50 +controller-virt ansible_ssh_host=172.17.2.100 +controller-net ansible_ssh_host=172.17.2.200 diff --git a/ansible/openstack-inital-components.yml b/ansible/openstack-inital-components.yml new file mode 100644 index 0000000..04a29a9 --- /dev/null +++ b/ansible/openstack-inital-components.yml @@ -0,0 +1,26 @@ +- hosts: {{ your hosts }} + remote_user: {{ you users }} + become: true + become_user: root + become_method: sudo + + tasks: + + - name: ensure a list of packages installed + yum: + name: centos-release-openstack-pike + state: latest + + - name: upgrade all packages + yum: + name: '*' + state: latest + + + - name: ensure a list of packages installed + yum: + name: "{{ packages }}" + vars: + packages: + - python-openstackclient + - openstack-selinux diff --git a/ansible/openstack_hosts_addline.yml b/ansible/openstack_hosts_addline.yml new file mode 100644 index 0000000..37a3bee --- /dev/null +++ b/ansible/openstack_hosts_addline.yml @@ -0,0 +1,27 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: Add hosts entry + lineinfile: + path: /etc/hosts + line: "{{ item.hosts }}" + with_items: + - { hosts: '172.17.3.54 bonchvisor04' } + - { hosts: '172.17.3.55 bonchvisor05' } + - { hosts: '172.17.3.56 bonchvisor06' } + - { hosts: '172.17.3.57 bonchvisor07' } + - { hosts: '172.17.3.58 bonchvisor08' } + - { hosts: '172.17.3.59 bonchvisor09' } + - { hosts: '172.17.3.60 bonchvisor10' } + - { hosts: '172.17.3.61 bonchvisor11' } + - { hosts: '172.17.3.62 bonchvisor12' } + - { hosts: '172.17.3.63 bonchvisor13' } + - { hosts: '172.17.3.64 bonchvisor14' } + - { hosts: '172.17.3.50 controller-ceph' } + - { hosts: '172.17.3.100 controller-virt' } diff --git a/ansible/playbooks/ceph_clean_disks.yml b/ansible/playbooks/ceph_clean_disks.yml new file mode 100644 index 0000000..0d0873a --- /dev/null +++ b/ansible/playbooks/ceph_clean_disks.yml @@ -0,0 +1,58 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + vars: + disk: + - sdb + - sdc + - sdd + - sde + + tasks: + + - name: detect lv + shell: pvscan | grep ceph | sed -n "1,4p" | awk '{print $4}' + args: + executable: /bin/bash + register: ceph_lv + + - name: detect pv + shell: pvscan | grep ceph | sed -n "1,4p" | awk '{print $2}' + args: + executable: /bin/bash + register: ceph_pv + + - name: list PV + debug: + msg: "{{ item }}" + loop: "{{ceph_pv.stdout_lines}}" + when: ceph_pv.stdout != "" + + - name: delete VG + lvg: + vg: "{{ item }}" + state: absent + force: yes + loop: "{{ceph_lv.stdout_lines}}" + when: ceph_lv.stdout != "" + + - name: delete pv + shell: pvremove -y {{ item }} + args: + executable: /bin/bash + loop: "{{ceph_pv.stdout_lines}}" + when: ceph_pv.stdout != "" + + - name: wipe HDD + shell: wipefs -a /dev/{{item}} + args: + executable: /bin/bash + with_items: "{{ disk }}" + + - name: delete partition info + shell: for i in b c d; do dd if=/dev/zero of=/dev/sd$i bs=512 count=1 conv=notrunc; done + args: + executable: /bin/bash diff --git a/ansible/playbooks/ceph_clean_disks_filestore.yml b/ansible/playbooks/ceph_clean_disks_filestore.yml new file mode 100644 index 0000000..9ee0f33 --- /dev/null +++ b/ansible/playbooks/ceph_clean_disks_filestore.yml @@ -0,0 +1,72 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + vars: + disk: + - sdb + - sdc + - sdd + - sde + + tasks: + + - name: detect lv + shell: pvscan | grep ceph | sed -n "1,4p" | awk '{print $4}' + args: + executable: /bin/bash + register: ceph_lv + + - name: detect pv + shell: pvscan | grep ceph | sed -n "1,4p" | awk '{print $2}' + args: + executable: /bin/bash + register: ceph_pv + + - name: list PV + debug: + msg: "{{ item }}" + loop: "{{ceph_pv.stdout_lines}}" + when: ceph_pv.stdout != "" + + - name: list mounted ceph volume + shell: mount | grep ceph | grep -v tmpfs | awk '{print $3}' + args: + executable: /bin/bash + warn: false + register: ceph_mount + + - name: umount OSD + shell: umount {{item}} + args: + executable: /bin/bash + loop: "{{ceph_mount.stdout_lines}}" + when: ceph_lv.stdout != "" + + - name: delete VG + lvg: + vg: "{{ item }}" + state: absent + force: yes + loop: "{{ceph_lv.stdout_lines}}" + when: ceph_lv.stdout != "" + + - name: delete pv + shell: pvremove -y {{ item }} + args: + executable: /bin/bash + loop: "{{ceph_pv.stdout_lines}}" + when: ceph_pv.stdout != "" + + - name: wipe HDD + shell: wipefs -a /dev/{{item}} + args: + executable: /bin/bash + with_items: "{{ disk }}" + + - name: delete partition info + shell: for i in b c d; do dd if=/dev/zero of=/dev/sd$i bs=512 count=1 conv=notrunc; done + args: + executable: /bin/bash diff --git a/ansible/playbooks/ceph_create_db_partition.yml b/ansible/playbooks/ceph_create_db_partition.yml new file mode 100644 index 0000000..1bb8fd6 --- /dev/null +++ b/ansible/playbooks/ceph_create_db_partition.yml @@ -0,0 +1,43 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + vars: + disk: + - sdb + - sdc + - sdd + + tasks: + +# - name: list variables +# debug: +# msg: "{{ item }}" +# loop: "{{ disk }}" + + - name: wipe SSD + shell: wipefs -a /dev/sde + args: + executable: /bin/bash + + - name: SSD to gpt + shell: parted -s /dev/sde mklabel gpt + args: + executable: /bin/bash + + - name: create ssd {{disk[0]}} db partitions + shell: parted /dev/sde mkpart ceph-db-{{disk[0]}} ext2 0% 20% + args: + executable: /bin/bash + + - name: create ssd {{disk[1]}} db partitions + shell: parted /dev/sde mkpart ceph-db-{{disk[1]}} ext2 20% 40% + args: + executable: /bin/bash + + - name: create ssd {{disk[2]}} db partitions + shell: parted /dev/sde mkpart ceph-db-{{disk[2]}} ext2 40% 60% + args: + executable: /bin/bash diff --git a/ansible/playbooks/ceph_create_osd_bluestore.yml b/ansible/playbooks/ceph_create_osd_bluestore.yml new file mode 100644 index 0000000..6959660 --- /dev/null +++ b/ansible/playbooks/ceph_create_osd_bluestore.yml @@ -0,0 +1,39 @@ +--- +- hosts: bonchvisors + serial: 1 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + vars: + disk: + - sdb + - sdc + - sdd + dbpart: + - sde1 + - sde2 + - sde3 + + tasks: + +# - name: list variables +# debug: +# msg: ceph-volume lvm create --bluestore --data /dev/{{disk[index]}} --block.db /dev/{{dbpart[index]}} +# loop: "{{ disk|flatten(levels=1) }}" +# loop_control: +# index_var: index + +# - name: wipe HDD +# shell: wipefs -a /dev/{{item}} +# args: +# executable: /bin/bash +# with_items: "{{ disk }}" + + - name: create OSD on hosts + shell: ceph-volume lvm create --bluestore --data /dev/{{disk[index]}} --block.db /dev/{{dbpart[index]}} + args: + executable: /bin/bash + loop: "{{ disk|flatten(levels=1) }}" + loop_control: + index_var: index diff --git a/ansible/playbooks/ceph_create_osd_filestore.yml b/ansible/playbooks/ceph_create_osd_filestore.yml new file mode 100644 index 0000000..97edea3 --- /dev/null +++ b/ansible/playbooks/ceph_create_osd_filestore.yml @@ -0,0 +1,41 @@ +--- +- hosts: bonchvisors + serial: 1 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + vars: + disk: + - sda + - sdb + - sdc + - sdd + dbpart: + - sde5 + - sde6 + - sde7 + - sde8 + + tasks: + +# - name: list variables +# debug: +# msg: ceph-volume lvm create --bluestore --data /dev/{{disk[index]}} --block.db /dev/{{dbpart[index]}} +# loop: "{{ disk|flatten(levels=1) }}" +# loop_control: +# index_var: index + +# - name: wipe HDD +# shell: wipefs -a /dev/{{item}} +# args: +# executable: /bin/bash +# with_items: "{{ disk }}" + + - name: create OSD on hosts + shell: ceph-volume lvm create --filestore --data /dev/{{disk[index]}} --journal /dev/{{dbpart[index]}} + args: + executable: /bin/bash + loop: "{{ disk|flatten(levels=1) }}" + loop_control: + index_var: index diff --git a/ansible/playbooks/ceph_remove_all_osd.retry b/ansible/playbooks/ceph_remove_all_osd.retry new file mode 100644 index 0000000..7777492 --- /dev/null +++ b/ansible/playbooks/ceph_remove_all_osd.retry @@ -0,0 +1 @@ +bonchvisor04 diff --git a/ansible/playbooks/ceph_remove_all_osd.yml b/ansible/playbooks/ceph_remove_all_osd.yml new file mode 100644 index 0000000..31132b4 --- /dev/null +++ b/ansible/playbooks/ceph_remove_all_osd.yml @@ -0,0 +1,24 @@ +--- +- hosts: bonchvisors + serial: 11 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: detect osd number in array + shell: systemctl list-units --type=service --all | grep osd | awk '{print $1}' | awk -F "@" '{print $2}' | awk -F "." '{print $1}' + args: + executable: /bin/bash + register: osd_num + + + - name: delete osd + shell: ceph osd crush reweight osd.{{item}} 0.0; ceph osd out {{item}}; systemctl stop ceph-osd@{{item}}; ceph osd crush remove osd.{{item}}; ceph auth del osd.{{item}}; ceph osd rm {{item}} + args: + executable: /bin/bash + loop: "{{osd_num.stdout_lines}}" + when: osd_num.stdout != "" + diff --git a/ansible/playbooks/ceph_remove_volume_orphan_service.yml b/ansible/playbooks/ceph_remove_volume_orphan_service.yml new file mode 100644 index 0000000..1c40b1d --- /dev/null +++ b/ansible/playbooks/ceph_remove_volume_orphan_service.yml @@ -0,0 +1,24 @@ +--- +- hosts: bonchvisors + serial: 11 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: detect osd number in array + shell: systemctl list-units --type=service --all | grep ceph-volume | awk '{print $1}' + args: + executable: /bin/bash + register: volume_service + + + - name: delete osd + systemd: + enabled: no + name: "{{item}}" + loop: "{{volume_service.stdout_lines}}" + when: volume_service.stdout != "" + diff --git a/ansible/playbooks/ceph_restart_all_services.yml b/ansible/playbooks/ceph_restart_all_services.yml new file mode 100644 index 0000000..f24fbb4 --- /dev/null +++ b/ansible/playbooks/ceph_restart_all_services.yml @@ -0,0 +1,29 @@ +--- +- hosts: bonchvisor14 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + vars: + disk: + - sdb + - sdc + - sdd + - sde + + tasks: + + - name: Detect used service + shell: systemctl list-units --type=service --all | grep ceph | grep running | awk '{print $1}' + args: + executable: /bin/bash + warn: false + register: services + + - name: Restart all services + shell: systemctl restart {{item}} + args: + executable: /bin/bash + warn: false + loop: "{{services.stdout_lines}}" + when: services.stdout != "" diff --git a/ansible/playbooks/change-openstack-elements.yml b/ansible/playbooks/change-openstack-elements.yml new file mode 100644 index 0000000..67ac638 --- /dev/null +++ b/ansible/playbooks/change-openstack-elements.yml @@ -0,0 +1,127 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: get public ip address + shell: ip a | grep -v virbr0\:\ | grep -A2 br0\:\ | grep inet | awk '{print $2}' | awk -F "/" '{print $1}' + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: ip a | grep -v virbr0\:\ | grep -A2 br1\:\ | grep inet | awk '{print $2}' | awk -F "/" '{print $1}' + args: + executable: /bin/bash + register: private_ip + + - name: create nova.conf file + copy: + src: /etc/ansible/files/nova.conf + dest: /etc/nova/nova.conf + owner: root + group: nova + mode: 0640 + + - name: create neutron.conf file + copy: + src: /etc/ansible/files/neutron.conf + dest: /etc/neutron/neutron.conf + owner: root + group: neutron + mode: 0640 + + - name: create linuxbridge_agent.ini file + copy: + src: /etc/ansible/files/linuxbridge_agent.ini + dest: /etc/neutron/plugins/ml2/linuxbridge_agent.ini + owner: root + group: neutron + mode: 0640 + + - name: copy secret.xml file + copy: + src: /etc/ansible/files/secret.xml + dest: /etc/ceph/secret.xml + owner: root + group: root + mode: 0640 + + - name: copy ml2_conf.ini file + copy: + src: /etc/ansible/files/ml2_conf.ini + dest: /etc/neutron/plugins/ml2/ml2_conf.ini + owner: root + group: root + mode: 0644 + + - name: copy client.cinder.key file + copy: + src: /etc/ansible/files/client.cinder.key + dest: /etc/ceph/client.cinder.key + owner: root + group: root + mode: 0640 + + - name: insert public_ip in nova.conf my_ip string + lineinfile: + path: /etc/nova/nova.conf + insertbefore: 'use_neutron=true' + line: 'my_ip={{item}}' + loop: "{{public_ip.stdout_lines}}" + when: public_ip.stdout != "" + + - name: insert private_ip in linuxbridge_agent.ini local_ip string for overlay network + lineinfile: + path: /etc/neutron/plugins/ml2/linuxbridge_agent.ini + insertafter: '\[vxlan\]' + line: 'local_ip={{item}}' + loop: "{{private_ip.stdout_lines}}" + when: private_ip.stdout != "" + +# - name: virsh secret define +# shell: virsh secret-define --file /etc/ceph/secret.xml +# args: +# executable: /bin/bash +# register: required_uuid + +# - name: virsh secret set +# shell: virsh secret-set-value --secret $(echo {{ item }} | awk '{print $2}') --base64 $(cat /etc/ceph/client.cinder.key) +# args: +# executable: /bin/bash +# loop: "{{required_uuid.stdout_lines}}" +# when: required_uuid.stdout != "" + +# - name: restart libvirtd services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: libvirtd.service + +# - name: restart nova-compute services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: openstack-nova-compute.service + + - name: restart libvirtd services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: libvirtd.service + + - name: restart neutron-linux-brigde-agent services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: neutron-linuxbridge-agent.service + + diff --git a/ansible/playbooks/change_cpu_affinity.conf b/ansible/playbooks/change_cpu_affinity.conf new file mode 100644 index 0000000..187db4e --- /dev/null +++ b/ansible/playbooks/change_cpu_affinity.conf @@ -0,0 +1,92 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + + - name: check ceph-mon service exist + shell: systemctl list-units --type=service --all | grep ceph-mon | awk '{print $1}' + args: + executable: /bin/bash + register: mon_service + +# определение OSD + + - name: find OSD and check if exist + shell: systemctl list-units --type=service --all | grep ceph-osd | awk '{print $1}' + args: + executable: /bin/bash + register: osd_service + + - name: check ceph-mon service exist + shell: systemctl list-units --type=service --all | grep ceph-mon | awk '{print $1}' + args: + executable: /bin/bash + register: mon_service + +# определение OSD + + - name: find OSD and check if exist + shell: systemctl list-units --type=service --all | grep ceph-osd | awk '{print $1}' + args: + executable: /bin/bash + register: osd_service + +# определение MGR + + - name: check ceph-mgr service exist + shell: systemctl list-units --type=service --all | grep ceph-mgr | awk '{print $1}' + args: + executable: /bin/bash + register: mgr_service + + - name: Change ceph-osd cpu affinity + lineinfile: + path: /usr/lib/systemd/system/ceph-osd@.service + insertbefore: '^RestartSec=*' + line: CPUAffinity=0,1 + when: osd_service.stdout != "" + + - name: Change ceph-mon cpu affinity + lineinfile: + path: /usr/lib/systemd/system/ceph-mon@.service + insertbefore: '^RestartSec=*' + line: CPUAffinity=0,1 + when: mon_service.stdout != "" + + - name: Change ceph-mgr cpu affinity + lineinfile: + path: /usr/lib/systemd/system/ceph-mgr@.service + insertbefore: '^StartLimitBurst=*' + line: CPUAffinity=0,1 + when: mgr_service.stdout != "" + + - name: restart ceph-osd service + systemd: + state: restarted + daemon_reload: yes + name: "{{ item }}" + loop: "{{osd_service.stdout_lines}}" + when: osd_service.stdout != "" + + + - name: restart ceph-mon service + systemd: + state: restarted + daemon_reload: yes + name: "{{ item }}" + loop: "{{mon_service.stdout_lines}}" + when: mon_service.stdout != "" + + - name: restart ceph-mgr service + systemd: + state: restarted + daemon_reload: yes + name: "{{ item }}" + loop: "{{mgr_service.stdout_lines}}" + when: mgr_service.stdout != "" + diff --git a/ansible/playbooks/changehosts.yml b/ansible/playbooks/changehosts.yml new file mode 100644 index 0000000..fcb8fec --- /dev/null +++ b/ansible/playbooks/changehosts.yml @@ -0,0 +1,27 @@ +--- +- hosts: controllers + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: Add hosts entry + lineinfile: + path: /etc/hosts + line: "{{ item.hosts }}" + with_items: + - { hosts: '172.17.2.54 bonchvisor04' } + - { hosts: '172.17.2.55 bonchvisor05' } + - { hosts: '172.17.2.56 bonchvisor06' } + - { hosts: '172.17.2.57 bonchvisor07' } + - { hosts: '172.17.2.58 bonchvisor08' } + - { hosts: '172.17.2.59 bonchvisor09' } + - { hosts: '172.17.2.60 bonchvisor10' } + - { hosts: '172.17.2.61 bonchvisor11' } + - { hosts: '172.17.2.62 bonchvisor12' } + - { hosts: '172.17.3.50 controller-ceph' } + - { hosts: '172.17.3.100 controller-virt' } + - { hosts: '172.17.3.200 controller-net' } + diff --git a/ansible/playbooks/changemtu.retry b/ansible/playbooks/changemtu.retry new file mode 100644 index 0000000..f92e94a --- /dev/null +++ b/ansible/playbooks/changemtu.retry @@ -0,0 +1,11 @@ +bonchvisor04 +bonchvisor05 +bonchvisor06 +bonchvisor07 +bonchvisor08 +bonchvisor09 +bonchvisor10 +bonchvisor11 +bonchvisor12 +bonchvisor13 +bonchvisor14 diff --git a/ansible/playbooks/changemtu.yml b/ansible/playbooks/changemtu.yml new file mode 100644 index 0000000..f59e123 --- /dev/null +++ b/ansible/playbooks/changemtu.yml @@ -0,0 +1,78 @@ +--- +- hosts: bonchvisors-small + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: +# - name: change MTU in br0 interface +# lineinfile: +# path: /etc/sysconfig/network-scripts/ifcfg-br0 +# line: 'MTU=9000' +# - name: change MTU in br1 interface +# lineinfile: +# path: /etc/sysconfig/network-scripts/ifcfg-br1 +# line: 'MTU=9000' + - name: change MTU in bond interface + lineinfile: + path: /etc/sysconfig/network-scripts/ifcfg-bond0 + line: 'MTU=9000' +# - name: restart network service +# systemd: +# state: restarted +# daemon_reload: yes +# name: network + - name: Find 10Gbit network files + find: + paths: /etc/sysconfig/network-scripts/ + patterns: "ifcfg-enp*" + register: files_matched +# - debug: +# msg: "{{ files_matched.files[0].path }}" + +# - name: delete unproper ethtool options 1st device +# lineinfile: +# path: "{{ files_matched.files[0].path }}" +# line: '-K ${DEVICE} rx off tx off; -K ${DEVICE} tso off; -K ${DEVICE} gso off' +# state: absent +# +# - name: delete unproper ethtool options 2nd device +# lineinfile: +# path: "{{ files_matched.files[1].path }}" +# line: '-K ${DEVICE} rx off tx off; -K ${DEVICE} tso off; -K ${DEVICE} gso off' +# state: absent + + - name: copy vlan165 file + copy: + src: /etc/ansible/files/ifcfg-vlan165 + dest: /etc/sysconfig/network-scripts/ifcfg-vlan165 + owner: root + group: root + mode: 0644 + + - name: copy br2 file + copy: + src: /etc/ansible/files/ifcfg-br2 + dest: /etc/sysconfig/network-scripts/ifcfg-br2 + owner: root + group: root + mode: 0644 + + - name: Change ethtool options 1st device + lineinfile: + path: "{{ files_matched.files[0].path }}" + line: 'ETHTOOL_OPTS="-K ${DEVICE} rx off tx off; -K ${DEVICE} tso off; -K ${DEVICE} gso off"' + + - name: Change ethtool options 2nd device + lineinfile: + path: "{{ files_matched.files[1].path }}" + line: 'ETHTOOL_OPTS="-K ${DEVICE} rx off tx off; -K ${DEVICE} tso off; -K ${DEVICE} gso off"' + + + + - name: restart network service + systemd: + state: restarted + daemon_reload: yes + name: network diff --git a/ansible/playbooks/config-openstack-compute-nodes.yml b/ansible/playbooks/config-openstack-compute-nodes.yml new file mode 100644 index 0000000..2890a1c --- /dev/null +++ b/ansible/playbooks/config-openstack-compute-nodes.yml @@ -0,0 +1,145 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + +# - name: install openstack nova compute elements +# yum: +# name: "{{ packages }}" +# state: latest +# vars: +# packages: +# - openstack-neutron-linuxbridge +# - ebtables +# - ipset +# - openstack-nova-compute +# - openstack-neutron-ml2 +# - openstack-neutron-openvswitch + + + - name: install snmp tool + yum: + name: "net-snmp" + state: latest + + +# - name: restart openvswitch services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: openvswitch.service + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get tunnel ip address + shell: echo 172.17.1.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: tunnel_ip + +# - name: create neutron config file +# template: +# src: /etc/ansible/files/openvswitch_agent.ini +# dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini +# owner: root +# group: root +# mode: 0644 + +# add snmp firewall port + + - firewalld: + immediate: yes + port: 161/udp + permanent: true + state: enabled + + - name: create snmpd config file + template: + src: /etc/ansible/files/snmpd.conf + dest: /etc/snmp/snmpd.conf + owner: root + group: root + mode: 0644 + + - name: create nova config file + template: + src: /etc/ansible/files/nova.conf + dest: /etc/nova/nova.conf + owner: root + group: root + mode: 0644 + + - name: create neutron config file + template: + src: /etc/ansible/files/neutron.conf + dest: /etc/neutron/neutron.conf + owner: root + group: root + mode: 0644 + + - name: create ml2_conf.ini file + template: + src: /etc/ansible/files/ml2_conf.ini + dest: /etc/neutron/plugins/ml2/ml2_conf.ini + owner: root + group: root + mode: 0644 + + - name: create openvswitch_agent.ini file + template: + src: /etc/ansible/files/openvswitch_agent.ini + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + owner: root + group: root + mode: 0644 + + - name: create ceilometer config file + template: + src: /etc/ansible/files/ceilometer.conf + dest: /etc/ceilometer/ceilometer.conf + owner: root + group: root + mode: 0644 + + - name: restart openstack-ceilometer-compute + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: openstack-ceilometer-compute + + - name: restart openstack-nova-compute + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: openstack-nova-compute + + - name: restart neutron-openvswitch-agent + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: neutron-openvswitch-agent + + - name: restart snmpd + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: snmpd diff --git a/ansible/playbooks/config-openstack-dpdk-network.yml b/ansible/playbooks/config-openstack-dpdk-network.yml new file mode 100644 index 0000000..cb43a5b --- /dev/null +++ b/ansible/playbooks/config-openstack-dpdk-network.yml @@ -0,0 +1,69 @@ +--- +- hosts: bonchvisors-dpdk + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + +# - name: install openstack nova compute elements +# yum: +# name: "{{ packages }}" +# state: latest +# vars: +# packages: +# - openstack-neutron-linuxbridge +# - ebtables +# - ipset +# - openstack-nova-compute +# - openstack-neutron-ml2 +# - openstack-neutron-openvswitch + + +# - name: restart openvswitch services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: openvswitch.service + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: configure kernel + default_hugepagesz=2M hugepagesz=2M hugepages=2048 iommu=pt intel_iommu=on isolcpus=3-5"q + + - name: create openvswitch_agent.ini config file + template: + src: /etc/ansible/files/openvswitch_agent.ini + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + owner: root + group: root + mode: 0644 + + + - name: create ml2_conf.ini config file + template: + src: /etc/ansible/files/ml2_conf.ini + dest: /etc/neutron/plugins/ml2/ml2_conf.ini + owner: root + group: root + mode: 0644 + + - name: create nova.conf config file + template: + src: /etc/ansible/files/nova.conf + dest: /etc/nova/nova.conf + owner: root + group: root + mode: 0644 diff --git a/ansible/playbooks/config-openstack-interfaces.yml b/ansible/playbooks/config-openstack-interfaces.yml new file mode 100644 index 0000000..158a1cf --- /dev/null +++ b/ansible/playbooks/config-openstack-interfaces.yml @@ -0,0 +1,225 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + +# - name: install openstack nova compute elements +# yum: +# name: "{{ packages }}" +# state: latest +# vars: +# packages: +# - openstack-neutron-linuxbridge +# - ebtables +# - ipset +# - openstack-nova-compute +# - openstack-neutron-ml2 +# - openstack-neutron-openvswitch + + +# - name: restart openvswitch services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: openvswitch.service + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get first interface name + shell: "ip a | grep enp | awk 'NR==1{print $2}' | tr -d :" + args: + executable: /bin/bash + register: firstport + + - name: get second interface name + shell: "ip a | grep enp | awk 'NR==2{print $2}' | tr -d :" + args: + executable: /bin/bash + register: secondport + + - name: collect old ifcfg-files + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1' | awk '{print $1}' + args: + executable: /bin/bash + register: oldint + + - name: delete old interface files + file: + state: absent + path: /etc/sysconfig/network-scripts/{{ item }} + loop: "{{oldint.stdout_lines}}" + when: oldint.stdout != "" + + - name: cretae ifcfg-{{ firstport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif01 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ firstport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae ifcfg-{{ secondport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif02 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ secondport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae bond0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-bond0 + dest: /etc/sysconfig/network-scripts/ifcfg-bond0 + owner: root + group: root + mode: 0644 + + - name: cretae main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-br-ext-main + dest: /etc/sysconfig/network-scripts/ifcfg-br-ext-main + owner: root + group: root + mode: 0644 + + - name: cretae mgmt0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-mgmt0 + dest: /etc/sysconfig/network-scripts/ifcfg-mgmt0 + owner: root + group: root + mode: 0644 + + - name: create internal port config file + template: + src: /etc/ansible/files/networks/ifcfg-port-int + dest: /etc/sysconfig/network-scripts/ifcfg-port-int + owner: root + group: root + mode: 0644 + +# - name: creat first externalbridge patchpanel network config file +# template: +# src: /etc/ansible/files/networks/ifcfg-patch-main-ext01 +# dest: /etc/sysconfig/network-scripts/ifcfg-patch-main-ext01 +# owner: root +# group: root +# mode: 0644 + + +# - name: creat second external bridge patchpanel network config file +# template: +# src: /etc/ansible/files/networks/ifcfg-patch-main-ext02 +# dest: /etc/sysconfig/network-scripts/ifcfg-patch-main-ext02 +# owner: root +# group: root +# mode: 0644 + + - name: creat slave bridge patchpanel network config file + template: + src: /etc/ansible/files/networks/ifcfg-patch-main-slave + dest: /etc/sysconfig/network-scripts/ifcfg-patch-main-slave + owner: root + group: root + mode: 0644 + + - name: create neutron config file + template: + src: /etc/ansible/files/openvswitch_agent.ini + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + owner: root + group: root + mode: 0644 + + - name: restart all network services and delete all ovs bridge + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1\|enp\|bond0' | awk '{print $1}' | sed 's/ifcfg-//g'| while read line; do ip link set dev $line down && ip link delete $line; done; ovs-vsctl list-br | awk "{print $1}" | while read line; do ovs-vsctl --if-exist del-br $line; done; systemctl restart network; systemctl restart network + args: + executable: /bin/bash + + +#slave bridge creation + + + + +# - name: detect all bridges, except ovs-main +# shell: ovs-vsctl list-br | grep -v "ovs-main" | awk "{print $1}" +# args: +# executable: /bin/bash +# register: oldbridges + +# - name: clear all bridges, except ovs-main +# shell: ovs-vsctl --if-exist del-br {{ item }} +# args: +# executable: /bin/bash +# loop: "{{oldbridges.stdout_lines}}" +# when: oldbridges.stdout != "" + + - name: create slave bridge + shell: ovs-vsctl --may-exist add-br br-slave && ovs-vsctl set int br-slave mtu_request=9000 + args: + executable: /bin/bash + + - name: create fake management bridge + shell: ovs-vsctl --may-exist add-br br-mgmt-fake br-slave 162 && ovs-vsctl set int br-mgmt-fake mtu_request=9000 + args: + executable: /bin/bash + + - name: create fake interconnect bridge + shell: ovs-vsctl --may-exist add-br br-ic-fake br-slave 163 && ovs-vsctl set int br-ic-fake mtu_request=9000 + args: + executable: /bin/bash + + - name: create patchport -- br-slave to br-ext-main + shell: ovs-vsctl --may-exist add-port br-slave patch-slave-main && ovs-vsctl set int patch-slave-main mtu_request=9000 + args: + executable: /bin/bash + + - name: connect patchport -- br-slave to br-ext-main + shell: ovs-vsctl set interface patch-slave-main type=patch options:peer=patch-main-slave + args: + executable: /bin/bash + + - name: create external bridge + shell: ovs-vsctl --may-exist add-br br-ext && ovs-vsctl set int br-ext mtu_request=9000 + args: + executable: /bin/bash + + - name: create patchport -- br-ext to br-ext-main + shell: ovs-vsctl --may-exist add-port br-ext patch-ext-main && ovs-vsctl set int patch-ext-main mtu_request=8996 + args: + executable: /bin/bash + + - name: connect patchport -- br-ext to br-ext-main + shell: ovs-vsctl set interface patch-ext-main type=patch options:peer=patch-main-ext + args: + executable: /bin/bash + + - name: restart neutron-openvswitch + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: neutron-openvswitch-agent.service + +# postconfig +# +# - name: set physical interface MTU +# shell: ovs-vsctl set int {{ firstport.stdout }} mtu_request=9000 && ovs-vsctl set int {{ secondport.stdout }} mtu_request=9000 +# args: +# executable: /bin/bash diff --git a/ansible/playbooks/config-openstack-interfaces.yml.bak b/ansible/playbooks/config-openstack-interfaces.yml.bak new file mode 100644 index 0000000..8ea4af0 --- /dev/null +++ b/ansible/playbooks/config-openstack-interfaces.yml.bak @@ -0,0 +1,188 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + +# - name: install openstack nova compute elements +# yum: +# name: "{{ packages }}" +# state: latest +# vars: +# packages: +# - openstack-neutron-linuxbridge +# - ebtables +# - ipset +# - openstack-nova-compute +# - openstack-neutron-ml2 +# - openstack-neutron-openvswitch + + +# - name: restart openvswitch services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: openvswitch.service + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get first interface name + shell: "ip a | grep enp | awk 'NR==1{print $2}' | tr -d :" + args: + executable: /bin/bash + register: firstport + + - name: get second interface name + shell: "ip a | grep enp | awk 'NR==2{print $2}' | tr -d :" + args: + executable: /bin/bash + register: secondport + + - name: collect old ifcfg-files + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1' | awk '{print $1}' + args: + executable: /bin/bash + register: oldint + + - name: delete old interface files + file: + state: absent + path: /etc/sysconfig/network-scripts/{{ item }} + loop: "{{oldint.stdout_lines}}" + when: oldint.stdout != "" + + - name: cretae ifcfg-{{ firstport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif01 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ firstport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae ifcfg-{{ secondport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif02 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ secondport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae bond0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-bond0 + dest: /etc/sysconfig/network-scripts/ifcfg-bond0 + owner: root + group: root + mode: 0644 + + - name: cretae main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-main-bridge + dest: /etc/sysconfig/network-scripts/ifcfg-ovs-main + owner: root + group: root + mode: 0644 + + - name: cretae mgmt0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-mgmt0 + dest: /etc/sysconfig/network-scripts/ifcfg-mgmt0 + owner: root + group: root + mode: 0644 + + - name: create main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-port-int + dest: /etc/sysconfig/network-scripts/ifcfg-port-int + owner: root + group: root + mode: 0644 + + - name: create patchpanel network config file + template: + src: /etc/ansible/files/networks/ifcfg-ovs-patch0 + dest: /etc/sysconfig/network-scripts/ifcfg-ovs-patch0 + owner: root + group: root + mode: 0644 + + - name: create neutron config file + template: + src: /etc/ansible/files/openvswitch_agent.ini + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + owner: root + group: root + mode: 0644 + +#slave bridge creation + + + + - name: create ovs-slave bridge + shell: ovs-vsctl --may-exist add-br ovs-slave && ovs-vsctl set int ovs-slave mtu_request=9000 + args: + executable: /bin/bash + + - name: create management bridge + shell: ovs-vsctl --may-exist add-br br-mgmt ovs-slave 162 && ovs-vsctl set int br-mgmt mtu_request=9000 + args: + executable: /bin/bash + + - name: create internal bridge + shell: ovs-vsctl --may-exist add-br br-ic ovs-slave 163 && ovs-vsctl set int br-ic mtu_request=9000 + args: + executable: /bin/bash + + - name: create first external bridge + shell: ovs-vsctl --may-exist add-br br-ext01 ovs-slave 160 && ovs-vsctl set int br-ext01 mtu_request=9000 + args: + executable: /bin/bash + + - name: create second external bridge + shell: ovs-vsctl --may-exist add-br br-ext02 ovs-slave 165 && ovs-vsctl set int br-ext02 mtu_request=9000 + args: + executable: /bin/bash + + - name: create patchport to ovs-main + shell: ovs-vsctl --may-exist add-port ovs-slave patch1 && ovs-vsctl set int patch1 mtu_request=9000 + args: + executable: /bin/bash + + - name: connect patchport to ovs-main + shell: ovs-vsctl set interface patch1 type=patch options:peer=patch0 + args: + executable: /bin/bash + + - name: restart network services + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1\|enp' | awk '{print $1}' | sed 's/ifcfg-//g'| while read line; do ip link set dev $line down && ip link delete $line; done && systemctl restart network; systemctl restart network + args: + executable: /bin/bash + + - name: restart neutron-openvswitch + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: neutron-openvswitch-agent.service + +# postconfig + + - name: set physical interface MTU + shell: ovs-vsctl set int {{ firstport.stdout }} mtu_request=9000 && ovs-vsctl set int {{ secondport.stdout }} mtu_request=9000 + args: + executable: /bin/bash diff --git a/ansible/playbooks/config-openstack-live-migration.yml b/ansible/playbooks/config-openstack-live-migration.yml new file mode 100644 index 0000000..6c98a0c --- /dev/null +++ b/ansible/playbooks/config-openstack-live-migration.yml @@ -0,0 +1,37 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: create libvirtd.conf file + template: + src: /etc/ansible/files/libvirtd.conf + dest: /etc/libvirt/libvirtd.conf + owner: root + group: root + mode: 0644 + + - name: cretae libvirtd file for port listening + template: + src: /etc/ansible/files/libvirtd + dest: /etc/sysconfig/libvirtd + owner: root + group: root + mode: 0644 + + - name: cretae firewalld rule + shell: firewall-cmd --add-port 49152-49216/tcp --permanent; firewall-cmd --add-port 16509/tcp --permanent; firewall-cmd --reload + args: + executable: /bin/bash + + - name: restart libvirtd + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: libvirtd.service + diff --git a/ansible/playbooks/enable_nested_vm.conf b/ansible/playbooks/enable_nested_vm.conf new file mode 100644 index 0000000..7a68ed8 --- /dev/null +++ b/ansible/playbooks/enable_nested_vm.conf @@ -0,0 +1,32 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + tasks: + + - name: create nested-vm enabling file + copy: + src: /etc/ansible/files/kvm-nested.conf + dest: /etc/modprobe.d/kvm-nested.conf + owner: root + group: root + mode: 0644 + + - name: disable && enable kvm_intel module + shell: modprobe -r kvm_intel && modprobe -a kvm_intel + args: + executable: /bin/bash + + - name: check nested vm enabled + shell: cat /sys/module/kvm_intel/parameters/nested + args: + executable: /bin/bash + register: nested_vm + + - name: get nested vm enabled state + debug: + msg: "{{ nested_vm.stdout }}" diff --git a/ansible/playbooks/initial-config-ovs-dpdk-tmp-2.yml b/ansible/playbooks/initial-config-ovs-dpdk-tmp-2.yml new file mode 100644 index 0000000..ae2405a --- /dev/null +++ b/ansible/playbooks/initial-config-ovs-dpdk-tmp-2.yml @@ -0,0 +1,42 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: enable isolcpu and hugepages in kernel + shell: grep GRUB_CMDLINE_LINUX /etc/default/grub | grep -c "hugepages" || true + register: hugepages_status + ignore_errors: true + + - name: enable isolcpu in kernel + shell: grep GRUB_CMDLINE_LINUX /etc/default/grub | grep -c "isolcpus" || true + register: isolcpu_status + ignore_errors: true + + - name: Enable isolcpu in grub + lineinfile: dest="/etc/default/grub" regexp='GRUB_CMDLINE_LINUX="(.*)"' line='GRUB_CMDLINE_LINUX="\1 isolcpus=2-3"' backrefs=yes + when: isolcpu_status.stdout == "0" + + - name: Enable hugepages in grub + lineinfile: dest="/etc/default/grub" regexp='GRUB_CMDLINE_LINUX="(.*)"' line='GRUB_CMDLINE_LINUX="\1 hugepages=512"' backrefs=yes + when: hugepages_status.stdout == "0" + + - name: check if hugepages fstab entry exist + shell: grep "^hugetlbfs" /etc/fstab || true + args: + executable: /bin/bash + register: test_grep + + - name: test_grep results + debug: + msg: "{{ test_grep.stdout }}" + + - name: modify fstab + lineinfile: + path: /etc/fstab + line: "nodev /mnt/huge hugetlbfs defaults 0 0" + when: test_grep.stdout == "" diff --git a/ansible/playbooks/initial-config-ovs-dpdk-tmp.yml b/ansible/playbooks/initial-config-ovs-dpdk-tmp.yml new file mode 100644 index 0000000..d68d7c6 --- /dev/null +++ b/ansible/playbooks/initial-config-ovs-dpdk-tmp.yml @@ -0,0 +1,318 @@ +--- +- hosts: bonchvisor04 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: install repos + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - epel-release + - https://rdoproject.org/repos/rdo-release.rpm + - https://download.ceph.com/rpm-luminous/el7/noarch/ceph-release-1-1.el7.noarch.rpm + + + - name: install initial components + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - net-tools + - chrony + - openvswitch + - qemu-kvm + - virt-install + - libvirt + - libvirt-python + - virt-manager + - policycoreutils-python + - libibverbs + - driverctl + - libguestfs-tools + - python2-pip + + - name: get public ip address + shell: echo 172.17.1.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get tun ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: tun_ip + + - name: get first interface name + shell: "ip a | grep enp | awk 'NR==1{print $2}' | tr -d :" + args: + executable: /bin/bash + register: firstport + + - name: get second interface name + shell: "ip a | grep enp | awk 'NR==2{print $2}' | tr -d :" + args: + executable: /bin/bash + register: secondport + + - name: Add hosts entry + lineinfile: + path: /etc/hosts + line: "{{ item.hosts }}" + with_items: + - { hosts: '172.17.2.54 bonchvisor04' } + - { hosts: '172.17.2.55 bonchvisor05' } + - { hosts: '172.17.2.56 bonchvisor06' } + - { hosts: '172.17.2.57 bonchvisor07' } + - { hosts: '172.17.2.58 bonchvisor08' } + - { hosts: '172.17.2.59 bonchvisor09' } + - { hosts: '172.17.2.60 bonchvisor10' } + - { hosts: '172.17.2.61 bonchvisor11' } + - { hosts: '172.17.2.62 bonchvisor12' } + - { hosts: '172.17.2.50 controller-ceph' } + - { hosts: '172.17.2.100 controller-virt' } + - { hosts: '172.17.2.200 controller-net' } + + - name: copy chrony file + copy: + src: /etc/ansible/files/chrony.conf + dest: /etc/chrony.conf + owner: root + group: root + mode: 0640 + + - name: insert uio_pci_generic module + shell: modprobe uio_pci_generic + args: + executable: /bin/bash + + - name: copy uio_pci_generic module file to autostart + copy: src=/etc/ansible/files/dpdk.conf dest=/etc/modules-load.d/dpdk.conf owner=root group=root mode=0640 + + - name: detect dpdk interface name + shell: driverctl -v list-devices | grep -i net | grep 82576 | awk '{print $1}' + args: + executable: /bin/bash + register: dpdk_bus + + - name: change dpdk device#1 driver + shell: driverctl set-override {{ dpdk_bus.stdout_lines[0] }} uio_pci_generic + args: + executable: /bin/bash + + - name: change dpdk device#2 driver + shell: driverctl set-override {{ dpdk_bus.stdout_lines[1] }} uio_pci_generic + args: + executable: /bin/bash + + - name: upload selinux modules + copy: src=/etc/ansible/files/{{ item }} dest=/tmp owner=root group=root mode=0640 + with_items: + - ovs-vswitchd.pp + - ovsdb-server.pp + + - name: install selinux modules + shell: semodule -i /tmp/{{ item }} + with_items: + - ovs-vswitchd.pp + - ovsdb-server.pp + + - name: copy grub file to load hugepages + copy: src=/etc/ansible/files/grub dest=/etc/default owner=root group=root mode=0640 + + - name: modify grub to load hugepages + shell: grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg + args: + executable: /bin/bash + + - name: check if hugepages fstab entry exist + shell: grep "^hugetlbfs" /etc/fstab || true + args: + executable: /bin/bash + register: test_grep + + - name: modify fstab + lineinfile: + path: /etc/grub + line: 'nodev /mnt/huge hugetlbfs defaults 0 0' + when: test_grep.stdout != "" + + - name: Creates directory + file: + path: /mnt/huge + state: directory + + - name: copy systemd service file to use hugepages on node0 + copy: + src: /etc/ansible/files/hugetlb-gigantic-pages.service + dest: /usr/lib/systemd/system/hugetlb-gigantic-pages.service + owner: root + group: root + mode: 0640 + + - name: copy bash script file to use hugepages + copy: + src: /etc/ansible/files/hugetlb-reserve-pages.sh + dest: /usr/lib/systemd/hugetlb-reserve-pages.sh + owner: root + group: root + mode: 0750 + + - name: modify openvswitch startup users + replace: + path: /etc/sysconfig/openvswitch + regexp: '^OVS_USER_ID(.*)$' + replace: 'OVS_USER_ID="root:root"' + + - name: enable and start libvirtd services + systemd: + state: started + enabled: yes + daemon_reload: yes + name: libvirtd.service + + - name: enable and start chronyd services + systemd: + state: started + enabled: yes + daemon_reload: yes + name: chronyd.service + + + - name: enable and start service hugetlb-gigantic-pages + systemd: + state: started + name: hugetlb-gigantic-pages + enabled: yes + daemon_reload: yes + + - name: enable and start opevswitchd + systemd: + state: started + name: openvswitch + enabled: yes + + - name: ovs enable dpdk + shell: ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init="true" + args: + executable: /bin/bash + + - name: ovs dpdk config cpu mask + shell: ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0x4 + args: + executable: /bin/bash + + - name: ovs dpdk config memory usage + shell: ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem="1024,0" + args: + executable: /bin/bash + + - name: config dpdk port + shell: ovs-vsctl --may-exist add-br br-dpdk -- set bridge br-dpdk datapath_type=netdev + args: + executable: /bin/bash + + - name: add dpdk port + shell: ovs-vsctl --may-exist add-bond br-dpdk dpdkbond p0 p1 lacp=active bond_mode=balance-tcp + args: + executable: /bin/bash + + - name: add dpdk port + shell: ovs-vsctl set Interface p0 type=dpdk options:dpdk-devargs={{ dpdk_bus.stdout_lines[0] }} + args: + executable: /bin/bash + + - name: add dpdk port + shell: ovs-vsctl set Interface p1 type=dpdk options:dpdk-devargs={{ dpdk_bus.stdout_lines[1] }} + args: + executable: /bin/bash + + - name: collect old ifcfg-files + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1' | awk '{print $1}' + args: + executable: /bin/bash + register: oldint + + - name: delete old interface files + file: + state: absent + path: /etc/sysconfig/network-scripts/{{ item }} + loop: "{{oldint.stdout_lines}}" + when: oldint.stdout != "" + + - name: cretae ifcfg-{{ firstport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif01 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ firstport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae ifcfg-{{ secondport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif02 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ secondport.stdout }} + owner: root + group: root + mode: 0644 + + - name: create bond0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-bond0 + dest: /etc/sysconfig/network-scripts/ifcfg-bond0 + owner: root + group: root + mode: 0644 + + - name: cretae main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-br-ext-main + dest: /etc/sysconfig/network-scripts/ifcfg-br-ext-main + owner: root + group: root + mode: 0644 + + - name: cretae mgmt0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-mgmt0 + dest: /etc/sysconfig/network-scripts/ifcfg-mgmt0 + owner: root + group: root + mode: 0644 + + - name: create int port network config file + template: + src: /etc/ansible/files/networks/ifcfg-port-int + dest: /etc/sysconfig/network-scripts/ifcfg-port-int + owner: root + group: root + mode: 0644 + + - name: create tun port network config file + template: + src: /etc/ansible/files/networks/ifcfg-port-tun + dest: /etc/sysconfig/network-scripts/ifcfg-port-tun + owner: root + group: root + mode: 0644 + + - name: remove NetworkManager + yum: + name: NetworkManager* + state: absent + +# - name: reboot to apply grub changes +# reboot: diff --git a/ansible/playbooks/initial-config-ovs-dpdk.yml b/ansible/playbooks/initial-config-ovs-dpdk.yml new file mode 100644 index 0000000..2cb3ace --- /dev/null +++ b/ansible/playbooks/initial-config-ovs-dpdk.yml @@ -0,0 +1,333 @@ +--- +- hosts: bonchvisor10 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: install repos + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - epel-release + - https://rdoproject.org/repos/rdo-release.rpm + - https://download.ceph.com/rpm-luminous/el7/noarch/ceph-release-1-1.el7.noarch.rpm + + + - name: install initial components + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - net-tools + - chrony + - openvswitch + - qemu-kvm + - virt-install + - libvirt + - libvirt-python + - virt-manager + - policycoreutils-python + - libibverbs + - driverctl + - libguestfs-tools + - python2-pip + + - name: get public ip address + shell: echo 172.17.1.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get tun ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: tun_ip + + - name: get first interface name + shell: "ip a | grep enp | awk 'NR==1{print $2}' | tr -d :" + args: + executable: /bin/bash + register: firstport + + - name: get second interface name + shell: "ip a | grep enp | awk 'NR==2{print $2}' | tr -d :" + args: + executable: /bin/bash + register: secondport + + - name: Add hosts entry + lineinfile: + path: /etc/hosts + line: "{{ item.hosts }}" + with_items: + - { hosts: '172.17.2.54 bonchvisor04' } + - { hosts: '172.17.2.55 bonchvisor05' } + - { hosts: '172.17.2.56 bonchvisor06' } + - { hosts: '172.17.2.57 bonchvisor07' } + - { hosts: '172.17.2.58 bonchvisor08' } + - { hosts: '172.17.2.59 bonchvisor09' } + - { hosts: '172.17.2.60 bonchvisor10' } + - { hosts: '172.17.2.61 bonchvisor11' } + - { hosts: '172.17.2.62 bonchvisor12' } + - { hosts: '172.17.2.50 controller-ceph' } + - { hosts: '172.17.2.100 controller-virt' } + - { hosts: '172.17.2.200 controller-net' } + + - name: copy chrony file + copy: + src: /etc/ansible/files/chrony.conf + dest: /etc/chrony.conf + owner: root + group: root + mode: 0640 + + - name: insert uio_pci_generic module + shell: modprobe uio_pci_generic + args: + executable: /bin/bash + + - name: copy uio_pci_generic module file to autostart + copy: src=/etc/ansible/files/dpdk.conf dest=/etc/modules-load.d/dpdk.conf owner=root group=root mode=0640 + + - name: detect dpdk interface name + shell: driverctl -v list-devices | grep -i net | grep 82576 | awk '{print $1}' + args: + executable: /bin/bash + register: dpdk_bus + + - name: change dpdk device#1 driver + shell: driverctl set-override {{ dpdk_bus.stdout_lines[0] }} uio_pci_generic + args: + executable: /bin/bash + + - name: change dpdk device#2 driver + shell: driverctl set-override {{ dpdk_bus.stdout_lines[1] }} uio_pci_generic + args: + executable: /bin/bash + + - name: upload selinux modules + copy: src=/etc/ansible/files/{{ item }} dest=/tmp owner=root group=root mode=0640 + with_items: + - ovs-vswitchd.pp + - ovsdb-server.pp + + - name: install selinux modules + shell: semodule -i /tmp/{{ item }} + with_items: + - ovs-vswitchd.pp + - ovsdb-server.pp + + - name: enable isolcpu and hugepages in kernel + shell: grep GRUB_CMDLINE_LINUX /etc/default/grub | grep -c "hugepages" || true + register: hugepages_status + ignore_errors: true + + - name: enable isolcpu in kernel + shell: grep GRUB_CMDLINE_LINUX /etc/default/grub | grep -c "isolcpus" || true + register: isolcpu_status + ignore_errors: true + + - name: Enable isolcpu in grub + lineinfile: dest="/etc/default/grub" regexp='GRUB_CMDLINE_LINUX="(.*)"' line='GRUB_CMDLINE_LINUX="\1 isolcpus=2-3"' backrefs=yes + when: isolcpu_status.stdout == "0" + + - name: Enable hugepages in grub + lineinfile: dest="/etc/default/grub" regexp='GRUB_CMDLINE_LINUX="(.*)"' line='GRUB_CMDLINE_LINUX="\1 hugepages=512"' backrefs=yes + when: hugepages_status.stdout == "0" + + - name: modify grub to load hugepages + shell: grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg + args: + executable: /bin/bash + + - name: check if hugepages fstab entry exist + shell: grep "^hugetlbfs" /etc/fstab || true + args: + executable: /bin/bash + register: test_grep + + - name: modify fstab + lineinfile: + path: /etc/fstab + line: 'nodev /mnt/huge hugetlbfs defaults 0 0' + when: test_grep.stdout == "" + + - name: Creates directory + file: + path: /mnt/huge + state: directory + + - name: copy systemd service file to use hugepages on node0 + copy: + src: /etc/ansible/files/hugetlb-gigantic-pages.service + dest: /usr/lib/systemd/system/hugetlb-gigantic-pages.service + owner: root + group: root + mode: 0640 + + - name: copy bash script file to use hugepages + copy: + src: /etc/ansible/files/hugetlb-reserve-pages.sh + dest: /usr/lib/systemd/hugetlb-reserve-pages.sh + owner: root + group: root + mode: 0750 + + - name: modify openvswitch startup users + replace: + path: /etc/sysconfig/openvswitch + regexp: '^OVS_USER_ID(.*)$' + replace: 'OVS_USER_ID="root:root"' + + - name: enable and start libvirtd services + systemd: + state: started + enabled: yes + daemon_reload: yes + name: libvirtd.service + + - name: enable and start chronyd services + systemd: + state: started + enabled: yes + daemon_reload: yes + name: chronyd.service + + + - name: enable and start service hugetlb-gigantic-pages + systemd: + state: started + name: hugetlb-gigantic-pages + enabled: yes + daemon_reload: yes + + - name: enable and start opevswitchd + systemd: + state: started + name: openvswitch + enabled: yes + + - name: ovs enable dpdk + shell: ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init="true" + args: + executable: /bin/bash + + - name: ovs dpdk config cpu mask + shell: ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0x4 + args: + executable: /bin/bash + + - name: ovs dpdk config memory usage + shell: ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem="1024,0" + args: + executable: /bin/bash + + - name: config dpdk port + shell: ovs-vsctl --may-exist add-br br-dpdk -- set bridge br-dpdk datapath_type=netdev + args: + executable: /bin/bash + + - name: add dpdk port + shell: ovs-vsctl --may-exist add-bond br-dpdk dpdkbond p0 p1 lacp=active bond_mode=balance-tcp + args: + executable: /bin/bash + + - name: add dpdk port + shell: ovs-vsctl set Interface p0 type=dpdk options:dpdk-devargs={{ dpdk_bus.stdout_lines[0] }} + args: + executable: /bin/bash + + - name: add dpdk port + shell: ovs-vsctl set Interface p1 type=dpdk options:dpdk-devargs={{ dpdk_bus.stdout_lines[1] }} + args: + executable: /bin/bash + + - name: collect old ifcfg-files + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1' | awk '{print $1}' + args: + executable: /bin/bash + register: oldint + + - name: delete old interface files + file: + state: absent + path: /etc/sysconfig/network-scripts/{{ item }} + loop: "{{oldint.stdout_lines}}" + when: oldint.stdout != "" + + - name: cretae ifcfg-{{ firstport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif01 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ firstport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae ifcfg-{{ secondport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif02 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ secondport.stdout }} + owner: root + group: root + mode: 0644 + + - name: create bond0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-bond0 + dest: /etc/sysconfig/network-scripts/ifcfg-bond0 + owner: root + group: root + mode: 0644 + + - name: cretae main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-br-ext-main + dest: /etc/sysconfig/network-scripts/ifcfg-br-ext-main + owner: root + group: root + mode: 0644 + + - name: cretae mgmt0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-mgmt0 + dest: /etc/sysconfig/network-scripts/ifcfg-mgmt0 + owner: root + group: root + mode: 0644 + + - name: create int port network config file + template: + src: /etc/ansible/files/networks/ifcfg-port-int + dest: /etc/sysconfig/network-scripts/ifcfg-port-int + owner: root + group: root + mode: 0644 + + - name: create tun port network config file + template: + src: /etc/ansible/files/networks/ifcfg-port-tun + dest: /etc/sysconfig/network-scripts/ifcfg-port-tun + owner: root + group: root + mode: 0644 + + - name: remove NetworkManager + yum: + name: NetworkManager* + state: absent + + - name: reboot to apply grub changes + reboot: diff --git a/ansible/playbooks/install-openstack-conponents.yml b/ansible/playbooks/install-openstack-conponents.yml new file mode 100644 index 0000000..8587447 --- /dev/null +++ b/ansible/playbooks/install-openstack-conponents.yml @@ -0,0 +1,27 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: install openstack pike repository + yum: + name: centos-release-openstack-pike + state: latest + + - name: upgrade all packages + yum: + name: '*' + state: latest + + + - name: install openstack client and selinux lib's + yum: + name: "{{ packages }}" + vars: + packages: + - python-openstackclient + - openstack-selinux diff --git a/ansible/playbooks/install-openstack-nova-hypervisors.retry b/ansible/playbooks/install-openstack-nova-hypervisors.retry new file mode 100644 index 0000000..8d5d08e --- /dev/null +++ b/ansible/playbooks/install-openstack-nova-hypervisors.retry @@ -0,0 +1 @@ +bonchvisor08 diff --git a/ansible/playbooks/install-openstack-nova-hypervisors.yml b/ansible/playbooks/install-openstack-nova-hypervisors.yml new file mode 100644 index 0000000..66d7e60 --- /dev/null +++ b/ansible/playbooks/install-openstack-nova-hypervisors.yml @@ -0,0 +1,150 @@ +--- +- hosts: bonchvisor14 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: install openstack nova compute elements + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - openstack-neutron-linuxbridge + - ebtables + - ipset + - openstack-nova-compute + - openstack-neutron-ml2 + - openstack-neutron-openvswitch + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + + - name: copy secret.xml file + copy: + src: /etc/ansible/files/secret.xml + dest: /etc/ceph/secret.xml + owner: root + group: root + mode: 0640 + + - name: copy ceph.client.vms.keyring file + copy: + src: /etc/ansible/files/ceph.client.vms.keyring + dest: /etc/ceph/ceph.client.vms.keyring + owner: root + group: nova + mode: 0640 + + - name: copy client.cinder.key file + copy: + src: /etc/ansible/files/client.cinder.key + dest: /etc/ceph/client.cinder.key + owner: root + group: root + mode: 0640 + + - name: copy vms-secret.xml file + copy: + src: /etc/ansible/files/vms-secret.xml + dest: /etc/ceph/vms-secret.xml + owner: root + group: root + mode: 0640 + + - name: copy client.vms.key file + copy: + src: /etc/ansible/files/client.vms.key + dest: /etc/ceph/client.vms.key + owner: root + group: root + mode: 0640 + + - name: create openvswitch_agent.ini + template: + src: /etc/ansible/files/openvswitch_agent.ini + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + owner: root + group: neutron + mode: 0644 + + - name: create nova.conf + template: + src: /etc/ansible/files/nova.conf + dest: /etc/nova/nova.conf + owner: root + group: nova + mode: 0640 + + - name: create neutron.conf + template: + src: /etc/ansible/files/neutron.conf + dest: /etc/nova/neutron.conf + owner: root + group: neutron + mode: 0640 + + - name: virsh secret define + shell: virsh secret-define --file /etc/ceph/secret.xml + args: + executable: /bin/bash + register: required_uuid + + - name: virsh secret set + shell: virsh secret-set-value --secret $(echo {{required_uuid.stdout }} | awk '{print $2}') --base64 $(cat /etc/ceph/client.cinder.key) + args: + executable: /bin/bash + + - name: virsh vms secret define + shell: virsh secret-define --file /etc/ceph/vms-secret.xml + args: + executable: /bin/bash + register: required_vms_uuid + + - name: virsh vms secret set + shell: virsh secret-set-value --secret $(echo {{ required_vms_uuid.stdout }} | awk '{print $2}') --base64 $(cat /etc/ceph/client.vms.key) + args: + executable: /bin/bash + + - name: restart libvirtd services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: libvirtd.service + + - name: restart nova-compute services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: openstack-nova-compute.service + + - name: restart neutron-linux-brigde-agent services + systemd: + state: stopped + enabled: no + daemon_reload: yes + name: neutron-linuxbridge-agent.service + + - name: restart neutron-openvswitch-agent services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: neutron-openvswitch-agent.service + + diff --git a/ansible/playbooks/list_ahci.yml b/ansible/playbooks/list_ahci.yml new file mode 100644 index 0000000..c0dad46 --- /dev/null +++ b/ansible/playbooks/list_ahci.yml @@ -0,0 +1,18 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: get controller mode + shell: "lspci | grep AHCI" + args: + executable: /bin/bash + register: AHCI_present + + - name: get ahci present + debug: + msg: "{{ AHCI_present.stdout }}" diff --git a/ansible/playbooks/old-config-openstack-interfaces.yml b/ansible/playbooks/old-config-openstack-interfaces.yml new file mode 100644 index 0000000..e20f9aa --- /dev/null +++ b/ansible/playbooks/old-config-openstack-interfaces.yml @@ -0,0 +1,173 @@ +--- +- hosts: bonchvisor09 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + +# - name: install openstack nova compute elements +# yum: +# name: "{{ packages }}" +# state: latest +# vars: +# packages: +# - openstack-neutron-linuxbridge +# - ebtables +# - ipset +# - openstack-nova-compute +# - openstack-neutron-ml2 +# - openstack-neutron-openvswitch + + + - name: restart openvswitch services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: openvswitch.service + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get first interface name + shell: "ip a | grep enp | awk 'NR==1{print $2}' | tr -d :" + args: + executable: /bin/bash + register: firstport + + - name: get second interface name + shell: "ip a | grep enp | awk 'NR==2{print $2}' | tr -d :" + args: + executable: /bin/bash + register: secondport + +# - name: cretae tetmplate file with ip +# template: +# src: /etc/ansible/files/networks/testfile.j2 +# dest: /etc/file.conf +# owner: root +# group: root +# mode: 0644 + + - name: collect old ifcfg-files + shell: ls /etc/sysconfig/network-scripts/ | grep ifcfg | grep -v 'ifcfg-lo\|ifcfg-ens1f0\|ens1f1' | awk '{print $1}' + args: + executable: /bin/bash + register: oldint + + - name: delete old interface files + file: + state: absent + path: /etc/sysconfig/network-scripts/{{ item }} + loop: "{{oldint.stdout_lines}}" + when: oldint.stdout != "" + + - name: cretae ifcfg-{{ firstport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif01 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ firstport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae ifcfg-{{ secondport.stdout }} network config file + template: + src: /etc/ansible/files/networks/ifcfg-physicalif02 + dest: /etc/sysconfig/network-scripts/ifcfg-{{ secondport.stdout }} + owner: root + group: root + mode: 0644 + + - name: cretae bond0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-bond0 + dest: /etc/sysconfig/network-scripts/ifcfg-bond0 + owner: root + group: root + mode: 0644 + + - name: cretae main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-br-ext-main + dest: /etc/sysconfig/network-scripts/ifcfg-br-ext-main + owner: root + group: root + mode: 0644 + + - name: cretae mgmt0 network config file + template: + src: /etc/ansible/files/networks/ifcfg-mgmt0 + dest: /etc/sysconfig/network-scripts/ifcfg-mgmt0 + owner: root + group: root + mode: 0644 + + - name: cretae main bridge network config file + template: + src: /etc/ansible/files/networks/ifcfg-port-int + dest: /etc/sysconfig/network-scripts/ifcfg-port-int + owner: root + group: root + mode: 0644 + + - name: check ovs bond exist + shell: ovs-vsctl show | grep bond0 | awk '{print $2}' + args: + executable: /bin/bash + register: bondexist + + - name: check mgmt0 port exist + shell: ovs-vsctl show | grep Port | grep mgmt0 | awk '{print $2}' + args: + executable: /bin/bash + register: mgmtexist + + - name: check mgmt-bidge exist + shell: ovs-vsctl show | grep br-mgmt | awk '{print $2}' + args: + executable: /bin/bash + register: brmgmtexist + + - name: create bond if no exist + shell: ovs-vsctl add-bond ovs-main bond0 {{ firstport.stdout }} {{ secondport.stdout }} + args: + executable: /bin/bash + when: bondexist.stdout == "" + + - name: set bond lacp to active + shell: ovs-vsctl set port bond0 lacp=active + args: + executable: /bin/bash + when: bondexist.stdout == "" + + - name: create management bridge + shell: ovs-vsctl add-br br-mgmt ovs-main 162 + args: + executable: /bin/bash + when: brmgmtexist.stdout == "" + + - name: add management port mgmt0 + shell: ovs-vsctl add-port br-mgmt mgmt0 -- set interface mgmt0 type=internal + args: + executable: /bin/bash + when: mgmtexist.stdout == "" + + - name: restart network services + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: network.service + + diff --git a/ansible/playbooks/openstack-net-config.yml b/ansible/playbooks/openstack-net-config.yml new file mode 100644 index 0000000..84d8a08 --- /dev/null +++ b/ansible/playbooks/openstack-net-config.yml @@ -0,0 +1,122 @@ +--- +- hosts: bonchvisors + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + - name: install openstack nova compute elements + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - ebtables + - ipset + - openstack-nova-compute + - openstack-neutron-ml2 + - openstack-neutron-openvswitch + + +# - name: restart openvswitch services +# systemd: +# state: restarted +# enabled: yes +# daemon_reload: yes +# name: openvswitch.service + + - name: get public ip address + shell: echo 172.17.2.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: public_ip + + - name: get private ip address + shell: echo 172.17.3.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: private_ip + + - name: get tunnel ip address + shell: echo 172.17.1.$((50+$(echo $HOSTNAME | awk -F "bonchvisor" '{print $2}' | sed 's/^0*//'))) + args: + executable: /bin/bash + register: tunnel_ip + + +# - name: creat first externalbridge patchpanel network config file +# template: +# src: /etc/ansible/files/networks/ifcfg-patch-main-ext01 +# dest: /etc/sysconfig/network-scripts/ifcfg-patch-main-ext01 +# owner: root +# group: root +# mode: 0644 + + +# - name: creat second external bridge patchpanel network config file +# template: +# src: /etc/ansible/files/networks/ifcfg-patch-main-ext02 +# dest: /etc/sysconfig/network-scripts/ifcfg-patch-main-ext02 +# owner: root +# group: root +# mode: 0644 + + - name: create openvswitch_agent.ini config file + template: + src: /etc/ansible/files/openvswitch_agent.ini + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + owner: root + group: root + mode: 0644 + + + - name: create ml2_conf.ini config file + template: + src: /etc/ansible/files/ml2_conf.ini + dest: /etc/neutron/plugins/ml2/ml2_conf.ini + owner: root + group: root + mode: 0644 + + - name: create nova.conf config file + template: + src: /etc/ansible/files/nova.conf + dest: /etc/nova/nova.conf + owner: root + group: root + mode: 0644 + +#slave bridge creation + + + + +# - name: detect all bridges, except ovs-main +# shell: ovs-vsctl list-br | grep -v "ovs-main" | awk "{print $1}" +# args: +# executable: /bin/bash +# register: oldbridges + +# - name: clear all bridges, except ovs-main +# shell: ovs-vsctl --if-exist del-br {{ item }} +# args: +# executable: /bin/bash +# loop: "{{oldbridges.stdout_lines}}" +# when: oldbridges.stdout != "" + + - name: restart neutron-openvswitch + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: neutron-openvswitch-agent.service + + - name: restart openstack-nova + systemd: + state: restarted + enabled: yes + daemon_reload: yes + name: openstack-nova-compute.service + diff --git a/ansible/playbooks/test_scr.yml b/ansible/playbooks/test_scr.yml new file mode 100644 index 0000000..fb5192f --- /dev/null +++ b/ansible/playbooks/test_scr.yml @@ -0,0 +1,20 @@ +--- +- hosts: bonchvisor04 + remote_user: cephadmin + become: true + become_user: root + become_method: sudo + + tasks: + + + + - name: detect dpdk interface name + shell: /usr/sbin/driverctl -v list-devices | grep -i net | grep 82576 | awk '{print $1}' + args: + executable: /bin/bash + register: dpdk_bus + + - name: check dpdk_bus + debug: + msg: "{{ dpdk_bus.stdout_lines[1] }}" diff --git a/create-journal-on-ssd-gpt.sh b/create-journal-on-ssd-gpt.sh new file mode 100644 index 0000000..a6731f1 --- /dev/null +++ b/create-journal-on-ssd-gpt.sh @@ -0,0 +1,16 @@ +#/bin/bash + +devname=$1 + +size=$2 + +partsize=$(( $size * 1024 * 1024 * 2 )) + +start=$(( $(parted $devname 'unit % print' | grep -v extended | tail -2 | grep . | awk '{print $3}' | tr -d %| cut -f1 -d".") + 1 )) + + +for i in {1..4}; do + +parted $devname mkpart ext2 "$(( $start + $(( $(( $i - 1 )) * 10 )) ))"% "$(( $start + $(( $i*10 )) ))"% + +done diff --git a/create-journal-on-ssd.sh b/create-journal-on-ssd.sh new file mode 100644 index 0000000..7c244e8 --- /dev/null +++ b/create-journal-on-ssd.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +devname=$1 +extended_exist=$(parted $devname print | grep extended) +logical_exist=$(parted $devname print | grep -v Sector | grep logical) + +size=$2 + +echo "extended value is :$extended_exist-" +echo "logical value is:$logical_exist-" + +if [ -z "$extended_exist" ] +then +echo "extended no exist, creating.." + +free=$(parted $devname 'unit s print' | grep -v extended | tail -2 | grep . | awk '{print $3}' | tr -d s) +free=$(( $free+1 )) + +parted $devname mkpart extended "$free"s 100% + +echo "logical no exist, creating.." + +for i in {1..4}; do + free=$(parted $devname 'unit % print' | grep -v extended | tail -2 | grep . | awk '{print $3}' | tr -d %| cut -f1 -d".") + free=$(( $free+1 )) + end=$(awk -v a="$free" -v b="$size" 'BEGIN {print a + b}') + parted $devname mkpart logical ext2 $(echo $free)% $(echo $end)% +done +elif [ -z "$logical_exist" ] +then +echo "extended exist, but logical no exist, creating.." +for i in {1..4}; do + free=$(parted $devname 'unit % print' | grep -v extended | tail -2 | grep . | awk '{print $3}' | tr -d %| cut -f1 -d".") + free=$(( $free+1 )) + end=$(awk -v a="$free" -v b="$size" 'BEGIN {print a + b}') + parted $devname mkpart logical ext2 $(echo $free)% $(echo $end)% +done +fi diff --git a/create-part-free-size.sh b/create-part-free-size.sh new file mode 100644 index 0000000..45702ea --- /dev/null +++ b/create-part-free-size.sh @@ -0,0 +1,8 @@ +#/bin/bash + +devname=$1 + + +start=$(( $(parted $devname 'unit % print' | grep -v extended | tail -2 | grep . | awk '{print $3}' | tr -d %| cut -f1 -d".") + 1 )) + +parted $devname mkpart ext2 "$start"% 100% diff --git a/images/1. Установка и Настройка CentOS minimal/1.png b/images/1. Установка и Настройка CentOS minimal/1.png new file mode 100644 index 0000000..3b97202 Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/1.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/2.png b/images/1. Установка и Настройка CentOS minimal/2.png new file mode 100644 index 0000000..852290d Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/2.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/2_1.png b/images/1. Установка и Настройка CentOS minimal/2_1.png new file mode 100644 index 0000000..ef1d549 Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/2_1.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/3.png b/images/1. Установка и Настройка CentOS minimal/3.png new file mode 100644 index 0000000..04ac2b6 Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/3.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/4.png b/images/1. Установка и Настройка CentOS minimal/4.png new file mode 100644 index 0000000..192dfc7 Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/4.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/5.png b/images/1. Установка и Настройка CentOS minimal/5.png new file mode 100644 index 0000000..5483699 Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/5.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/6.png b/images/1. Установка и Настройка CentOS minimal/6.png new file mode 100644 index 0000000..52b1fbf Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/6.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/7.png b/images/1. Установка и Настройка CentOS minimal/7.png new file mode 100644 index 0000000..8fca6e1 Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/7.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/8.png b/images/1. Установка и Настройка CentOS minimal/8.png new file mode 100644 index 0000000..f5fbe5d Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/8.png differ diff --git a/images/1. Установка и Настройка CentOS minimal/9.png b/images/1. Установка и Настройка CentOS minimal/9.png new file mode 100644 index 0000000..26cbfbf Binary files /dev/null and b/images/1. Установка и Настройка CentOS minimal/9.png differ diff --git a/images/image6.png b/images/image6.png new file mode 100644 index 0000000..ee985fa Binary files /dev/null and b/images/image6.png differ diff --git a/images/test b/images/test new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/images/test @@ -0,0 +1 @@ + diff --git a/load.sh b/load.sh new file mode 100644 index 0000000..5222e45 --- /dev/null +++ b/load.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +case $1 in + -n) + k=$2 + ;; + start) + for i in $(seq 1 `nproc`); do sha1sum /dev/zero &2>1; done + exit 0 + ;; + stop) + pkill -f sha1sum + exit 0 + ;; + *) + echo wrong paremeters, exit... + exit 1 +esac + +case $3 in + start) + for i in $(seq 1 $k); do sha1sum /dev/zero &2>1; done + ;; + stop) + pkill -f sha1sum + ;; + *) + echo wrong paremeters, exit... + exit 1 +esac diff --git a/ovs-vswitchd.pp b/ovs-vswitchd.pp new file mode 100644 index 0000000..e71c13f Binary files /dev/null and b/ovs-vswitchd.pp differ diff --git a/ovsdb-server.pp b/ovsdb-server.pp new file mode 100644 index 0000000..4084570 Binary files /dev/null and b/ovsdb-server.pp differ diff --git a/qemu-kvm b/qemu-kvm new file mode 100644 index 0000000..5863abd --- /dev/null +++ b/qemu-kvm @@ -0,0 +1,27 @@ +#!/usr/bin/python3.6 +import os +import sys +import re + +new_args = ['/usr/libexec/qemu-kvm.origin'] +flag = 0 + +for i in range(1,len(sys.argv)+1): + if sys.argv[i-1] == "-cpu": + subargs = sys.argv[i].split(",") + if not ("kvm=off" in subargs): subargs.insert(1,"kvm=off") + + for key in subargs: + if (re.findall('hv_vendor_id=.*', key).__len__()): flag = 1 + + if not flag: subargs.insert(2,"hv_vendor_id=Some_Coffee") + + new_arg = ",".join(subargs) + new_args.append(new_arg) + continue + try: + new_args.append(sys.argv[i]) + except IndexError: + pass + +os.execv('/usr/libexec/qemu-kvm.origin', new_args)