![]() |
VOOZH | about |
Linux,Windows,serwer, i tak dalej ;)
Written by marcinbojko
3 października, 2018 at 20:02
Napisane w work
Tagged with hyper-v, open source, opensource, packer, windows
Finally in 1.2.3 version of packer, they allowed us to change VHDX block size during its creation. For Linux machine suggested size was to set it to 1 MiB instead of default 32. How can it affect size of our image?.
Maybe like this?
It’s 59% of initial image 🙂
Written by marcinbojko
26 kwietnia, 2018 at 17:18
Napisane w work
Small project, using trappers instead of zabbix-agent active mode. I wanted to have better control over the pushing layer and intervals.
Written by marcinbojko
24 kwietnia, 2018 at 18:15
Napisane w work
Tagged with dsc, foreman, github, grafana, linux, open source, opensource, powershell, windows, work, zabbix
The most „bad ass” release so far 🙂
Written by marcinbojko
17 grudnia, 2017 at 13:46
Napisane w work
As you probably know – HashiCorp’s Packer (https://www.packer.io/) is a great tool for generating customized OS images for future use.
You can use many builders, starting from Virtualbox, Azure, Amazon EC2. You can also use mechanizm of providers to customize your image even more.
That becomes very handy when you have to manage your infrastructure fighting for every minute your machine will be available, and later on – ready to work. It’s advisable to put some effort to prepare latest images possible, with your organization custom needs.
However great tool, it still lacked a lots of decent documentation how to prepare images using less common builder – Microsoft’s Hyper-V. Hyper-V is a part of Microsoft Windows for a long time, it can be used as standalone product (Microsoft Hyper-V Server) or a additional feature (Hyper-V Feature in Windows 2016/10). When using packer with so-called „generation 1” images packer templates are no different from common examples prepared for popular Virtualbox builder.
With „Generation 2” images it required some more work to achieve this goal.
What’s the use for Gen-2 images? Few features than can be useful:
If you want to know more about „Genration 2” – read this post: https://www.altaro.com/hyper-v/comparing-hyper-v-generation-1-2-virtual-machines/
It took me a while to prepare them Hyper-V ready, also with SystemCenter Virtual Machine Support. They were (and are) tested with both (2012 and 2016) editions and just became quite important part of my deploys.
Long story short – here is my github repository with Hyper-V Windows 2016 and CentOS 7.4 Generation 2 templates.
https://github.com/marcinbojko/hv-packer
Leave me a sign if these were useful to you 🙂
As we may know – Microsoft introduced new way of doing snapshots/checkpoints in Hyper-V 2016. However term „production” is misleading, implying Standard checkpoints are not production ready – which is simply not true.
The biggest difference is that Production checkpoints are mostly used with VSS-aware applications (like MS SQL/Exchange, MS Windows itself) allowing them to flush/sync/commit changes to filesystem.
As a major difference – production checkpoints don’t save memory or cpu state, starting always with machine powered off after restore.
You can choose which way you want to do your snapshots here:
Windows-based virtual machines have supported this since previous versions of integration services (2012 R2, 8/8.1) and from the start in case of Windows 2016/10. What about Linux-based, Centos 6/7 machines?
When installed out of the box, without any additional packages, trying to do a production snapshot of Centos 7 (with all updates) we got something like this:
Quick how-to.
yum remove microsoft-hyper-v kmod-microsoft-hyper-v
or
yum remove $(yum list installed|grep microsoft)
yum info hyperv-daemons
Available Packages
Name : hyperv-daemons
Arch : x86_64
Version : 0
Release : 0.29.20160216git.el7
Size : 4.5 k
Repo : base/7/x86_64
Summary : HyperV daemons suite
URL : http://www.kernel.org
Licence : GPLv2
Description : Suite of daemons that are needed when Linux guest : is running on Windows Host with HyperV
yum install hyperv-daemons -y
systemctl enable hypervfcopyd systemctl enable hypervkvpd systemctl enable hypervvssd systemctl start hypervkvpd systemctl start hypervvssd systemctl start hypervfcopyd
[root@centos7 ~]# systemctl status hypervkvpd ● hypervkvpd.service - Hyper-V KVP daemon Loaded: loaded (/usr/lib/systemd/system/hypervkvpd.service; static; vendor preset: enabled) Active: active (running) since Wed 2017-07-26 02:37:30 CDT; 14s ago Main PID: 3478 (hypervkvpd) CGroup: /system.slice/hypervkvpd.service └─3478 /usr/sbin/hypervkvpd -n Jul 26 02:37:30 centos7 systemd[1]: Started Hyper-V KVP daemon. Jul 26 02:37:30 centos7 systemd[1]: Starting Hyper-V KVP daemon... Jul 26 02:37:30 centos7 KVP[3478]: KVP starting; pid is:3478 Jul 26 02:37:30 centos7 KVP[3478]: KVP LIC Version: 3.1 [root@centos7 ~]# systemctl status hypervvssd ● hypervvssd.service - Hyper-V VSS daemon Loaded: loaded (/usr/lib/systemd/system/hypervvssd.service; static; vendor preset: enabled) Active: active (running) since Wed 2017-07-26 02:37:30 CDT; 27s ago Main PID: 3485 (hypervvssd) CGroup: /system.slice/hypervvssd.service └─3485 /usr/sbin/hypervvssd -n Jul 26 02:37:30 centos7 systemd[1]: Started Hyper-V VSS daemon. Jul 26 02:37:30 centos7 systemd[1]: Starting Hyper-V VSS daemon... Jul 26 02:37:30 centos7 hypervvssd[3485]: Hyper-V VSS: VSS starting; pid is:3485 Jul 26 02:37:30 centos7 hypervvssd[3485]: Hyper-V VSS: VSS: kernel module version: 129 [root@centos7 ~]# systemctl status hypervfcopyd ● hypervfcopyd.service - Hyper-V FCOPY daemon Loaded: loaded (/usr/lib/systemd/system/hypervfcopyd.service; static; vendor preset: disabled) Active: active (running) since Wed 2017-07-26 02:37:30 CDT; 44s ago Main PID: 3492 (hypervfcopyd) CGroup: /system.slice/hypervfcopyd.service └─3492 /usr/sbin/hypervfcopyd -n Jul 26 02:37:30 centos7 systemd[1]: Started Hyper-V FCOPY daemon. Jul 26 02:37:30 centos7 systemd[1]: Starting Hyper-V FCOPY daemon... Jul 26 02:37:30 centos7 HV_FCOPY[3492]: starting; pid is:3492 Jul 26 02:37:30 centos7 HV_FCOPY[3492]: kernel module version: 1
As a result:
👁 Selection_999(413)
and in /var/log/messages
Jul 26 02:43:27 centos7 journal: Hyper-V VSS: VSS: op=FREEZE: succeeded Jul 26 02:39:25 centos7 systemd: Time has been changed Jul 26 02:39:25 centos7 journal: Hyper-V VSS: VSS: op=THAW: succeeded
There was a lot of nice summary articles about latest „ransomware” attack caused by Petya. Soon, researchers started to claim almost permanent vaccine for this type of worm.
Even patched OS won’t save you from infection as one infected machine quickly spreads the infection using other protocols like WinRM.
So, how should one on its vast server farm vaccinate hundrets of machines?
For example, like this 🙂
win_manage: dsc_file: petya_vaccine1: dsc_destinationpath: C:\Windows\perfc dsc_type: file dsc_attributes: readonly dsc_contents: "" petya_vaccine2: dsc_destinationpath: C:\Windows\perfc.dat dsc_type: file dsc_attributes: readonly dsc_contents: "" petya_vaccine3: dsc_destinationpath: C:\Windows\perfc.dll dsc_type: file dsc_attributes: readonly dsc_contents: ""
Written by marcinbojko
1 lipca, 2017 at 11:14
Napisane w work
Tagged with chocolatey, foreman, opensource, puppet, ransomware, virus, windows
Prezentacja: https://goo.gl/1HJZjI
Github repo: https://github.com/marcinbojko/ldi2017
Written by marcinbojko
22 kwietnia, 2017 at 12:40
Napisane w work
System Center Virtual Machine Manager was Microsoft’s answer to VMWare’s vSphere. It’s Microsoft, so what could have gone wrong? It’s Microsoft – so everything.
Below is a list of most annoying things, some of them are so serious it makes you wonder – maybe Powershell is the answer? Seriously? In 2017, Microsoft, you FORCE everybody to use text console again?
In a moment of doubt we used to call it overgrown cancer over Powershell commands.
Let’s start, sorted by weight of crime:
Deal breakers:
1) Terrible things you cannot do in SCVMM but you can in Hyper-V Manager, Failover Cluster or Powershell like:
and so on.
2) Console. Console is so terrible, that its sorry state is just good meme source.
First – console from Hyper-V Manager/FailoverCluster
Then from SCVMM
3) Requirements
4) GUI
Refresh is required almost on everything. In options like: you DID change something via Powershell and HV-Manager – I can understand, refresh may be required. But you will have to hit REFRESH before, in time, and after ANY action you would like to perform. If not – expect the worst. Virtual machine seems to be non responding on your commands? Maybe its locked for backup, maybe it hanged, maybe it migrated to another host – you have to refresh, refresh and refresh to persuade SCVMM that you have most recent data.
Sometimes even refresh doesn’t work. Like in recovery or cluster node failure, you shouldn’t count on SCVMM to update its status before timer reaches day or two. Take your time! Sometime you will have to reboot SCVMM to persuade it to have the latest data. So, when your action fails – search no more, VM is probably locked, on other host or powered off. SCVMM takes its auto-refresh very slowly.
5) Agent
– empty files in d:\vm\machinename
– machine in e:\vm\machinename
Let’s say we would like to migrate it back for some reason
We will get:
And migration is just done twice. Do you see the pattern? After few migrations we have complete chaos on filesystems with a lots of empty, semi-empty, almost empty and ‚soon-to-be-empty folders’. You’ll end up with removing them manually – again, if you’re lucky.
Above list, not fully completed can be seen in SCVMM 2012 R2 and SCVMM 2016 versions. It’s clear that SCVMM is not very high on Microsoft ‚to do’ list as same errors and mistakes are transferred to newer version and hunts us until this day.
UPDATE (1)
Changed from Requirements (Enterprise) to (Standard , Enterprise)
So, the question is – how to deploy and maintain farm of Microsoft SQL Servers? With different domains, install sources, roles, features. Should we create unattended installers for every single instance?
No, we shouldn’t.
We should use Powershell DSC – https://github.com/PowerShell/xSQLServer
With Foreman/Puppet and win_manage, we have something like:
The simplest way:
instance1: dsc_instancename: MSSQLSERVER dsc_sourcepath: "\\our.server.com\ourshare" dsc_sourcecredential: user: anonymous password: anonymous dsc_setupcredential: user: DOMAIN\someuser password: somepassword
Or, more sophisticated:
instance1: dsc_instancename: MSSQLSERVER dsc_sourcepath: "\\our.server.com\ourshare" dsc_sourcecredential: user: anonymous password: anonymous dsc_setupcredential: user: DOMAIN\someuser password: somepassword dsc_features: SQLENGINE dsc_forcereboot: true dsc_agtsvcaccount: user: DOMAIN\scvaccount password: somepassword dsc_sqlsvcaccount: user: DOMAIN\sqlaccount password: somepassword dsc_sqlcollation: SQL_Latin1_General_CP1_CI_AS dsc_sqlsysadminaccounts: - DOMAIN\someadmin - DOMAIN\someotheradmin dsc_securitymode: SQL dsc_sapwd: user: sa password: paaaswordisverysecure dsc_sqluserdbdir: D:\MSSQL\Data dsc_sqluserdblogdir: E:\MSSQL\Data dsc_browsersvcstartuptype: Disabled
Whole install from local source takes aprox. 400 seconds (with other OS related settings) to finish.
Written by marcinbojko
22 stycznia, 2017 at 21:11
Napisane w work
Tagged with desiredstate, dsc, foreman, opensource, powershell, puppet, windows, win_manage, work
Yes, we all „love” the way Microsoft gives us new stuff (like forced updates in Windows 10). As we usually know better what and when should be applied, let’s say it is time to upgrade our guest integration services to the latest version.
I usually express strong conviction that HV integration services should be kept up to date, the thing most sysadmins disregards. Those tools are responsible for keeping your VMs in shape, maintain communication between them and host services, so they SHOULD be always updates. Of course, as with almost everything TEST it before applying on any important environment.
As on 2016-12-31, the latest HV Integration Services version is 6.3.9600.18398
Let’s say – we would like to upgrade all our Windows machines (those BEFORE Windows 10 and Windows 2016) . We can do it manually (not cool, not cool at all), semi-automatic (no reboot) or almost … magical way – fully automatic 😉
Let’s start we have proper source added to Chocolatey:
choco source add -n=public -s"https://www.myget.org/F/public-choco" --priority=10
choco install hvintegrationservices -y
win_manage: chocolatey_packages: hvintegrationservices: ensure: 6.3.9600.18398 dsc_reboot: dsc_reboot: message: Machine requested a reboot when: pending
Written by marcinbojko
31 grudnia, 2016 at 15:14
Napisane w work
Tagged with chocolatey, foreman, hyper-v, hypervisor, virtualisation, windows, win_manage, wirtualizacja
On my lectures and meetings with both: IT and Management I’ve had a pleasure to be a myth buster about Hyper-V. As much as I don’t appreciate Microsoft’s ‚way of life’ – Hyper-V is mostly feared due to: lack of proper knowledge and very low quality support from Microsoft. Few most common myths are:
Written by marcinbojko
28 grudnia, 2016 at 17:12
Napisane w work
Tagged with hyper-v, hypervisor, linux, microsoft, virtualisation, windows
Administrator: dsc_username: Administrator dsc_disabled: false dsc_password: user: NT AUTHORITY\\SYSTEM password: P@$$w0rd
Written by marcinbojko
26 listopada, 2016 at 13:52
Napisane w work
Tagged with chocolatey, dsc, foreman, powershell, puppet, windows, win_manage
Looks we’ready to go 🙂
## version 0.3.7 2016-11-13
to
„`yaml
dsc_profile:
-„Domain”
-„Private”
„`
from
„`yaml
dsc_profile: Domain,Private
„`
Written by marcinbojko
13 listopada, 2016 at 17:56
Napisane w Uncategorized
Written by marcinbojko
29 października, 2016 at 17:25
Napisane w Uncategorized, work
Tagged with foreman, puppet, windows, win_manage, work
Written by marcinbojko
16 października, 2016 at 19:48
Napisane w Uncategorized
# stop services systemctl stop zabbix-server systemctl stop zabbix-agent # clean cache yum clean all # upgrade releases from 2.x/3.0 to 3.2 yum upgrade http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm # disable additional repository yum-config-manager --disable zabbix-non-supported # update yum update -y # clean cache yum clean all # enable services systemctl enable zabbix-server systemctl enable zabbix-agent
# for agents systemctl stop zabbix-agent yum clean all yum upgrade http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm yum-config-manager --disable zabbix-non-supported yum install zabbix-agent -y yum clean all systemctl enable zabbix-agent systemctl start zabbix-agent
Written by marcinbojko
15 października, 2016 at 14:21
Napisane w Uncategorized, work
Tagged with internet, monitoring, open source, opensource, windows, zabbix
| Pon | W | Śr | Czw | Pt | S | N |
|---|---|---|---|---|---|---|
| 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 |