aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-09 21:36:00 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-09 22:47:39 +0200
commit919d772aaa9bb6f298b1d0a433b6b32d15c0410f (patch)
treeaf48e6b472f40dfa062ea7b0faedc941b56eeaa1
parentf860f6d2b475fa611af2b6a66ee1c774757b77f4 (diff)
downloadPuppet-919d772aaa9bb6f298b1d0a433b6b32d15c0410f.tar.gz
Puppet-919d772aaa9bb6f298b1d0a433b6b32d15c0410f.tar.zst
Puppet-919d772aaa9bb6f298b1d0a433b6b32d15c0410f.zip
Add aura helper
-rw-r--r--manifests/install_ovh.pp1
-rw-r--r--modules/aur/manifests/aura.pp38
-rw-r--r--modules/aur/manifests/init.pp4
-rw-r--r--modules/aur/manifests/install.pp28
4 files changed, 71 insertions, 0 deletions
diff --git a/manifests/install_ovh.pp b/manifests/install_ovh.pp
index 41a9ad2..d1e109f 100644
--- a/manifests/install_ovh.pp
+++ b/manifests/install_ovh.pp
@@ -8,6 +8,7 @@ node default {
8 class { 'base_configuration': 8 class { 'base_configuration':
9 hostname => 'new.immae.eu' 9 hostname => 'new.immae.eu'
10 } 10 }
11 class { 'aur': }
11 12
12 reboot { 'after_run': 13 reboot { 'after_run':
13 apply => 'finished' 14 apply => 'finished'
diff --git a/modules/aur/manifests/aura.pp b/modules/aur/manifests/aura.pp
new file mode 100644
index 0000000..fff988b
--- /dev/null
+++ b/modules/aur/manifests/aura.pp
@@ -0,0 +1,38 @@
1class aur::aura(
2) {
3 user { "aur-builder":
4 name => "aur-builder",
5 system => true,
6 ensure => "present"
7 }
8
9 exec { 'pacman-base-devel':
10 command => '/usr/bin/pacman -S base-devel --needed --noconfirm',
11 unless => '/usr/bin/pacman -Qo aura',
12 logoutput => 'on_failure',
13 }
14
15 ensure_packages(['gmp', 'pcre', 'abs'], { 'install_options' => '--asdeps' })
16
17 exec { 'aur::aura':
18 cwd => "/tmp",
19 path => "/usr/bin",
20 command => 'curl -o /tmp/aur.sh aur.sh && chmod +x /tmp/aur.sh && /tmp/aur.sh aura-bin && mv /tmp/aura-bin/aura-bin-*-x86_64.pkg.tar.xz /tmp/aura-bin-x86_64.pkg.tar.xz && rm /tmp/aur.sh && rm -rf /tmp/aura-bin',
21 user => "aur-builder",
22 unless => '/usr/bin/pacman -Qo aura',
23 require => Exec['pacman-base-devel'],
24 logoutput => 'on_failure',
25 }
26
27 package { 'aura-bin':
28 ensure => "present",
29 source => "/tmp/aura-bin-x86_64.pkg.tar.xz",
30 notify => Exec['aur::aura::cleanup']
31 }
32
33 exec { 'aur::aura::cleanup':
34 path => "/usr/bin/",
35 command => "rm -f /tmp/aura-bin-x86_64.pkg.tar.xz",
36 refreshonly => true
37 }
38}
diff --git a/modules/aur/manifests/init.pp b/modules/aur/manifests/init.pp
new file mode 100644
index 0000000..cdf9929
--- /dev/null
+++ b/modules/aur/manifests/init.pp
@@ -0,0 +1,4 @@
1class aur {
2 class { 'aur::aura': }
3}
4
diff --git a/modules/aur/manifests/install.pp b/modules/aur/manifests/install.pp
new file mode 100644
index 0000000..074088e
--- /dev/null
+++ b/modules/aur/manifests/install.pp
@@ -0,0 +1,28 @@
1define aur::install (
2 $ensure = 'present',
3) {
4
5 case $ensure {
6 'present': {
7 exec { "pacman::aur::install::${name}":
8 require => Class[aur::aura],
9 command => "/usr/bin/aura -A ${name}",
10 unless => "/usr/bin/aura -Qk ${name}",
11 logoutput => 'on_failure',
12 timeout => 1800,
13 }
14 }
15 'absent': {
16 exec { "pacman::aur::remove::${name}":
17 require => Class[aur::aura],
18 command => "/usr/bin/aura -Rs ${name}",
19 onlyif => "/usr/bin/aura -Qi ${name}",
20 logoutput => 'on_failure',
21 }
22 }
23 default: {
24 fail("Pacman::Aur[${name}] ensure parameter must be either 'present' or 'absent'")
25 }
26
27 }
28}