Ansible預設會依序讀取以下路徑的配置檔
ANSIBLE_CONFIG
(environment variable if set)ansible.cfg
(in the current directory)~/.ansible.cfg
(in the home directory)/etc/ansible/ansible.cfg
ANSIBLE_CONFIG
(environment variable if set)ansible.cfg
(in the current directory)~/.ansible.cfg
(in the home directory)/etc/ansible/ansible.cfg
nova-manage db sync nova-manage api_db sync nova-manage db online_data_migrations nova-manage cell_v2 map_cell0 # 建立cell0環境資訊 nova-manage cell_v2 create_cell # 建立cell mapping nova-manage cell_v2 discover_hosts # discover compute node
def _map_cell0(self, database_connection=None): """Faciliate creation of a cell mapping for cell0. See map_cell0 for more. """ def cell0_default_connection(): # If no database connection is provided one is generated # based on the database connection url. # The cell0 database will use the same database scheme and # netloc as the main database, with a related path. # NOTE(sbauza): The URL has to be RFC1738 compliant in order to # be usable by sqlalchemy. connection = CONF.database.connection # sqlalchemy has a nice utility for parsing database connection # URLs so we use that here to get the db name so we don't have to # worry about parsing and splitting a URL which could have special # characters in the password, which makes parsing a nightmare. url = sqla_url.make_url(connection) url.database = url.database + '_cell0' return urlparse.unquote(str(url)) dbc = database_connection or cell0_default_connection() ctxt = context.RequestContext() # A transport url of 'none://' is provided for cell0. RPC should not # be used to access cell0 objects. Cells transport switching will # ignore any 'none' transport type. cell_mapping = objects.CellMapping( ctxt, uuid=objects.CellMapping.CELL0_UUID, name="cell0", transport_url="none:///", database_connection=dbc) cell_mapping.create() return cell_mapping
加密檔案 | ansible-vault encrypt group_vars/all | |
---|---|---|
解密檔案 | ansible-vault decrypt group_vars/all | |
查看檔案 | ansible-vault view group_vars/all | 類似less group_vars/all |
編輯檔案 | ansible-vault edit group_vars/all | 等同vim group_vars/all |
換密碼 | ansible-vault rekey group_vars/all |
neutron subnet-create --dns-nameserver DNS_RESOLVER
neutron subnet-update --dns-nameserver DNS_RESOLVER SUBNET_ID_OR_NAME
[DEFAULT] dnsmasq_dns_servers = DNS_RESOLVER
[DEFAULT] dnsmasq_local_resolv = True
[devices] enabled_vgpu_types = nvidia-352. 於nova controller設定flavor
$ openstack flavor set vgpu_1 --property "resources:VGPU=1"
sudo lsof -i {protocol}:{port} | xargs sudo kill -9 #{protocol}可省略
pip_version=$(python -c "import pip; \ | |
print(pip.__version__.strip('.')[0])") https://github.com/openstack-dev/devstack/blob/stable/pike/inc/python#L336 這個pip.__version__會經由strip('.')去掉字串頭尾的dot(.)然後印出版號,像是'9.x.y'。 這個版號字串在<10的話不會怎樣,但是在新版10的時候就會變成1,這樣會悲劇阿,導致整個安裝過程會爆炸。以下是小弟的測試過程:
>>> import pip
>>> pip.__version__
'9.0.3'
>>>
pip.__version__.strip('.')
'9.0.3'
>>>
pip.__version__.strip('.')[0]
'9'
>>> x='10.0.0'
>>> x[0]
'1'
>>>
pip.__version__.split('.')[0]
'9'
>>> x.split('.')[0]
'10'
>>>
所以應該是要用split('.')來切割,取得大版號才對啊(是否strip()跟split()會傻傻分不清楚<_._>)。正在討論是否要進行bug回報的部分,但看到社區已於新版修復,可以參考以下的連結
|
[.header檔案內容]- include_header = ./.header # 自訂header檔案的位置
- include_footer = ./.footer # 自訂footer檔案的位置
- name: Ensuring OVS bridge is properly setup command: docker exec openvswitch_db /usr/local/bin/kolla_ensure_openvswitch_configured {{ item.0 }} {{ item.1 }} register: status changed_when: status.stdout.find('changed') != -1 when: - inventory_hostname in groups["network"] or (inventory_hostname in groups["compute"] and computes_need_external_bridge | bool ) with_together: - "{{ neutron_bridge_name.split(',') }}" - "{{ neutron_external_interface.split(',') }}"
TASK [nova : Ensuring config directories exist] fatal: [10.144.192.36]: FAILED! =>{"msg": "The conditional check 'inventory_hostname in groups[item.value.group]' failed.The error was: error while evaluating conditional
(inventory_hostname in groups[item.value.group]): Unable to look up a name or
access an attribute in template string
({% if inventory_hostname in groups[item.value.group] %} True {% else %} False {% endif %}).\n
Make sure your variable name does not contain invalid characters like '-':
argument of type 'StrictUndefined' is not iterable\n
\nThe error appears to have been in '/home/ubuntu/kolla-ansible/ansible/roles/nova/tasks/config.yml':
line 13, column 3, but may\n
be elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:
\n\n\n- name: Ensuring config directories exist\n ^ here\n"} to retry, use: --limit @/home/ubuntu/kolla-ansible/ansible/site.retry
sudo dpkg --list 'linux-image*'| awk '{
if ($1=="ii") print $2}'| grep -v $(uname -r) | while read -r line;
do sudo apt-get -y purge $line;done;sudo apt-get autoremove; sudo update-grub
|