ref_arch_setup 0.0.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8c6aca4691fde2196748ac621990f7b9c401ab0
4
- data.tar.gz: be7e2c0c347e402d5482b68e0f26a74347b26144
3
+ metadata.gz: 867ecc198ad41daa38002f36364b3a9af7f561c6
4
+ data.tar.gz: f759732639ee8e271c2b0e062cd27ca8e2523ef0
5
5
  SHA512:
6
- metadata.gz: 004016af7b7d615cd4c6f40b4ecea50f2b05fd65ba428516c05e2af52ded69a271de7aa9993220fcbf042d4f9dd6a69357a75723acd835977eda2449e0464679
7
- data.tar.gz: daadb2ae7760654854e2e9b8fc4f0638d417bd3f0332c44cee99af3cf18f7775d5f0453fbe5cdad771130a01a84b492652238111d6e6d1e2353b0bc91d4b5cd5
6
+ metadata.gz: fc62ba4ba3beb0532c26cf0ad9b1ac577cb80cb157dc1d607c222b9069598b8730348f5bd2f5738f158cea6da57414c6e8f9caff41ea7fd2724f4095766c5875
7
+ data.tar.gz: 9bc508c713595af8e2174aed3f176ba565c8b1d5bfe2e615db7e6850218c60b418da099d8341b24406d4d544eaafbff95401ceca9f87e16cebae69271d039027
@@ -0,0 +1,2 @@
1
+ # Modules from the Puppet Forge
2
+ mod "puppetlabs-facts", "0.2.0"
@@ -1,14 +1,35 @@
1
1
  # How To Contribute To RefArchSetup
2
2
 
3
3
  ## Getting Started
