]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Refactor hiera environments
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 13 Mar 2018 09:20:17 +0000 (10:20 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 13 Mar 2018 10:15:08 +0000 (11:15 +0100)
environments/global/common.yaml [moved from environments/integration/data/common.yaml with 82% similarity]
environments/global/roles/cryptoportfolio.yaml [new file with mode: 0644]
environments/global/types/s1-2.yaml [moved from environments/production/data/types/s1-2.yaml with 100% similarity]
environments/global/types/vps-ovhssd-1.yaml [moved from environments/integration/data/types/vps-ovhssd-1.yaml with 100% similarity]
environments/hiera.yaml [new file with mode: 0644]
environments/integration/hiera.yaml [changed from file to symlink]
environments/integration/roles/cryptoportfolio.yaml [moved from environments/integration/data/roles/cryptoportfolio.yaml with 72% similarity]
environments/production/data/common.yaml [deleted file]
environments/production/data/types/vps-ovhssd-1.yaml [deleted file]
environments/production/hiera.yaml [changed from file to symlink]
environments/production/roles/cryptoportfolio.yaml [moved from environments/production/data/roles/cryptoportfolio.yaml with 71% similarity]

similarity index 82%
rename from environments/integration/data/common.yaml
rename to environments/global/common.yaml
index 78cce6b6caef6797c4535e7cb76a0e1c1fb08069..5b21dca75061bd0b0d3561dc50414e32178d563a 100644 (file)
@@ -1,4 +1,12 @@
 ---
+lookup_options:
+  base_installation::mounts:
+    merge: unique
+  classes:
+    merge: deep
+  base_installation::system_users:
+    merge: unique
+
 classes:
   stdlib: ~
 
@@ -7,6 +15,10 @@ base_installation::ldap_dn: "cn=%{facts.ec2_metadata.hostname},ou=hosts,dc=immae
 base_installation::ldap_cn: "%{facts.ec2_metadata.hostname}"
 base_installation::ldap_server: "ldap.immae.eu"
 base_installation::ldap_uri: "ldaps://ldap.immae.eu"
+# FIXME: get all mounts without needing that hack?
+base_installation::mounts:
+  - "%{facts.ldapvar.self.vars.mounts.0}"
+  - "%{facts.ldapvar.self.vars.mounts.1}"
 base_installation::puppet_conf_path: "/etc/puppetlabs/puppet"
 base_installation::puppet_code_path: "/etc/puppetlabs/code"
 base_installation::puppet_pass_seed: "/etc/puppetlabs/puppet/password_seed"
diff --git a/environments/global/roles/cryptoportfolio.yaml b/environments/global/roles/cryptoportfolio.yaml
new file mode 100644 (file)
index 0000000..3d36e71
--- /dev/null
@@ -0,0 +1,4 @@
+---
+classes:
+  role::cryptoportfolio: ~
+cryptoportfolio::slack_webhook: "%{ldapvar.self.vars.cf_slack_webhook.0}"
diff --git a/environments/hiera.yaml b/environments/hiera.yaml
new file mode 100644 (file)
index 0000000..5a9a6d6
--- /dev/null
@@ -0,0 +1,32 @@
+---
+version: 5
+
+defaults:
+  datadir: .
+  data_hash: yaml_data
+
+hierarchy:
+  - name: "Initialization variables"
+    path: "/root/puppet_variables.json"
+
+  - name: "Per-role environment data"
+    mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"]
+
+  - name: "Per-role global data"
+    mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"]
+    datadir: ../global
+
+  - name: "Per-type environment data"
+    path: "types/%{facts.ec2_metadata.instance-type}.yaml"
+
+  - name: "Per-type global data"
+    path: "types/%{facts.ec2_metadata.instance-type}.yaml"
+    datadir: ../global
+
+  - name: "Common environment data"
+    path: "common.yaml"
+
+  - name: "Common global data"
+    path: "common.yaml"
+    datadir: ../global
+
deleted file mode 100644 (file)
index a63fc9232bdd3c7075f8779e56bb7bc23f9b1d0c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,19 +0,0 @@
----
-version: 5
-
-defaults:
-  datadir: data
-  data_hash: yaml_data
-
-hierarchy:
-  - name: "Initialization variables"
-    path: "/root/puppet_variables.json"
-
-  - name: "Per-role data"
-    mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"]
-
-  - name: "Per-type data"
-    path: "types/%{facts.ec2_metadata.instance-type}.yaml"
-
-  - name: "Common data"
-    path: "common.yaml"
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..91d9bbf139b0b1362f4f8525936b3c0d791d2993
--- /dev/null
@@ -0,0 +1 @@
+../hiera.yaml
\ No newline at end of file
similarity index 72%
rename from environments/integration/data/roles/cryptoportfolio.yaml
rename to environments/integration/roles/cryptoportfolio.yaml
index 4630738be501fe823e27780f061b8a056d64512d..9825bce0214f536b24f83f27f2fdca7d7ba6ab9e 100644 (file)
@@ -1,8 +1,5 @@
 ---
-classes:
-  role::cryptoportfolio: ~
 cryptoportfolio::front_version: v0.0.2-3-g6200f9a
 cryptoportfolio::front_sha256: 69d31251ecd4fcea46d93dfee0184b1171019a765b6744b84f6eec6b10e5818f
 cryptoportfolio::bot_version: v0.5-8-g34eb08f
 cryptoportfolio::bot_sha256: f5b99c4a1cc4db0228f757705a5a909aa301e42787bc5842f8ba442fec0d3fd1
-cryptoportfolio::slack_webhook: "%{ldapvar.self.vars.cf_slack_webhook.0}"
diff --git a/environments/production/data/common.yaml b/environments/production/data/common.yaml
deleted file mode 100644 (file)
index 1b4f38d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
----
-classes:
-  stdlib: ~
-
-base_installation::ldap_base: "dc=immae,dc=eu"
-base_installation::ldap_dn: "cn=%{facts.ec2_metadata.hostname},ou=hosts,dc=immae,dc=eu"
-base_installation::ldap_cn: "%{facts.ec2_metadata.hostname}"
-base_installation::ldap_server: "ldap.immae.eu"
-base_installation::ldap_uri: "ldaps://ldap.immae.eu"
-base_installation::mounts: "%{alias('facts.ldapvar.self.vars.mounts')}"
-base_installation::puppet_conf_path: "/etc/puppetlabs/puppet"
-base_installation::puppet_code_path: "/etc/puppetlabs/code"
-base_installation::puppet_pass_seed: "/etc/puppetlabs/puppet/password_seed"
-base_installation::puppet_ssl_path: "/etc/puppetlabs/ssl"
-base_installation::system_locales: ["fr_FR.UTF-8", "en_US.UTF-8"]
-base_installation::system_timezone: "Europe/Paris"
-base_installation::system_users:
-  - userid: 1000
-    username: "immae"
-    groups: ["wheel"]
-    keys:
-      - host: "immae.eu"
-        key: "AAAAB3NzaC1yc2EAAAADAQABAAABAQDi5PgLBwMRyRwzJPnSgUyRAuB9AAxMijsw1pR/t/wmxQne1O5fIPOleHx+D8dyZbwm+XkzlcJpgT0Qy3qC9J8BPhshJvO/tA/8CI/oS/FE0uWsyACH1DMO2dk4gRRZGSE9IuzDMRPlnfZ3n0tdsPzzv3GH4It/oPIgsvkTowKztGLQ7Xmjr5BxzAhXcIQymqA0U3XWHSdWvnSRDaOFG0PDoVMS85IdwlviVKLnV5Sstb4NC/P28LFfgvW8DO/XrOqujgDomqTmR41dK/AyrGGOb2cQUMO4l8Oa+74aOyKaB61rr/rJkr+wCbEttkTvgFa6zZygSk3edfiWE2rgn4+v"
-        key_type: "ssh-rsa"
-xmr_stak::mining_pool: "pool.minexmr.com:7777"
-xmr_stak::wallet: "44CA8TxTFYbQqN2kLyk8AnB6Ghz4mcbGpYC2EyXW7A8H9QspvWnTjDn39XUZDPrFwPa5JNwt4TmAxcooPWv4SaJqL87Bcdo"
diff --git a/environments/production/data/types/vps-ovhssd-1.yaml b/environments/production/data/types/vps-ovhssd-1.yaml
deleted file mode 100644 (file)
index 73f7a45..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
----
-classes:
-  base_installation:
-    stage: "setup"
-
-base_installation::system_hostname: "%{ldapvar.self.vars.host.0}"
-base_installation::real_hostname: "%{facts.ec2_metadata.hostname}.ovh.net"
-base_installation::grub_device: "/dev/sdb"
-base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt"
-ssl::try_letsencrypt_for_real_hostname: false
deleted file mode 100644 (file)
index a63fc9232bdd3c7075f8779e56bb7bc23f9b1d0c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,19 +0,0 @@
----
-version: 5
-
-defaults:
-  datadir: data
-  data_hash: yaml_data
-
-hierarchy:
-  - name: "Initialization variables"
-    path: "/root/puppet_variables.json"
-
-  - name: "Per-role data"
-    mapped_paths: [ldapvar.self.vars.roles, role, "roles/%{role}.yaml"]
-
-  - name: "Per-type data"
-    path: "types/%{facts.ec2_metadata.instance-type}.yaml"
-
-  - name: "Common data"
-    path: "common.yaml"
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..91d9bbf139b0b1362f4f8525936b3c0d791d2993
--- /dev/null
@@ -0,0 +1 @@
+../hiera.yaml
\ No newline at end of file
similarity index 71%
rename from environments/production/data/roles/cryptoportfolio.yaml
rename to environments/production/roles/cryptoportfolio.yaml
index 014df5ac8c3f80de37efdb398c1c92d4c3e54334..c9328e1de282ff76702deb2e75218d7ac5e0fdb4 100644 (file)
@@ -1,8 +1,5 @@
 ---
-classes:
-  role::cryptoportfolio: ~
 cryptoportfolio::front_version: v0.0.2-3-g6200f9a
 cryptoportfolio::front_sha256: 69d31251ecd4fcea46d93dfee0184b1171019a765b6744b84f6eec6b10e5818f
 cryptoportfolio::bot_version: v0.5.1
 cryptoportfolio::bot_sha256: 733789711365b2397bd996689af616a6789207d26c71a31ad1af68620b267d54
-cryptoportfolio::slack_webhook: "%{ldapvar.self.vars.cf_slack_webhook.0}"