diff options
author | Julien Dessaux | 2017-07-27 15:07:05 +0200 |
---|---|---|
committer | Julien Dessaux | 2017-07-28 11:00:36 +0200 |
commit | 2e3bc1e1ce440580678bade05dec5400123dc043 (patch) | |
tree | 59c4b965eea96cf575be79edbf74ac5bbf92b7d5 | |
parent | Add suffix for containers to define more explicit cfengine hard classes (diff) | |
download | masterfiles-2e3bc1e1ce440580678bade05dec5400123dc043.tar.gz masterfiles-2e3bc1e1ce440580678bade05dec5400123dc043.tar.bz2 masterfiles-2e3bc1e1ce440580678bade05dec5400123dc043.zip |
Made a generic place for package installations and support a host specific list
-rw-r--r-- | promises.cf | 2 | ||||
-rw-r--r-- | services/common.cf | 17 | ||||
-rw-r--r-- | services/debian.cf | 21 | ||||
-rw-r--r-- | services/main.cf | 10 | ||||
-rw-r--r-- | services/specific.cf | 12 | ||||
-rw-r--r-- | services/ubuntu.cf | 21 |
6 files changed, 47 insertions, 36 deletions
diff --git a/promises.cf b/promises.cf index b082c27..6be237d 100644 --- a/promises.cf +++ b/promises.cf @@ -6,6 +6,7 @@ body common control cfengine_stdlib, core_policies, @(core_policies.bundles), + specific, classify, @(classify.bundles), }; @@ -14,6 +15,7 @@ body common control @(cfengine_stdlib.inputs), "cfengine/core_policies.cf", @(core_policies.inputs), + "services/specific.cf", "services/main.cf", @(classify.inputs), }; diff --git a/services/common.cf b/services/common.cf index 8ca7a3d..0e866a0 100644 --- a/services/common.cf +++ b/services/common.cf @@ -1,13 +1,26 @@ bundle agent common { + vars: + any:: + "packages" slist => { + @(distrib.packages), + @(specific.packages), + }; files: any:: "/etc/hosts" edit_defaults => std_defs, perms => system_owned("444"), edit_template => "$(sys.inputdir)/templates/common/hosts", - classes => if_repaired("hosts_repaired"); + classes => if_repaired("common_hosts_files_repaired"); + packages: + debian|ubuntu:: + "$(packages)" + policy => "present", + package_module => apt_get, + classes => if_repaired("common_packages_$(wanted)_add_repaired"); reports: any:: - "$(this.bundle): /etc/hosts repaired" ifvarclass => "hosts_repaired"; + "$(this.bundle): /etc/hosts repaired" ifvarclass => "common_hosts_files_repaired"; + "$(this.bundle): $(wanted) installed" ifvarclass => "common_packages_$(wanted)_add_repaired"; } diff --git a/services/debian.cf b/services/debian.cf index f05e6a0..8b250d3 100644 --- a/services/debian.cf +++ b/services/debian.cf @@ -1,8 +1,8 @@ -bundle agent debian +bundle common distrib { vars: debian:: - "wanted" slist => { + "packages" slist => { "at", "bridge-utils", "curl", @@ -19,8 +19,8 @@ bundle agent debian "vim", }; debian&!containers:: - "wanted" slist => { - @(wanted), + "packages" slist => { + @(packages), "ethtool", "iptstate", "ipvsadm", @@ -33,8 +33,8 @@ bundle agent debian "needrestart", }; debian&console_julien:: - "wanted" slist => { - @(wanted), + "packages" slist => { + @(packages), "apt-file", "asciidoc", "build-essential", @@ -48,13 +48,4 @@ bundle agent debian "weechat", "whois", }; - packages: - debian:: - "$(wanted)" - policy => "present", - package_module => apt_get, - classes => if_repaired("debian_$(wanted)_add_repaired"); - reports: - any:: - "$(this.bundle): $(wanted) installed" ifvarclass => "debian_$(wanted)_add_repaired"; } diff --git a/services/main.cf b/services/main.cf index b785de9..047e4b1 100644 --- a/services/main.cf +++ b/services/main.cf @@ -4,14 +4,16 @@ bundle common classify any:: "bundles" slist => { "common", - "debian", - "ubuntu", + "distrib", }; "inputs" slist => { "services/common.cf", - "services/debian.cf", - "services/ubuntu.cf", + "services/$(distrib).cf", }; + debian:: + "distrib" string => "debian"; + ubuntu:: + "distrib" string => "ubuntu"; classes: any:: "containers" or => { diff --git a/services/specific.cf b/services/specific.cf new file mode 100644 index 0000000..0b31a61 --- /dev/null +++ b/services/specific.cf @@ -0,0 +1,12 @@ +bundle common specific +{ + defaults: + !git_lxd:: + "packages" slist => {}; + vars: + git_lxd:: + "packages" slist => { + "git-annex", + "gitolite3", + }; +} diff --git a/services/ubuntu.cf b/services/ubuntu.cf index 4988e85..1f69f82 100644 --- a/services/ubuntu.cf +++ b/services/ubuntu.cf @@ -1,8 +1,8 @@ -bundle agent ubuntu +bundle common distrib { vars: ubuntu:: - "wanted" slist => { + "packages" slist => { "at", "bridge-utils", "curl", @@ -19,8 +19,8 @@ bundle agent ubuntu "vim", }; ubuntu&!containers:: - "wanted" slist => { - @(wanted), + "packages" slist => { + @(packages), "ethtool", "iptstate", "ipvsadm", @@ -33,8 +33,8 @@ bundle agent ubuntu "needrestart", }; ubuntu&console_julien:: - "wanted" slist => { - @(wanted), + "packages" slist => { + @(packages), "apt-file", "asciidoc", "build-essential", @@ -48,13 +48,4 @@ bundle agent ubuntu "weechat", "whois", }; - packages: - ubuntu:: - "$(wanted)" - policy => "present", - package_module => apt_get, - classes => if_repaired("ubuntu_$(wanted)_add_repaired"); - reports: - any:: - "$(this.bundle): $(wanted) installed" ifvarclass => "ubuntu_$(wanted)_add_repaired"; } |