role::cryptoportfolio::webhook_url: "%{ldapvar.self.vars.cf_slack_webhook.0}"
role::cryptoportfolio::pg_db: "cryptoportfolio"
role::cryptoportfolio::pg_user: "cryptoportfolio"
-role::cryptoportfolio::pg_user_replication: "cryptoportfolio_replication"
role::cryptoportfolio::web_host: "%{lookup('base_installation::system_hostname')}"
role::cryptoportfolio::web_port: ""
role::cryptoportfolio::web_ssl: true
class base_installation::cleanup inherits base_installation {
# This class contains temporary classes used to cleanup old stuff
# after refactoring
-
- cron { "puppet-pull-apply":
- ensure => absent;
- "puppet-apply":
- ensure => absent;
- "puppet-apply-reboot":
- ensure => absent;
- "pacman_keys":
- ensure => absent;
- "backup":
- ensure => absent;
- "py-cryptoportfolio-before":
- ensure => absent;
- "py-cryptoportfolio-after":
- ensure => absent;
- }
}
Optional[String] $env = "prod",
Optional[String] $webhook_url = undef,
String $pg_user,
- String $pg_user_replication,
String $pg_db,
Optional[String] $pg_hostname = "/run/postgresql",
Optional[String] $pg_port = "5432",
require => User["$user:"],
}
- # Cleanup of old directories
- file { "${home}/go/src/immae.eu":
- ensure => "absent",
- force => true,
- backup => false,
- }
-
file { "${home}/front":
ensure => "link",
target => $cf_front_app,
password => postgresql_password($pg_user, $pg_password),
}
- postgresql::server::pg_hba_rule { 'allow localhost TCP access to cryptoportfolio user':
+ postgresql::server::pg_hba_rule { 'allow local access to cryptoportfolio user':
type => 'local',
database => $pg_db,
user => $pg_user,
order => "05-01",
}
- # cleanup
- postgresql_psql { "DROP PUBLICATION ${pg_db}_publication":
- db => $pg_db,
- onlyif => "SELECT 1 FROM pg_catalog.pg_publication WHERE pubname = '${pg_db}_publication'",
- } ->
- postgresql_replication_slot { $pg_user_replication:
- ensure => absent
- } ->
- postgresql_psql { "DROP OWNED BY $pg_user_replication":
- db => $pg_db,
- onlyif => "SELECT 1 FROM pg_user WHERE usename='$pg_user_replication'"
- } ->
- postgresql::server::role { $pg_user_replication:
- ensure => absent,
- }
- # /cleanup
-
}