-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenstack_cheatsheet
121 lines (79 loc) · 9.63 KB
/
openstack_cheatsheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# openstack nova neutron
openstack server list --host cmpt-1-orangeinfra.localdomain --all-projects
nova list --all >> state ; neutron net-list >> state ; neutron subnet-list >> state ; neutron port-list >> state; neutron router-list >> state ;ip netns >> state; nova secgroup-list >> state # log
curl -s -d "{\"auth\":{\"passwordCredentials\": {\"username\": \"admin\", \"password\": \"$OS_PASSWORD\"}, \"tenantName\": \"admin\"}}" -H "Content-type: application/json" $OS_AUTH_URL/tokens | jq -r '.access.token.id' # | python -mjson.tool # curl log openstack keystone
curl -s -H "X-Auth-Token: $token" https://$ip | python -m json.tool # curl log openstack keystone
openstack baremetal introspection data save 1a4e30da-b6dc-499d-ba87-0bd8a3819bc0 | jq ".inventory.disks"
ironic node-update 2d50e952-21b7-4484-b218-9db2d7107061 remove cf29fed0-10b8-4fa6-8b24-1f464a67a559
neutron port-create private-net --allowed-address-pairs type=dict list=true ip_address=10.0.0.104
neutron port-create remus-private-net --allowed-address-pairs type=dict list=true ip_address=10.1.1.104,mac_address=fa:16:3e:67:9b:d7 ip_address=10.1.1.105,mac_address=fa:16:3e:67:9b:d8
neutron port-create Internet_Production --fixed-ip ip_address=10.171.53.173 --allowed-address-pairs type=dict list=true ip_address=10.171.53.171
nova boot --availability-zone nova:c2-r17-u12 --flavor m1.tiny --image cirros-0 --nic net-id="b0999ebf-59d8-4bc6-95ac-eb3a9c13553c" test_remus # openstack nova boot availability
neutron port-create Internet_Production --fixed-ip ip_address=10.114.27.75 --tenant-id cf7ef53d5a814c4fb0c3d472ce1a26f2 --allowed-address-pairs type=dict list=true mac_address=fa:16:3e:ef:e5:5b,ip_address=10.114.27.77
wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 # wget centos
glance image-create --name "centos" --is-public true --disk-format qcow2 --container-format bare --progress --file CentOS-7-x86_64-GenericCloud.qcow2 # openstack glance create centos
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img # wget cirros
glance image-create --name "cirros" --is-public true --disk-format qcow2 --container-format bare --progress --file cirros-0.3.5-x86_64-disk.img # openstack glance create cirros
nova secgroup-create secgrp "sec grp" # nova security-group
nova secgroup-add-rule secgrp icmp -1 -1 0.0.0.0/0 # openstack nova security-group
nova secgroup-add-rule secgrp tcp 22 22 0.0.0.0/0 # openstack nova security-group
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 # openstack nova security-group
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 # openstack nova security-group
nova secgroup-add-rule default tcp 80 80 0.0.0.0/0 # openstack nova security-group
nova secgroup-add-rule default tcp 443 443 0.0.0.0/0 # openstack nova security-group
nova keypair-add --pub-key .ssh/id_rsa.pub mykey # openstack nova keypair
#openstack network create public --external --provider-network-type flat --provider-physical-network datacentre # openstack neutron create network
openstack subnet create public --network public --dhcp --allocation-pool start=10.1.1.51,end=10.1.1.250 --gateway 10.1.1.1 --subnet-range 10.1.1.0/24 # openstack neutron create subnet
openstack network create private-net --provider-network-type vxlan # openstack neutron create network
openstack subnet create private-subnet --network private-net --subnet-range 10.0.1.0/24 --dhcp #--dns-nameservers list=true 8.8.8.8 8.8.4.4 # openstack neutron create subnet
neutron net-create --router:external --provider:network_type flat --provider:physical_network datacentre public # neutron network flat
neutron net-create Internet_Production --provider:network_type vlan --provider:physical_network datacentre --provider:segmentation_id 201 # neutron network vlan
neutron subnet-create --name subnet_Internet_Production Internet_Production --disable-dhcp --gateway 10.114.27.94 10.114.27.64/27 --name public-subnet
neutron subnet-create public --dns-nameserver 8.8.8.8 --enable-dhcp --allocation-pool start=10.1.1.51,end=10.1.1.250 --gateway 10.1.1.1 10.1.1.0/24 --name public-subnet
###
neutron net-create private-net --provider:network_type vxlan
subnet="10.0.0"
neutron subnet-create private-net --dns-nameserver 8.8.8.8 --enable-dhcp --allocation-pool start=$subnet.60,end=$subnet.100 --gateway $subnet.1 $subnet.0/24 --name private-subnet
neutron net-create --router:external --provider:network_type flat --provider:physical_network datacentre public
subnet="192.168.4"
neutron subnet-create public --dns-nameserver $subnet.5 --enable-dhcp --allocation-pool start=$subnet.160,end=$subnet.200 --gateway $subnet.1 $subnet.0/24 --name public-subnet
neutron net-create Internet_Production --provider:network_type vlan --provider:physical_network datacentre --provider:segmentation_id 761 # neutron network vlan
subnet="10.104.26"
neutron subnet-create Internet_Production --enable-dhcp --allocation-pool start=$subnet.104,end=$subnet.107 --gateway $subnet.97 $subnet.96/28 --name Internet_Production_subnet
neutron router-create external-router
neutron router-interface-add external-router private-subnet
neutron router-interface-add external-router Internet_Production_subnet
neutron router-gateway-set external-router public # openstack neutron create subnet
openstack stack resource signal --data '{"deploy_stdout": "", "deploy_stderr": "", "update_managed_packages": "false", "deploy_status_code": 0}' 06ec0e7f-48bd-47ee-8f29-d3543535f373 0 # force fail signal to stack
openstack router create external-router # openstack neutron create router
openstack router add subnet external-router priv_subnet_id # openstack neutron router
openstack router set external-router --route destination=0.0.0.0/0,gateway=192.168.122.1 # openstack neutron create subnet
openstack flavor create m1.small --id 1 --ram 512 --disk 10 --vcpus 1 # openstack flavor create
nova boot --image cirros --flavor m1.small --security-groups default --key-name mykey --nic net-id= myvm # openstack nova boot
nova floating-ip-create # openstack nova floating
nova floating-ip-associate myvm 10.1.1.53 # openstack nova floating
nova interface-attach --port-id id vm_name # openstack nova interface attach
/usr/lib/python2.7/site-packages/ironic/drivers/modules/ipxe_config.template # IPXE config file /httpboot/inspector.pxe # rootpwd="$1$7j5yLe.B$Big2cXvgZIIzCR4HORtqr." selinux=0 sshkey="pubkey"
sed -i 's/^service_plugins.*/service_plugins =router,qos,lbaas/g' /etc/neutron/neutron.conf
systemctl restart neutron-server.service
sed -i 's/\x27enable_lb.*/ \x27enable_lb\x27: True,/g' /etc/openstack-dashboard/local_settings
systemctl restart httpd.service
sed -i 's/^# interface_driver =$/interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver/g' /etc/neutron/lbaas_agent.ini
sed -i 's/^# device_driver = n.*/device_driver=neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver/g' /etc/neutron/lbaas_agent.ini
sed -i 's/# user_group.*/user_group=haproxy/g' /etc/neutron/lbaas_agent.ini
systemctl restart neutron-lbaas-agent.service
neutron port-create Internet_Production --fixed-ip ip_address=10.114.27.75 --tenand-id cf7ef53d5a814c4fb0c3d472ce1a26f2 --allowed-address-pairs type=dict list=true ip_address=10.114.27.77
neutron port-update --no-security-groups <port id>
neutron port-update --port-security-enabled=False <port id>
qemu-system-x86_64 --kernel overcloud-full.vmlinuz --initrd overcloud-full.initrd -m 1024 --append root=/dev/sda --enable-kvm overcloud-full.qcow2
export LIBGUESTFS_BACKEND=direct
virt-customize -a $NAME --upload local_file:remote_file
virt-customize -a $NAME --sm-credentials 'USERNAME:password:PASSWORD' --sm-register --sm-attach auto --run-command "subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-rh-common-rpms --enable=rhel-7-server-satellite-tools-6.4-rpms --enable=rhel-7-server-optional-rpms" --update --install vim,telnet,wget,tcpdump,nmap,tmux,git,crudini,jq,iproute2,ping-netutils,ping-iputils,openssh-client,openssh-server,rsync,net-tools,bind-utils
virt-customize -a $NAME --root-password password:redhat --run-command "echo 'set completion-ignore-case on' >> /root/.inputrc; sed -i 's/^ssh_pwauth.*/ssh_pwauth: 1/' /etc/cloud/cloud.cfg; sed -i 's/^disable_root.*/disable_root: 0/' /etc/cloud/cloud.cfg; sed -i 's/#UseDNS.*/UseDNS no/' /etc/ssh/sshd_config" --ssh-inject "root:string:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+aPJS2SOiakBfa5Tq1Zc1oLgM7zl9UDLqc8z0AHSlyPbp4vf09NqHUKv20JYB91aD0SS0Joz7FsXMqnwp5aNdE18NHrH+PFTCPBgsHL9sle77tdhwwj6P6JKsEYrXf+TxhmfDNcHFnaL2zNfu3CZcxGEmRtX1zi8HDiysmXEIru+dZziYM1CUdds8zkZ6IeLV6h5ASBiYv2/rcPbhZa98tgVbGyQJ0d1iSkMY0zXev6okflNx+O3Kx1HUvyPf4vh50ebQZ45gL0ZxO9vbIOPIC/8fdaUhBVZkihtpA2Afpr7wsYOSH+dMQL4WsDzd9m4Sno6mVgHBKaMb/BdIb1bH root@zion" --ssh-inject "root:string:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHBTJDwYrPCeDBrM9bVNSlTVBibWGNdd22+H9NjAP5Bl rbuzatu" --selinux-relabel
# For KVM machines, no need for cloud init
virt-customize -a $NAME --run-command 'systemctl disable cloud-init;systemctl disable cloud-init-local;systemctl disable cloud-config;systemctl disable cloud-final'
virt-filesystems --long -h --all -a $NAME
/usr/libexec/qemu-kvm -m 1024 --enable-kvm --drive file=$NAME,format=qcow2,if=none,id=drive-virtio-disk0,cache=none,aio=native -vnc :4 -boot menu=on,strict=on -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=2
ip tuntap add dev tap0 mode tap; ifconfig tap0 up; brctl addif virbr0 tap0
/usr/libexec/qemu-kvm --kernel overcloud-full.vmlinuz --initrd overcloud-full.initrd -m 1024 --append root=/dev/sda --enable-kvm overcloud-full.qcow2 -net nic,vlan=0,model=virtio,macaddr=00:16:35:AF:94:4B -net tap,vlan=0,ifname=tap0,script=no,downscript=no
/tmp/guestfish