This is the 13th day of my participation in the August More Text Challenge.More challenges in August
When deploying OpenStack based on the official website for the first time, you need to edit and modify the configuration file, which involves many files and different paths. In order to improve the efficiency of editing, configuration file editors are often used. Here are two configuration file editors that I used during deployment.
Tools1: crudini
1. Install
Crudini Download for Linux (deb, RPM)
- On Ubuntu, you can install Crudini directly from the command line:
$ sudo apt-get install crudini
Copy the code
- CentOS Linux does not have this command line tool, you can install it like this
Type | URL |
---|---|
Mirror | download-ib01.fedoraproject.org |
Binary Package | Crudini – 0.9-1. El7. Noarch. RPM |
Source Package | Crudini – 0.9-1. El7. SRC. RPM |
# Download latest epel-release rpm from
# http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Wget HTTP: / / https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/c/crudini-0.9-1.el7.noarch.rpm# Install epel-release rpm:
rpm -Uvh *noarch.rpm
# Install crudini rpm package:
yum install crudini
Copy the code
2. Use
Example: The blogger used Crudini in the deployment tutorial of OpenStack V. Install, use.
Using crudini,crudini takes no parameters and is prompted to use it.
- Basic operation
crudini --set [--existing] config_file section [param] [value]
--get [--format=sh|ini|lines] config_file [section] [param]
--del [--existing] config_file section [param]
--merge [--existing] config_file [section]
Copy the code
- The author sample
Add/modify a variable
crudini --set config_file section parameter value
Modify an existing variable
crudini --set --existing config_file section parameter value
Write variables from the shell to the configuration file
echo name="$name" | crudini --merge config_file section
# merge two INI files
crudini --merge config_file < another.ini
Delete a variable
crudini --del config_file section parameter
Delete a configuration paragraph
crudini --del config_file section
Print a parameter value
crudini --get config_file section parameter
Print the value of a global variable that does not belong to any configuration section
crudini --get config_file ' ' parameter
Print a configuration paragraph
crudini --get config_file section
Print a configuration paragraph in a format that the shell can handle
eval $(crudini --get --format=sh config_file section)
Output a configuration file in a format that text editing tools can handle
crudini --get --format=lines config_file
Copy the code
Introduced 3.
A utility for easily handling ini files from the command line and shell scripts.
During OpenStack deployment, there are two very similar commands: crudini and OpenStack -config. They are tools developed in Python by Padraig Brady for editing configuration files (i.e..ini files). They are the same command with two names.
Padraig Brady is a code contributor for the Linux and OpenStack projects. Based on what he found, he supposedly developed OpenStack -config in the OpenStack project and renamed it Crudini after finding it useful. On September 27, 2013, the OpenSuse mailing list showed that the OpenSuse -config command was officially changed to crudini.
Crud is an acronym for create, read, update, and delete. These are the four most common types of manipulation of data. Some software configuration files are in INI format, such as php.ini. Such configuration files tend to consist of several paragraphs. Paragraphs are identified in a format like [default]. The specific configuration entry is in the format of datadir=/var/lib/data. A file named myconfig.ini might display the following:
[default]
cmdline=/usr/bin/mycmd
datadir=/var/lib/mydata
Copy the code
If I changed datadir to /usr/lib/mydata, I would change it like this:
crudini --set myconfig.ini default datadir /usr/lib/mydata
Copy the code
Introduction, official resource location, CSDN download, installation method, usage method, examples
Tools2: it – utils
1. Install
RPM resource openstack-utils GitHub:openstack-utils
When deploying OpenStack T (OpenStack Train Offline Installation and Deployment series tutorials), the blogger uses the OpenStack -utils tool package to perform quick configuration. For details, see installation and Use.
wget http://www.rpmfind.net/linux/opensuse/tumbleweed/repo/oss/noarch/openstack-utils-2017.11+git.1480685772.571a0f8-1.1.noar ch.rpmCopy the code
The installation
rpm -ivh *.noarch.rpm
Copy the code
yum install openstack-utils -y
Copy the code
2. Use
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
openstack-config --set/etc/nova/nova.conf DEFAULT my_ip 192.168.1.81 [Note that change it to the IP address of the local management network] openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron true
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:openstack@controller
Copy the code
[root@controller ~]# openstack-config --help
A utility for manipulating ini files
Usage: crudini --set [OPTION]... config_file section [param] [value]
or: crudini --get [OPTION]... config_file [section] [param]
or: crudini --del [OPTION]... config_file section [param] [list value]
or: crudini --merge [OPTION]... config_file [section]
Options:
--existing[=WHAT] For --set, --del and --merge, fail if item is missing,
where WHAT is 'file'.'section', or 'param', or if
not specified; all specified items.
--format=FMT For --get, select the output FMT.
Formats are sh,ini,lines
--inplace Lock and write files in place.
This is not atomic but has less restrictions
than the default replacement method.
--list For --set and --del, update a list (set) of values
--list-sep=STR Delimit list values with "STR" instead of ","
--output=FILE Write output to FILE instead. The '-' means stdout
--verbose Indicate on stderr if changes were made
--help Write this help to stdout
--version Write version to stdout
Copy the code
Introduced 3.
Utilities to aid the setup and configuration of OpenStack packages. – openstack-config – Manipulate the openstack ini files – openstack-db – Setup or delete the database for a specified service – openstack-status – Give an overview of the status of installed services
Reference link [1] INI configuration file editor crudini [2]crudini-0.9-1.el7.noarch. RPM [3] Crudini command – Manipulation of INI files