On 05/03/2011 04:58 PM, Richard Su wrote:
In this version, Pulp is activated only if its rpm is available from
a yum repo.
The steps in the script are:
1. check Pulp rpm is installed
2. write out templatized configuration files
3. initialize Pulp
4. start pulp-server service
5. save default credentials (may need to change admin password)
6. create x86_64 repos for f13 and f14
7. trigger a sync on both repos
Syncs run in the background. The first sync may take some time to complete
depending on your network bandwidth. Use "pulp-admin repo status --id" to
check the status of the sync using f13-x86_64 and f14-x86_64 for the
repo id.
---
bin/aeolus-configure | 6 +
recipes/aeolus_recipe/aeolus_recipe.pp | 2 +-
recipes/aeolus_recipe/aeolus_uninstall.pp | 2 +-
recipes/aeolus_recipe/manifests/aeolus.pp | 8 ++-
recipes/aeolus_recipe/manifests/pulp.pp | 76 ++++++++++++++
recipes/aeolus_recipe/templates/pulp-client.conf | 49 +++++++++
recipes/aeolus_recipe/templates/pulp.conf | 119 ++++++++++++++++++++++
7 files changed, 259 insertions(+), 3 deletions(-)
create mode 100644 recipes/aeolus_recipe/manifests/pulp.pp
create mode 100755 recipes/aeolus_recipe/templates/pulp-client.conf
create mode 100644 recipes/aeolus_recipe/templates/pulp.conf
diff --git a/bin/aeolus-configure b/bin/aeolus-configure
index 6d87cb1..ee004e0 100644
--- a/bin/aeolus-configure
+++ b/bin/aeolus-configure
@@ -1,5 +1,11 @@
#!/bin/sh
+YUM_LIST_PULP=`yum list pulp`
+if [[ "$YUM_LIST_PULP" == *pulp* ]]
+then
+ export FACTER_AEOLUS_ENABLE_PULP=true
+fi
+
Hrm, honestly I'm not a fan of exposing this at the top level like this.
We defined variables for AEOLUS_ENABLE_[HTTPS|SECURITY|PACKAGES] as
those are meant to be togglable by the end user, eg its up to the user
running aeolus-configure to enable/disable security if they want to.
Since ENABLE_PULP is dependent on the presence of the pulp package, and
not an end-user preference, it might be best to add this check as a new
custom puppet fact for simplicity / cleanliness sake.
See here for more info
http://projects.puppetlabs.com/projects/1/wiki/Adding_Facts
http://blog.kumina.nl/2010/03/puppet-tipstricks-getting-the-version-from-...
<snip>
-
diff --git a/recipes/aeolus_recipe/manifests/pulp.pp
b/recipes/aeolus_recipe/manifests/pulp.pp
new file mode 100644
index 0000000..595fe24
--- /dev/null
+++ b/recipes/aeolus_recipe/manifests/pulp.pp
@@ -0,0 +1,76 @@
+# Aeolus pulp puppet definitions
+
+class aeolus::pulp inherits aeolus {
+
+if $enable_pulp {
As mentioned above, you can define this variable in a custom pulp fact
and continue using this as is.
<snip>
+ exec{'pulp-f13-x86-64-repo-create':
+ command => "/usr/bin/pulp-admin repo create --id f13-x86_64 --feed
yum:http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora...;,
+ logoutput => true,
+ creates =>
"/var/lib/pulp/repos/pub/fedora/linux/releases/13/Fedora/x86_64/os",
+ require => Exec['pulp-auth']}
+
+ exec{'pulp-f13-x86-64-repo-sync':
+ command => "/usr/bin/pulp-admin repo sync --id f13-x86_64",
+ logoutput => true,
+ require => Exec['pulp-f13-x86-64-repo-create']}
+
+ exec{'pulp-f14-x86-64-repo-create':
+ command => "/usr/bin/pulp-admin repo create --id f14-x86_64 --feed
yum:http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora...;,
+ logoutput => true,
+ creates =>
"/var/lib/pulp/repos/pub/fedora/linux/releases/14/Fedora/x86_64/os",
+ require => Exec['pulp-auth']}
+
+ exec{'pulp-f14-x86-64-repo-sync':
+ command => "/usr/bin/pulp-admin repo sync --id f14-x86_64",
+ logoutput => true,
+ require => Exec['pulp-f14-x86-64-repo-create']}
+ }
I think it's probably best to not hard code the fedora version at this
level. Actually we are already conditionally setting the pulp repo
location in recipes/aeolus_recipe/manifests/aeolus.pp
Simply pull the "pulp_base_url_release" variable into this pulp module
and you should be good to go.
+
+class aeolus::pulp::disabled {
+ service { 'pulp-server':
+ ensure => 'stopped',
+ enable => false,
+ hasstatus=> true
+ }
+}
diff --git a/recipes/aeolus_recipe/templates/pulp-client.conf
b/recipes/aeolus_recipe/templates/pulp-client.conf
new file mode 100755
index 0000000..7c990e8
--- /dev/null
+++ b/recipes/aeolus_recipe/templates/pulp-client.conf
@@ -0,0 +1,49 @@
+# The pulp server configuration
+# host : The pulp server
+# port : The port providing the RESTful API.
+# scheme : The protocol.
+# interval : The agent update interval
+[server]
+host = <%= fqdn %>
Pretty sure I already know the answer, but want to make sure that fqdn
is set by puppet (its a fact correct?) as I don't see you setting it in
this patch.
Other than these issues the patch looks good.
-Mo