Update cookbooks and add wordpress cookbook

This commit is contained in:
Greg Karékinian
2016-02-19 18:09:49 +01:00
parent 9ba973e3ac
commit 820b0ab3f8
606 changed files with 22421 additions and 14084 deletions

View File

@@ -1,65 +0,0 @@
From e705e0beb6cd93447dec04aea8bdda004fbb8ab7 Mon Sep 17 00:00:00 2001
From: capotej <jcapote@gmail.com>
Date: Tue, 28 Oct 2014 12:47:17 -0700
Subject: [PATCH] chef on amazon 2014
---
.kitchen.yml | 23 ++++++++++++++++++++---
Gemfile | 1 +
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.kitchen.yml b/.kitchen.yml
index a389d99..fbebe56 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -25,7 +25,7 @@ platforms:
- name: ubuntu-14.04
driver_config:
box: opscode-ubuntu-14.04
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-14.04_provisionerless.box
+ box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
run_list:
- recipe[packagecloud_test::trusty_deps]
- recipe[packagecloud_test::deb]
@@ -56,7 +56,24 @@ platforms:
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems_private]
+- name: amazon-2014.09
+ driver_plugin: ec2
+ driver_config:
+ image_id: ami-b5a7ea85
+ username: ec2-user
+ aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
+ aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
+ aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
+ ssh_key: <%= ENV['AWS_SSH_KEY_PATH'] %>
+ availability_zone: us-west-2a
+ region: us-west-2
+ flavor_id: t2.micro
+ security_group_ids: sg-598e583c
+ run_list:
+ - recipe[packagecloud_test::rpm]
+ - recipe[packagecloud_test::rubygems]
+
suites:
- name: default
- run_list:
- attributes: {}
+run_list:
+attributes: {}
diff --git a/Gemfile b/Gemfile
index 9ce1223..9b9ee17 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
gem 'rake'
gem 'berkshelf', '~> 3.1.4'
+gem 'kitchen-ec2'
group :test do
gem 'foodcritic', '~> 4.0.0'
--
1.9.2

View File

@@ -2,6 +2,12 @@ packagecloud
===============
This is the Changelog for the packagecloud cookbook
v0.2.0 (2015-02-17)
-------------------
Rework GPG paths to support new GPG endpoints for repos with repo-specific GPG
keys. Old endpoints/URLs still work, too.
v0.0.1 (2014-06-05)
-------------------
Initial release.

View File

@@ -3,6 +3,7 @@ source 'https://rubygems.org'
gem 'rake'
gem 'berkshelf', '~> 3.1.4'
gem 'kitchen-ec2'
gem 'stove'
group :test do
gem 'foodcritic', '~> 4.0.0'

View File

