From a869ea173f9a1e45f63336ad9d640bf94e5039e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 13 Mar 2018 10:20:17 +0100 Subject: [PATCH] Refactor hiera environments --- .../{integration/data => global}/common.yaml | 12 +++++++ .../global/roles/cryptoportfolio.yaml | 4 +++ .../data => global}/types/s1-2.yaml | 0 .../data => global}/types/vps-ovhssd-1.yaml | 0 environments/hiera.yaml | 32 +++++++++++++++++++ environments/integration/hiera.yaml | 20 +----------- .../{data => }/roles/cryptoportfolio.yaml | 3 -- environments/production/data/common.yaml | 26 --------------- .../production/data/types/vps-ovhssd-1.yaml | 10 ------ environments/production/hiera.yaml | 20 +----------- .../{data => }/roles/cryptoportfolio.yaml | 3 -- 11 files changed, 50 insertions(+), 80 deletions(-) rename environments/{integration/data => global}/common.yaml (82%) create mode 100644 environments/global/roles/cryptoportfolio.yaml rename environments/{production/data => global}/types/s1-2.yaml (100%) rename environments/{integration/data => global}/types/vps-ovhssd-1.yaml (100%) create mode 100644 environments/hiera.yaml mode change 100644 => 120000 environments/integration/hiera.yaml rename environments/integration/{data => }/roles/cryptoportfolio.yaml (72%) delete mode 100644 environments/production/data/common.yaml delete mode 100644 environments/production/data/types/vps-ovhssd-1.yaml mode change 100644 => 120000 environments/production/hiera.yaml rename environments/production/{data => }/roles/cryptoportfolio.yaml (71%) diff --git a/environments/integration/data/common.yaml b/environments/global/common.yaml similarity index 82% rename from environments/integration/data/common.yaml rename to environments/global/common.yaml index 78cce6b..5b21dca 100644 --- a/environments/integration/data/common.yaml +++ b/environments/global/common.yaml @@ -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 index 0000000..3d36e71 --- /dev/null +++ b/environments/global/roles/cryptoportfolio.yaml @@ -0,0 +1,4 @@ +--- +classes: + role::cryptoportfolio: ~ +cryptoportfolio::slack_webhook: "%{ldapvar.self.vars.cf_slack_webhook.0}" diff --git a/environments/production/data/types/s1-2.yaml b/environments/global/types/s1-2.yaml similarity index 100% rename from environments/production/data/types/s1-2.yaml rename to environments/global/types/s1-2.yaml diff --git a/environments/integration/data/types/vps-ovhssd-1.yaml b/environments/global/types/vps-ovhssd-1.yaml similarity index 100% rename from environments/integration/data/types/vps-ovhssd-1.yaml rename to environments/global/types/vps-ovhssd-1.yaml diff --git a/environments/hiera.yaml b/environments/hiera.yaml new file mode 100644 index 0000000..5a9a6d6 --- /dev/null +++ b/environments/hiera.yaml @@ -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 + diff --git a/environments/integration/hiera.yaml b/environments/integration/hiera.yaml deleted file mode 100644 index a63fc92..0000000 --- a/environments/integration/hiera.yaml +++ /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" diff --git a/environments/integration/hiera.yaml b/environments/integration/hiera.yaml new file mode 120000 index 0000000..91d9bbf --- /dev/null +++ b/environments/integration/hiera.yaml @@ -0,0 +1 @@ +../hiera.yaml \ No newline at end of file diff --git a/environments/integration/data/roles/cryptoportfolio.yaml b/environments/integration/roles/cryptoportfolio.yaml similarity index 72% rename from environments/integration/data/roles/cryptoportfolio.yaml rename to environments/integration/roles/cryptoportfolio.yaml index 4630738..9825bce 100644 --- a/environments/integration/data/roles/cryptoportfolio.yaml +++ b/environments/integration/roles/cryptoportfolio.yaml @@ -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 index 1b4f38d..0000000 --- a/environments/production/data/common.yaml +++ /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 index 73f7a45..0000000 --- a/environments/production/data/types/vps-ovhssd-1.yaml +++ /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 diff --git a/environments/production/hiera.yaml b/environments/production/hiera.yaml deleted file mode 100644 index a63fc92..0000000 --- a/environments/production/hiera.yaml +++ /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" diff --git a/environments/production/hiera.yaml b/environments/production/hiera.yaml new file mode 120000 index 0000000..91d9bbf --- /dev/null +++ b/environments/production/hiera.yaml @@ -0,0 +1 @@ +../hiera.yaml \ No newline at end of file diff --git a/environments/production/data/roles/cryptoportfolio.yaml b/environments/production/roles/cryptoportfolio.yaml similarity index 71% rename from environments/production/data/roles/cryptoportfolio.yaml rename to environments/production/roles/cryptoportfolio.yaml index 014df5a..c9328e1 100644 --- a/environments/production/data/roles/cryptoportfolio.yaml +++ b/environments/production/roles/cryptoportfolio.yaml @@ -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}" -- 2.41.0