Puppet: apt-get update before Package installation

Obvious way:

1
2
3
4
package {
        'pssh': ensure => 'present',
         require  => Exec['apt-get update']
}

But if you have several package definitions with Exec in each of them — apt-get update will be executed several times.

I found a better way:

1
2
3
4
exec { "apt-update":
        command => "/usr/bin/apt-get update",
    }
Exec["apt-update"] -> Package <| |>

It'll execute apt-get update one time before Packages.

Zabbix: remove events from db

I unliked template from group of my hosts, but I didn't remove data, so I have about 50 events on dashboard about «Lack of free swap space» and I should remove them, because they're just a spam at this moment.

1
delete from events where objectid in (select triggerid from triggers where description ilike 'Lack of free swap space%');

Ubuntu: add sign of packages in own repository

This article is extension of http://ag-up.com/ubuntu-create-own-repository/

1. Generate own key
gpg --gen-key
Choose generate sign-only key
enter your Name and Email

2. gpg --armor --export foo@bar.com --output > /opt/repository/ubuntu/public.key where foo@bar.com is Email which you use for generating the key.
3. apt-get install dpkg-sig
dpkg-sig --sign builder /tmp/nginx-ng_1.8.x-1_amd64.deb — sign deb package, use password which you input in the 1st step

4. In the previous article we used command reprepro -C main includedeb precise /tmp/nginx-ng_1.8.x-1_amd64.deb for adding new package in repository,
we have to modify that command to reprepro --ask-passphrase -V -C main includedeb precise /tmp/nginx-at_1.8.x-1_amd64.deb — it'll ask you for key password

5. add to /opt/repository/ubuntu/conf/distributions new option SignWith: yes

On the client side import public key which we exported in step 2:
curl http://packages.localdomain/public.key | apt-key add —
apt-get update

Ubuntu: Create own repository

mkdir -p /opt/repository/ubuntu/
mkdir -p /opt/repository/ubuntu/{conf,dists,incoming,indices,logs,pool,project,tmp}
cd /opt/repository/ubuntu/
vim conf/distributions

1
2
3
4
5
6
7
Origin: packages.localdomain                                                                                                                                      
Label: My Own Repository                                                                                                                                          
Codename: precise                                                                                                                                            
Architectures: amd64                                                                                                                                          
Components: main
Description: Allods Team repository
Version: 12.04

Codename should contain name of OS branch.

First initializing of repository:
Read On…