summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: a639311d9505a2d33dc39f056d9b640657d4295c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
define blog (
	String $root,
) {
	vcsrepo { $root:
		ensure => latest,
		provider => git,
		source => 'https://github.com/HugoNikanor/website-blog-2.git',
		revision => 'master',
		# keep_local_changes => true,
		owner => 'hugo',
		group => 'www-data',
	}

	vcsrepo { "${root}/entries":
		ensure => latest,
		provider => git,
		source => '/home/git/git/blog-entries.git',
		revision => 'master',
		owner => 'hugo',
		group => 'www-data',
	}

	file { "${root}/settings.php":
		ensure => file,
		content => @(EOF)
			<?php
			# FILE MANAGED BY PUPPET
			$author = "Hugo Hornquist";
			$blog_title = "HugoNikanors blogg‽";
			$blog_subtitle = "A blog about nothing, but mostly itself.";
			$http_host = $_SERVER["HTTP_HOST"];
			$urlbase = "http://$http_host/hugo";
			$has_comments = false;
			| EOF
	}

	file { "${root}/footnote":
		ensure => directory,
		recurse => true,
	}

	$foot_files = [
		['about.md',   'About'],
		['contact.md', 'Contact'],
		['legal.md',   'Legal'],
		['qna.md',     '"Q&amp;A"'],
	]

	$foot_files.each |$item| {
		file { "${root}/footnote/${item[0]}":
			source => "puppet:///modules/blog/footers/${item[0]}",
		}
	}


	$files_ini = join($foot_files.map |$item| {
		@("EOF")
		files[] = ${item[0]}
		title[] = ${item[1]}
		| EOF
	})

	file { "${root}/special-files.ini":
		ensure => file,
		content => @("EOF")
			; FILE MANAGED BY PUPPET
			;
			; Which files on the website that are "special"
			; This basicly means that they shouldn't have comments
			[footnote]
			${files_ini}

			[other]
			files[] = list
			files[] = entry-not-found.md
			| EOF
	}
}