@@ -2,6 +2,8 @@
This cookbook provides an LWRP for installing https://packagecloud.io repositories.
NOTE: Please see the Changelog below for important changes if upgrading from 0.0.19 to 0.1.0.
## Usage
Be sure to depend on `packagecloud` in `metadata.rb` so that the packagecloud
@@ -25,6 +27,7 @@ end
```
For packagecloud:enterprise users, add `base_url` to your resource:
```
packagecloud_repo "computology/packagecloud-cookbook-test-private" do
base_url "https://packages.example.com"
@@ -33,6 +36,16 @@ packagecloud_repo "computology/packagecloud-cookbook-test-private" do
end
```
For forcing the os and dist for repository install:
```
packagecloud_repo 'computology/packagecloud-cookbook-test-public' do
type 'rpm'
force_os 'rhel'
force_dist '6.5'
end
```
Valid options for `type` include `deb`, `rpm`, and `gem`.
## Interactions with other cookbooks
@@ -60,5 +73,19 @@ the yum chef cookbook is set to the system default, unless you use the
`cachedir`, you should make sure to setup packagecloud repos after that
resource is set so that the GPG keys end up in the right place.
## Changelog
packagecloud cookbook versions 0.0.19 used an attribute called
`default['packagecloud']['hostname']` for caching the local machine's hostname
to avoid regenerating read tokens.
This attribute has been removed as it is confusing and in some edge cases,
buggy.
Beginning in 0.1.0, you can use
`default['packagecloud']['hostname_override']` to specify a hostname if ohai
is unable to determine the hostname of the node on its own.
## Credits
Computology, LLC.

View File

@@ -3,3 +3,4 @@ The following people have contributed to packagecloud chef cookbook (If you're n
THANKS
------
Guilhem Lettron (@guilhem)
Michael S. Fischer (@mfischer-zd)

View File

@@ -1,5 +1,6 @@
default['packagecloud']['base_repo_path'] = "/install/repositories/"
default['packagecloud']['gpg_key_path'] = "/gpg.key"
default['packagecloud']['gpg_key_path'] = "/gpgkey"
default['packagecloud']['hostname_override'] = nil
default['packagecloud']['default_type'] = value_for_platform_family(
'debian' => 'deb',

View File

@@ -35,7 +35,14 @@
"recipes": {
},
"version": "0.0.18",
"source_url": "",
"issues_url": ""
"version": "0.2.0",
"source_url": "https://github.com/computology/packagecloud-cookbook",
"issues_url": "https://github.com/computology/packagecloud-cookbook/issues",
"privacy": false,
"chef_versions": [
],
"ohai_versions": [
]
}

View File

@@ -4,4 +4,6 @@ maintainer_email 'joe@packagecloud.io'
license 'Apache 2.0'
description 'Installs/Configures packagecloud.io repositories.'
long_description 'Installs/Configures packagecloud.io repositories.'
version '0.0.18'
version '0.2.0'
source_url 'https://github.com/computology/packagecloud-cookbook' if respond_to?(:source_url)
issues_url 'https://github.com/computology/packagecloud-cookbook/issues' if respond_to?(:issues_url)

View File

@@ -17,19 +17,34 @@ action :add do
end
end
def gpg_url(base_url, repo, format, master_token)
base_install_url = ::File.join(base_url, node['packagecloud']['base_repo_path'])
ext = (format == :deb) ? 'list' : 'repo'
gpg_key_url_endpoint = construct_uri_with_options({base_url: base_install_url, repo: repo, endpoint: "gpg_key_url.#{ext}"})
if !master_token.nil?
gpg_key_url_endpoint.user = master_token
gpg_key_url_endpoint.password = ''
end
URI(get(gpg_key_url_endpoint, install_endpoint_params).body.chomp)
end
def install_deb
base_url = new_resource.base_url
repo_url = construct_uri_with_options({base_url: base_url, repo: new_resource.repository, endpoint: node['platform']})
Chef::Log.debug("#{new_resource.name} deb repo url = #{repo_url}")
package 'wget'
package 'apt-transport-https'
repo_url = read_token(repo_url)
template "/etc/apt/sources.list.d/#{filename}.list" do
source 'apt.erb'
cookbook 'packagecloud'
mode '0644'
variables :base_url => read_token(repo_url).to_s,
variables :base_url => repo_url.to_s,
:distribution => node['lsb']['codename'],
:component => 'main'
@@ -37,10 +52,10 @@ def install_deb
notifies :run, "execute[apt-get-update-#{filename}]", :immediately
end
gpg_key_url = ::File.join(base_url, node['packagecloud']['gpg_key_path'])
gpg_url = gpg_url(new_resource.base_url, new_resource.repository, :deb, new_resource.master_token)
execute "apt-key-add-#{filename}" do
command "wget -qO - #{gpg_key_url} | apt-key add -"
command "wget --auth-no-challenge -qO - #{gpg_url.to_s} | apt-key add -"
action :nothing
end
@@ -54,13 +69,9 @@ end
def install_rpm
given_base_url = new_resource.base_url
base_repo_url = ::File.join(given_base_url, node['packagecloud']['base_repo_path'])
base_url_endpoint = construct_uri_with_options({base_url: base_repo_url, repo: new_resource.repository, endpoint: 'rpm_base_url'})
gpg_filename = URI.parse(base_repo_url).host.gsub!('.', '_')
if new_resource.master_token
base_url_endpoint.user = new_resource.master_token
base_url_endpoint.password = ''
@@ -91,18 +102,15 @@ def install_rpm
not_if 'rpm -qa | grep -qw pygpgme'
end
remote_file "/etc/pki/rpm-gpg/RPM-GPG-KEY-#{gpg_filename}" do
source ::File.join(given_base_url, node['packagecloud']['gpg_key_path'])
mode '0644'
end
gpg_url = gpg_url(new_resource.base_url, new_resource.repository, :rpm, new_resource.master_token)
template "/etc/yum.repos.d/#{filename}.repo" do
source 'yum.erb'
cookbook 'packagecloud'
mode '0644'
variables :base_url => read_token(base_url).to_s,
:gpg_filename => gpg_filename,
variables :base_url => base_url.to_s,
:name => filename,
:gpg_url => gpg_url.to_s,
:repo_gpgcheck => 1,
:description => filename,
:priority => new_resource.priority,
@@ -138,6 +146,7 @@ def install_gem
end
end
def read_token(repo_url, gems=false)
return repo_url unless new_resource.master_token
@@ -163,19 +172,27 @@ def read_token(repo_url, gems=false)
end
def install_endpoint_params
dist = value_for_platform_family(
dist = new_resource.force_dist || value_for_platform_family(
'debian' => node['lsb']['codename'],
['rhel', 'fedora'] => node['platform_version'],
)
if node['fqdn'].nil?
Chef::Log.fatal("This node's fqdn is set to nil, so a read token cannot be issued!" \
"Please change your fqdn settings.")
hostname = node['packagecloud']['hostname_override'] ||
node['fqdn'] ||
node['hostname']
if !hostname
raise("Can't determine hostname! Set node['packagecloud']['hostname_override'] " \
"if it cannot be automatically determined by Ohai.")
end
{ :os => node['platform'],
{ :os => os_platform,
:dist => dist,
:name => node['fqdn'] }
:name => hostname }
end
def os_platform
new_resource.force_os || node['platform']
end
def filename
@@ -203,5 +220,5 @@ def construct_uri_with_options(options)
end
def append_trailing_slash(str)
str.end_with?("/") ? str : str << "/"
str.end_with?("/") ? str : str + "/"
end

View File

@@ -3,8 +3,9 @@ default_action :add
attribute :repository, :kind_of => String, :name_attribute => true
attribute :master_token, :kind_of => String
attribute :force_os, :kind_of => String
attribute :force_dist, :kind_of => String
attribute :type, :kind_of => String, :equal_to => ['deb', 'rpm', 'gem'], :default => node['packagecloud']['default_type']
attribute :base_url, :kind_of => String, :default => "https://packagecloud.io"
attribute :gpg_key_url, :kind_of => String, :default => node['packagecloud']['gpg_key_url']
attribute :priority, :kind_of => [Fixnum, TrueClass, FalseClass], :default => false
attribute :metadata_expire, :kind_of => String, :regex => [/^\d+[d|h|m]?$/], :default => nil

View File

@@ -7,7 +7,7 @@ priority=<%=@priority %>
<% end -%>
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-<%= @gpg_filename %>
gpgkey=<%= @gpg_url %>
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
<% if @metadata_expire %>