4
-
5
- * Create a [Jira](http://tickets.puppetlabs.com) account.
6
4
  * Make sure you have a [GitHub](https://github.com) account.
7
- * Submit a ticket for your issue, assuming one does not already exist.
5
+ * Clone the [ref_arch_setup](https://github.com/puppetlabs/ref_arch_setup) repository on GitHub.
6
+ * RefArchSetup uses [gem_of](https://github.com/puppetlabs/gem_of) for some development gem dependencies and rake tasks.
7
+ * Clone the repository and include the `gem_of` submodule:
8
+ ```
9
+ $ ~/> git clone --recurse-submodules https://github.com/puppetlabs/ref_arch_setup.git
10
+ ```
11
+ * If you've already cloned the repository you'll need to initialize and update the `gem_of` submodule:
12
+ ```
13
+ git submodule init
14
+ git submodule update
15
+ ```
16
+
17
+ * Navigate to the ref_arch_setup directory:
18
+ ```
19
+ $ ~/> cd ref_arch_setup
20
+ ```
21
+ * Install the required gems:
22
+ ```
23
+ $ ~/ref_arch_setup> bundle install
24
+ ```
25
+
26
+ ## Filing Tickets With Jira
27
+
28
+ * Create a [Jira](http://tickets.puppetlabs.com) account if you don't already have one.
29
+ * Submit a ticket for your issue, assuming one does not already exist:
30
+ * File a ticket in the [SLV project](https://tickets.puppetlabs.com/projects/SLV/).
8
31
  * Clearly describe the issue including steps to reproduce when it is a bug.
9
- * File a ticket in the [SLV project](https://tickets.puppetlabs.com/projects/SLV/)
10
- * Clone the [ref_arch_setup](https://github.com/puppetlabs/ref_arch_setup) repository on GitHub.
11
-
32
+
12
33
  ## Making Changes
13
34
 
14
35
  ### GitHub
data/README.md CHANGED
@@ -1,23 +1,188 @@
1
1
  # RefArchSetup
2
2
 
3
3
  ## Overview
4
+ RefArchSetup is a Ruby gem designed to help install the various Puppet Reference Architectures.
5
+ It currently supports the Standard Reference Architecture.
4
6
 
5
- RefArchSetup is a gem designed to help install the various puppet reference architectures
7
+ # Prerequisites
8
+ ## Ruby
9
+ RefArchSetup uses [Puppet Bolt](https://puppet.com/products/puppet-bolt) as a gem which requires a minimum Ruby version of 2.3.
10
+
11
+ ## Root Access
12
+ RefArchSetup executes Bolt commands as the root user using the `--run-as root` option to ensure a successful PE installation.
13
+ See the [Bolt Options](#bolt-options) section for more information.
14
+
15
+ ## Supported Platforms
16
+ RefArchSetup supports the following platforms:
17
+
18
+ | OS | Arch |
19
+ |:---- |:---- |
20
+ | EL (RHEL, CentOS, Scientific Linux, Oracle Linux) 6 | x86_64 |
21
+ | EL (RHEL, CentOS, Scientific Linux, Oracle Linux) 7 | x86_64 |
22
+ | SLES 12 | x86_64 |
23
+ | Ubuntu 16.04 | amd64 |
24
+ | Ubuntu 18.04 | amd64 |
25
+
26
+ ## Supported PE Versions
27
+ RefArchSetup supports PE versions greater than 2018.1.0.
28
+
29
+ ## Supported Reference Architectures
30
+ RefArchSetup currently supports the Standard Architecture.
6
31
 
7
32
  # Installation
33
+ RefArchSetup can be installed via [RubyGems](https://rubygems.org/gems/ref_arch_setup) or by building the gem locally.
8
34
 
35
+ ## Install via RubyGems
36
+ The easiest way to install RefArchSetup is via [RubyGems](https://rubygems.org/gems/ref_arch_setup):
37
+ ```
9
38
  $ gem install ref_arch_setup
39
+ ```
40
+
41
+ ## Build the gem locally
42
+ To build the gem locally:
43
+ * Clone the RefArchSetup repository and install the dependencies by following the steps in the [Getting Started](CONTRIBUTING.md) section in [CONTRIBUTING.md](CONTRIBUTING.md).
44
+ * From your local copy of the repository, build the gem using the provided rake task:
45
+ ```
46
+ $ ~/ref_arch_setup> bundle exec rake gem:build
47
+ ```
48
+ * The gem will be built to the pkg directory; install the gem by either specifying the path to the RAS gem provided in the output from the previous step:
49
+ ```
50
+ $ ~/ref_arch_setup> gem install pkg/ref_arch_setup-0.0.x
51
+ ```
52
+ or navigate to the pkg directory first, in which case specifying the version is not required:
53
+ ```
54
+ $ ~/ref_arch_setup> cd pkg && gem install ref_arch_setup
55
+ ```
10
56
 
11
57
  # Usage
58
+ ## Help
59
+ RefArchSetup provides help on the command line. Run the `ref_arch_setup` command with the ` -h` option to display the available commands and options:
60
+ ```
61
+ $ ref_arch_setup -h
62
+ Usage: ref_arch_setup <command> [subcommand] [options]
63
+
64
+ Available Commands:
65
+
66
+ install - Install a bootstrapped PE on target host
67
+ install generate-pe-conf - Generates a pe.conf for the install
68
+ install bootstrap - Installs a bare PE on the target host
69
+ install pe-infra-agent-install - Installs agents on all PE
70
+ infrastructure nodes
71
+ install configure - Configures PE infrastructure nodes to
72
+ reference architecture settings
73
+
74
+ Available Options:
75
+
76
+ -h, --help Prints this help
77
+ -v, --version Show current version of ref_arch_setup
78
+
79
+ ```
12
80
 
13
- TBD
81
+ Run the `ref_arch_setup install` sub-command with the ` -h` option to display the available sub-commands and options:
82
+ ```
83
+ $ ref_arch_setup install -h
84
+ Usage: ref_arch_setup install [options]
14
85
 
15
- # License
86
+ Runs the install subcommands in the following order:
87
+ generate-pe-conf (unless --pe-conf is provided)
88
+ bootstrap
89
+ pe-infra-agent-install (noop for "Standard" ref arch)
90
+ configure
91
+
92
+ Available Options:
93
+ Either --console-password or --pe-conf required
94
+ --user <username> SSH username for bolt ssh to target host
95
+ --password <password> SSH password for bolt ssh to target host
96
+ --private-key <path> Path to SSH private key file for bolt
97
+ ssh to target host
98
+ --sudo-password <password> Root user password for privilege escalation
99
+ --console-password <password> Password for the PE console
100
+ --primary-master <hostname> Hostname of primary master
101
+ --pe-tarball <path|URL> Path or URL to PE tarball
102
+ --pe-version <version> PE version to get tarball for
103
+ --pe-conf <path> Path to pe.conf file
104
+ ```
105
+
106
+ ## Install
107
+ Install PE on the desired primary master using the install command. For example:
108
+ ```
109
+ $ ref_arch_setup install --primary-master=localhost --pe-version=latest --pe-conf=/path/to/pe.conf
110
+ ```
111
+ ### Subcommands
112
+ RefArchSetup is currently in development and as such not all subcommands are currently available.
113
+ Currently only the `bootstrap` subcommand is implemented; other subcommands run in a noop mode.
114
+
115
+ #### generate-pe-conf
116
+ This subcommand has not been implemented.
117
+
118
+ #### bootstrap
119
+ This subcommand runs the bootstrap portion of the install which includes the following steps:
120
+ * Download the PE tarball or verify a local tarball if specified
121
+ * Extract the tarball
122
+ * Run the PE installer
123
+ * Run the Puppet agent until no changes are reported
124
+
125
+ #### pe-infra-agent-install
126
+ This subcommand has not been implemented.
127
+
128
+ #### configure
129
+ This subcommand has not been implemented.
130
+
131
+ ### Options
132
+
133
+ #### --primary-master
134
+ RefArchSetup can perform the PE installation with a local or remote primary master.
135
+
136
+ ##### Specifying a local primary master
137
+ To perform the PE installation on the same host where RefArchSetup is run, specify `--primary-master=localhost`.
16
138
 
139
+ ##### Specifying a remote primary master
140
+ To perform the PE installation on a remote host, specify `--primary-master=my.remote.master`.
141
+ If a remote host is specified it must be accessible to Bolt; see the [Bolt Options](#bolt-options) section for more information.
142
+
143
+ #### --pe-tarball
144
+ Specifying a PE tarball is optional, but if the option is specified it will override the `--pe-version` option.
145
+
146
+ ##### Specifying a tarball URL
147
+ To install PE using a tarball URL, specify `--pe-tarball=https://my.host.tarball.tar.gz`.
148
+
149
+ ##### Specifying a tarball path
150
+ To install PE using a tarball on a local or remote filesystem, specify `--pe-tarball=/path/to/tarball.tar.gz`.
151
+
152
+ #### --pe-version
153
+ RefArchSetup can install a specific version of PE or the latest version.
154
+ See the [Puppet Enterprise Version History](https://puppet.com/misc/version-history) for a comprehensive list of PE versions.
155
+
156
+ ##### Install a specific version
157
+ To install a specific version of PE, specify the version number: `--pe-version=2018.1.4`.
158
+
159
+ ##### Install the latest version
160
+ To install the latest version, specify `--pe-version=latest`.
161
+
162
+ #### --pe-conf
163
+ PE installation requires a valid pe.conf file. At a minimum the "console_admin_password" option must be specified.
164
+ RefArchSetup provides a default [pe.conf](fixtures/pe.conf) file. Specify the path to the pe.conf file: `--pe-conf=/path/to/pe.conf`
165
+
166
+ ## Bolt Options
167
+
168
+ ### --sudo-password
169
+ RefArchSetup executes Bolt commands as the root user using the `--run-as` option.
170
+ If RefArchSetup is run as a user other than root the sudo password must be specified: `--sudo-password=mysudopassword`
171
+
172
+ ### --user
173
+ To execute Bolt commands via ssh with a user other than the user running RefArchSetup, specify `--user=my.ssh.user`.
174
+ Bolt can authenticate using a password or a private key file.
175
+
176
+ ### --password
177
+ To authenticate using a password, specify `--password=mypassword`.
178
+
179
+ ### --private-key
180
+ To authenticate using a private key, specify `--private-key=/path/to/my_key.rsa`.
181
+
182
+ # License
17
183
  See [LICENSE](LICENSE) file.
18
184
 
19
185
  # Support & Issues
20
-
21
186
  Please log tickets and issues in the
22
187
  [SLV project](https://tickets.puppetlabs.com/projects/SLV/).
23
188
 
@@ -25,6 +190,5 @@ For additional information on filing tickets, please check out our
25
190
  [CONTRIBUTOR doc](CONTRIBUTING.md).
26
191
 
27
192
  # Maintainers
28
-
29
193
  For information on project maintainers, please check out our
30
194
  [MAINTAINERS doc](MAINTAINERS.md).
@@ -5,20 +5,27 @@ require "rubygems" unless defined?(Gem)
5
5
  require "ref_arch_setup"
6
6
  require "optparse"
7
7
 
8
- available_commands = [
9
- "install"
10
- ]
8
+ available_commands = %w[install]
11
9
 
12
- options = {}
10
+ available_subcommands = %w[generate-pe-conf bootstrap pe-infra-agent-install configure]
11
+
12
+ @options = {}
13
+ @bolt_options = {}
13
14
  # options["some_option"] = "some value" #to set a default value
14
15
 
15
16
  global = OptionParser.new do |opt|
16
17
  opt.banner = <<-BANNER
17
- Usage: ref_arch_setup [options] <subcommand> [options]
18
+ Usage: ref_arch_setup <command> [subcommand] [options]
18
19
 
19
20
  Available Commands:
20
21
 
21
- install - Install a bootstrapped mono PE on target_host
22
+ install - Install a bootstrapped PE on target host
23
+ install generate-pe-conf - Generates a pe.conf for the install
24
+ install bootstrap - Installs a bare PE on the target host
25
+ install pe-infra-agent-install - Installs agents on all PE
26
+ infrastructure nodes
27
+ install configure - Configures PE infrastructure nodes to
28
+ reference architecture settings
22
29
 
23
30
  Available Options:
24
31
 
@@ -27,29 +34,161 @@ BANNER
27
34
  puts opt
28
35
  exit
29
36
  end
30
- opt.on("-v", "--version", "Show currently running version of ref_arch_setup") do
37
+ opt.on("-v", "--version", "Show current version of ref_arch_setup") do
31
38
  puts RefArchSetup::Version::STRING
32
39
  exit 0
33
40
  end
34
41
  end
35
42
 
36
- subcommands = {
43
+ def install_bolt_opts(opt)
44
+ opt.on("--user <username>", "SSH username for bolt ssh to target host") do |value|
45
+ @bolt_options["user"] = value
46
+ end
47
+ opt.on("--password <password>", "SSH password for bolt ssh to target host") do |value|
48
+ @bolt_options["password"] = value
49
+ end
50
+ opt.on("--private-key <path>", "Path to SSH private key file for bolt", \
51
+ "ssh to target host") do |value|
52
+ @bolt_options["private-key"] = value
53
+ end
54
+ opt.on("--sudo-password <password>", "Root user password for privilege escalation") do |value|
55
+ @bolt_options["sudo-password"] = value
56
+ end
57
+ end
58
+
59
+ def install_generate_opts(opt)
60
+ opt.on("--primary-master <hostname>", "Hostname of primary master") do |value|
61
+ @options["primary_master"] = value
62
+ end
63
+ opt.on("--pe-version <version>", "PE version for base pe.conf file") do |value|
64
+ @options["pe_version"] = value
65
+ end
66
+ end
67
+
68
+ def install_bootstrap(opt)
69
+ # TODO: remove primary master once we implement getting the host from the pe.conf
70
+ opt.on("--primary-master <hostname>", "Hostname of primary master") do |value|
71
+ @options["primary_master"] = value
72
+ end
73
+ opt.on("--pe-tarball <path|URL>", "Path or URL to PE tarball") do |value|
74
+ @options["pe_tarball"] = value
75
+ end
76
+ opt.on("--pe-version <version>", "PE version to get tarball for") do |value|
77
+ @options["pe_version"] = value
78
+ end
79
+ opt.on("--pe-conf <path>", "Path to pe.conf file") do |value|
80
+ @options["pe_conf"] = value
81
+ end
82
+ end
83
+
84
+ def install_pe_infra_agent_install(opt)
85
+ opt.on("--pe-conf <path>", "Path to pe.conf file") do |value|
86
+ @options["pe_conf"] = value
87
+ end
88
+ end
89
+
90
+ def install_configure(opt)
91
+ opt.on("--pe-conf <path>", "Path to pe.conf file") do |value|
92
+ @options["pe_conf"] = value
93
+ end
94
+ end
95
+
96
+ def install_opts(opt)
97
+ install_bolt_opts(opt)
98
+ # This one is here because it is required for generate-pe-conf but not necessarily install
99
+ opt.on("--console-password <password>", "Password for the PE console") do |value|
100
+ @options["console_password"] = value
101
+ end
102
+ install_generate_opts(opt)
103
+ install_bootstrap(opt)
104
+ install_pe_infra_agent_install(opt)
105
+ install_configure(opt)
106
+ end
107
+
108
+ commands = {
37
109
  "install" => OptionParser.new do |opt|
38
- opt.banner = "Usage: ref_arch_setup install [options]"
39
- opt.on("--target-host value", "Host to install PE on") do |value|
40
- options["target_host"] = value
41
- end
42
- opt.on("--pe-tarball-path value", "Path to PE tarball") do |value|
43
- options["pe_tarball_path"] = value
44
- end
45
- opt.on("--pe-conf-path value", "Path to pe.conf file") do |value|
46
- options["pe_conf_path"] = value
110
+ opt.set_summary_width(35)
111
+ opt.banner = <<-BANNER
112
+ Usage: ref_arch_setup install [options]
113
+
114
+ Runs the install subcommands in the following order:
115
+ generate-pe-conf (unless --pe-conf is provided)
116
+ bootstrap
117
+ pe-infra-agent-install (noop for "Standard" ref arch)
118
+ configure
119
+
120
+ Available Options:
121
+ Either --console-password or --pe-conf required
122
+ BANNER
123
+ install_opts(opt)
124
+ end
125
+ }
126
+
127
+ subcommands = {
128
+ "generate-pe-conf" => OptionParser.new do |opt|
129
+ opt.set_summary_width(35)
130
+ opt.banner = <<-BANNER
131
+ Usage: ref_arch_setup install generate-pe-conf [options]
132
+
133
+ Generates a pe.conf file for the install.
134
+ Uses localhost for primary master by default.
135
+ Uses latest production release for version by default.
136
+ Places the file in /tmp/ref_arch_setup/pe.conf
137
+
138
+ Available Options:
139
+ BANNER
140
+ # This one is here because it is required for generate-pe-conf but not necessarily install
141
+ opt.on("--console-password <password>", "REQUIRED: Password for the PE console") do |value|
142
+ @options["console_password"] = value
47
143
  end
144
+ install_generate_opts(opt)
145
+ install_bolt_opts(opt)
146
+ end,
147
+ "bootstrap" => OptionParser.new do |opt|
148
+ opt.set_summary_width(35)
149
+ opt.banner = <<-BANNER
150
+ Usage: ref_arch_setup install bootstrap [options]
151
+
152
+ Does a bootstrap install of PE on the primary master
153
+ Uses pe.conf from /tmp/ref_arch_setup/pe.conf by default.
154
+
155
+ Available Options:
156
+ BANNER
157
+ install_bootstrap(opt)
158
+ install_bolt_opts(opt)
159
+ end,
160
+ "pe-infra-agent-install" => OptionParser.new do |opt|
161
+ opt.set_summary_width(35)
162
+ opt.banner = <<-BANNER
163
+ Usage: ref_arch_setup install pe-infra-agent-install [options]
164
+
165
+ Installs puppet agents on all PE infrastructure nodes other than
166
+ the primary master
167
+ Uses pe.conf from the primary master by default.
168
+
169
+ Available Options:
170
+ BANNER
171
+ install_pe_infra_agent_install(opt)
172
+ install_bolt_opts(opt)
173
+ end,
174
+ "configure" => OptionParser.new do |opt|
175
+ opt.set_summary_width(35)
176
+ opt.banner = <<-BANNER
177
+ Usage: ref_arch_setup install configure [options]
178
+
179
+ Configures all PE infrastructure nodes, including initial performance tuning
180
+ Uses pe.conf from from the primary master by default.
181
+
182
+ Available Options:
183
+ BANNER
184
+ install_configure(opt)
185
+ install_bolt_opts(opt)
48
186
  end
49
187
  }
50
188
 
51
189
  global.order!(ARGV)
52
190
  command_string = ARGV[0]
191
+ subcommand_string = ARGV[1]
53
192
 
54
193
  if command_string.nil?
55
194
  puts global.help
@@ -57,13 +196,23 @@ if command_string.nil?
57
196
  end
58
197
 
59
198
  unless available_commands.include?(command_string)
60
- puts "# ERROR, #{cmd} is not an available command"
199
+ puts "# ERROR, #{command_string} is not an available command"
61
200
  puts
62
201
  puts global.help
63
202
  exit 1
64
203
  end
65
204
 
66
- subcommands[command_string].parse!
67
-
68
- cli = RefArchSetup::CLI.new(options)
69
- cli.send(command_string)
205
+ cli = RefArchSetup::CLI.new(@options, @bolt_options)
206
+ if subcommand_string !~ /^[a-zA-Z]/
207
+ commands[command_string].parse!
208
+ exit cli.run(command_string)
209
+ else
210
+ unless available_subcommands.include?(subcommand_string)
211
+ puts "# ERROR, #{subcommand_string} is not an available subcommand of #{command_string}"
212
+ puts
213
+ puts global.help
214
+ exit 1
215
+ end
216
+ subcommands[subcommand_string].parse!
217
+ exit cli.run(command_string, subcommand_string)
218
+ end