openstack

OpenStack: project

Create project

USER_ID=xxxxxxxxxx
PROJECT_ID=xxxxxxxxx
 
openstack project create foo-project --domain bar
 
ROLES="
creator
heat_stack_owner
load-balancer_member
member
_member_
"
 
for ROLE in ${ROLES}; do
    openstack role add --user ${USER_ID} --project ${PROJECT_ID} ${ROLE}
done
 
openstack role assignment list --names --user ${USER_ID}

OpenStack: Horizon

List templates

docker exec -it horizon bash
ls -l /var/lib/kolla/venv/lib/python2.7/site-packages/openstack_dashboard/themes

Configure theme
/etc/kolla/horizon/custom_local_settings

AVAILABLE_THEMES = [
    ('default', 'Default', 'themes/default'),
    ('foo_bar', 'Foo bar', 'themes/foo_bar')
]
 
SELECTABLE_THEMES = [
    ('foo_bar', 'Foo bar', 'themes/foo_bar')
]
 
DEFAULT_THEME = 'foo_bar'

Floating IPs

# list all floating IPs
openstack floating ip list
openstack floating ip show 1.2.3.4
openstack floating ip list --project ${PROJECT_ID} --long
 
# Allocate floating IP
openstack floating ip create public 
 
# Allocate specific floating IP for a project (as cloud admin)
openstack floating ip create public --floating-ip-address 10.11.12.13 --project foo-project
FLOATING_IP=$(openstack floating ip create public -c floating_ip_address -f value --floating-ip-address 10.11.12.13)
 
# Associate floating IP to instance
openstack server add floating ip ${INSTANCE_NAME_OR_ID} ${FLOATING_IP}
 
# Disassociate floating IP
openstack server remove floating ip ${INSTANCE_NAME_OR_ID} ${FLOATING_IP}
 
# Release floating IP
openstack floating ip delete ${FLOATING_IP}
 
# show used floating IPs
NETWORK_ID=$(openstack subnet list --network public -c Network -f value)
openstack ip availability show -c total_ips -c used_ips ${NETWORK_ID}
 
# Add floating IP to port
openstack floating ip set --port ${PORT_ID} ${FLOATING_IP}

List reserved floating IPs per project

OpenStack: Floating IP port forward (in development / experimental)

List floatin IPs

openstack floating ip list
+--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+
| ID                                   | Floating IP Address | Fixed IP Address | Port                                 | Floating Network                     | Project                          |
+--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+
| dc049c28-6562-4c37-834b-d3a612d4b580 | 1.2.3.4        | None             | None                                 | 39583230-154f-4b56-a56e-2fd83c9986ce | 1eede1bdc28344f3acf6b48b232e406f |
+--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+

List VMs

Octavia: Allow SSH login to Amphora VM

Allow SSH access

LB_ID=foo-lb01-prod
 
AMPHORA_ID=$(openstack loadbalancer amphora list --loadbalancer ${LB_ID} --role MASTER -c id -f value)
AMPHORA_COMPUTE_ID=$(openstack loadbalancer amphora show ${AMPHORA_ID} -c compute_id -f value)
LB_NETWORK_IP=$(openstack loadbalancer amphora show ${AMPHORA_ID} -c lb_network_ip -f value)
SECURITY_GROUP_ID=$(openstack port list --server ${AMPHORA_COMPUTE_ID} --fixed-ip "ip-address=${LB_NETWORK_IP}" -c security_group_ids -f value)
 
# DEBUG: show ingress tcp rules
openstack security group rule list --ingress --protocol tcp ${SECURITY_GROUP_ID}
openstack security group rule create --protocol tcp --dst-port 22:22 --remote-ip 172.16.0.0/12  ${SECURITY_GROUP_ID}
openstack loadbalancer amphora list --loadbalancer ${LB_ID} -c  lb_network_ip -c role -f value
openstack loadbalancer amphora list --loadbalancer ${LB_ID} -c  lb_network_ip --role MASTER -f value
 
# login to amphora VM from OpenStack control node
ssh local@ctl1-dev.dev.i.example.com
ssh -i ~/.ssh/id_rsa_octavia ubuntu@${AMPHORA_VM_IP}

Manuall SSH access