@@ -2296,115 +2296,174 @@ If for any reason the installation fails, before re-running the installer, see
2296
2296
xref:installer-known-issues[Known Issues] to check for any specific
2297
2297
instructions or workarounds.
2298
2298
2299
- [[running-the-advanced-installation-system-container ]]
2299
+ [[running-the-advanced-installation-containerized ]]
2300
2300
=== Running the Containerized Installer
2301
2301
2302
- include::install_config/install/advanced_install.adoc[tag=syscontainers_techpreview]
2303
-
2304
2302
The
2305
2303
ifdef::openshift-enterprise[]
2306
2304
*openshift3/ose-ansible*
2307
2305
endif::[]
2308
2306
ifdef::openshift-origin[]
2309
2307
*openshift/origin-ansible*
2310
2308
endif::[]
2311
- image is a containerized version of the {product-title} installer that runs as a
2312
- link:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/managing_containers/running_system_containers[system container]. System containers are stored and run outside of the traditional
2313
- *docker* service. Functionally, using the containerized installer is the same as
2314
- using the traditional RPM-based installer, except it is running in a
2315
- containerized environment instead of directly on the host.
2309
+ image is a containerized version of the {product-title} installer.
2310
+ This installer image provides the same functionality as the RPM-based
2311
+ installer, but it runs in a containerized environment that provides all
2312
+ of its dependencies rather than being installed directly on the host.
2313
+ The only requirement to use it is the ability to run a container.
2314
+
2315
+ [[running-the-advanced-installation-system-container]]
2316
+ ==== Running the Installer as a System Container
2317
+
2318
+ include::install_config/install/advanced_install.adoc[tag=syscontainers_techpreview]
2316
2319
2317
- . Use the Docker CLI to pull the image locally:
2320
+ The installer image can be used as a
2321
+ link:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/managing_containers/running_system_containers[system container].
2322
+ System containers are stored and run outside of the traditional *docker* service.
2323
+ This enables running the installer image from one of the target hosts without
2324
+ concern for the install restarting *docker* on the host.
2325
+
2326
+ . As the `root` user, use the Atomic CLI to run the installer as a run-once system container:
2318
2327
+
2319
2328
----
2329
+ # atomic install --system \
2330
+ --storage=ostree \
2331
+ --set INVENTORY_FILE=/path/to/inventory \ <1>
2320
2332
ifdef::openshift-enterprise[]
2321
- $ docker pull registry.access.redhat.com/openshift3/ose-ansible:v3.7
2333
+ registry.access.redhat.com/openshift3/ose-ansible:v3.7
2322
2334
endif::[]
2323
2335
ifdef::openshift-origin[]
2324
- $ docker pull docker.io/openshift/origin-ansible:v3.7
2336
+ docker.io/openshift/origin-ansible:v3.7
2325
2337
endif::[]
2326
2338
----
2327
-
2328
- . The installer system container must be stored in
2339
+ <1> Specify the location on the local host for your inventory file.
2340
+ +
2341
+ This command initiates the cluster installation by using the inventory file specified and the `root` user's
2342
+ SSH configuration. It logs the output on the terminal and also saves it in the *_/var/log/ansible.log_* file.
2343
+ The first time this command is run, the image is imported into
2329
2344
link:https://access.redhat.com/documentation/en-us/red_hat_satellite/6.2/html/content_management_guide/managing_ostree_content[OSTree]
2330
- instead of defaulting to *docker* daemon storage. Use the Atomic CLI to import
2331
- the installer image from the local *docker* engine to OSTree storage:
2345
+ storage (system containers use this rather than *docker* daemon storage).
2346
+ On subsequent runs, it reuses the stored image.
2332
2347
+
2333
- ----
2334
- $ atomic pull --storage ostree \
2335
- ifdef::openshift-enterprise[]
2336
- docker:registry.access.redhat.com/openshift3/ose-ansible:v3.7
2337
- endif::[]
2338
- ifdef::openshift-origin[]
2339
- docker:docker.io/openshift/origin-ansible:v3.7
2340
- endif::[]
2341
- ----
2348
+ If for any reason the installation fails, before re-running the installer, see
2349
+ xref:installer-known-issues[Known Issues] to check for any specific instructions
2350
+ or workarounds.
2351
+
2352
+ [[running-the-advanced-installation-system-container-other-playbooks]]
2353
+ ==== Running Other Playbooks
2354
+
2355
+ You can use the `PLAYBOOK_FILE` environment variable to specify other playbooks
2356
+ you want to run by using the containerized installer. The default value of the `PLAYBOOK_FILE` is
2357
+ *_/usr/share/ansible/openshift-ansible/playbooks/byo/config.yml_*, which is the
2358
+ main cluster installation playbook, but you can set it to the path of another
2359
+ playbook inside the container.
2360
+
2361
+ For example, to run the
2362
+ xref:configuring-cluster-pre-install-checks[pre-install checks] playbook before
2363
+ installation, use the following command:
2342
2364
2343
- . Install the system container so it is set up as a systemd service:
2344
- +
2345
2365
----
2346
- $ atomic install --system \
2366
+ # atomic install --system \
2347
2367
--storage=ostree \
2348
- --name=openshift-installer \//<1>
2349
- --set INVENTORY_FILE=/path/to/inventory \//<2>
2368
+ --set INVENTORY_FILE=/path/to/inventory \
2369
+ --set PLAYBOOK_FILE=/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/pre-install.yml \ <1>
2370
+ --set OPTS="-v" \ <2>
2350
2371
ifdef::openshift-enterprise[]
2351
- docker: registry.access.redhat.com/openshift3/ose-ansible:v3.7
2372
+ registry.access.redhat.com/openshift3/ose-ansible:v3.7
2352
2373
endif::[]
2353
2374
ifdef::openshift-origin[]
2354
- docker:docker .io/openshift/origin-ansible:v3.7
2375
+ docker.io/openshift/origin-ansible:v3.7
2355
2376
endif::[]
2356
2377
----
2357
- <1> Sets the name for the systemd service.
2358
- <2> Specify the location for your inventory file on your local workstation.
2378
+ <1> Set `PLAYBOOK_FILE` to the full path of the playbook starting at the
2379
+ *_playbooks/_* directory. Playbooks are located in the same locations as with
2380
+ the RPM-based installer.
2381
+ <2> Set `OPTS` to add command line options to `ansible-playbook`.
2359
2382
2360
- . Use the `systemctl` command to start the installer service as you would any
2361
- other systemd service. This command initiates the cluster installation:
2362
- +
2363
- ----
2364
- $ systemctl start openshift-installer
2365
- ----
2366
- +
2367
- If for any reason the installation fails, before re-running the installer, see
2368
- xref:installer-known-issues[Known Issues] to check for any specific instructions
2369
- or workarounds.
2383
+ [[running-the-advanced-installation-docker]]
2384
+ ==== Running the Installer as a Docker Container
2370
2385
2371
- . After the installation completes, you can uninstall the system container if you want. However, if you need to run the installer again to run any other playbooks later, you would have to follow this procedure again.
2372
- +
2373
- To uninstall the system container:
2374
- +
2375
- ----
2376
- $ atomic uninstall openshift-installer
2377
- ----
2386
+ The installer image can also run as a *docker* container anywhere that *docker* can run.
2378
2387
2379
- [[running-the-advanced-installation-system-container-other-playbooks]]
2380
- ==== Running Other Playbooks
2388
+ [WARNING]
2389
+ ====
2390
+ This method must not be used to run the installer on one of the hosts being configured,
2391
+ as the install may restart *docker* on the host, disrupting the installer container execution.
2392
+ ====
2393
+
2394
+ [NOTE]
2395
+ ====
2396
+ Although this method and the system container method above use the same image, they
2397
+ run with different entry points and contexts, so runtime parameters are not the same.
2398
+ ====
2381
2399
2382
- After you have completed the cluster installation, if you want to later run any
2383
- other playbooks using the containerized installer (for example, cluster upgrade
2384
- playbooks), you can use the `PLAYBOOK_FILE` environment variable. The default
2385
- value is `playbooks/byo/config.yml`, which is the main cluster installation
2386
- playbook, but you can set it to the path of another playbook inside the
2387
- container.
2400
+ At a minimum, when running the installer as a *docker* container you must provide:
2388
2401
2389
- For example:
2402
+ * SSH key(s), so that Ansible can reach your hosts.
2403
+ * An Ansible inventory file.
2404
+ * The location of the Ansible playbook to run against that inventory.
2405
+
2406
+ Here is an example of how to run an install via *docker*.
2407
+ Note that this must be run by a non-`root` user with access to *docker*.
2390
2408
2391
2409
----
2392
- $ atomic install --system \
2393
- --storage=ostree \
2394
- --name=openshift-installer \
2395
- --set INVENTORY_FILE=/etc/ansible/hosts \
2396
- --set PLAYBOOK_FILE=playbooks/byo/openshift-cluster/upgrades/v3_7/upgrade.yml \//<1>
2410
+ $ docker run -t -u `id -u` \ <1>
2411
+ -v $HOME/.ssh/id_rsa:/opt/app-root/src/.ssh/id_rsa:Z \ <2>
2412
+ -v $HOME/ansible/hosts:/tmp/inventory:Z \ <3>
2413
+ -e INVENTORY_FILE=/tmp/inventory \ <3>
2414
+ -e PLAYBOOK_FILE=playbooks/byo/config.yml \ <4>
2415
+ -e OPTS="-v" \ <5>
2397
2416
ifdef::openshift-enterprise[]
2398
- docker: registry.access.redhat.com/openshift3/ose-ansible:v3.7
2417
+ registry.access.redhat.com/openshift3/ose-ansible:v3.7
2399
2418
endif::[]
2400
2419
ifdef::openshift-origin[]
2401
- docker:docker .io/openshift/origin-ansible:v3.7
2420
+ docker.io/openshift/origin-ansible:v3.7
2402
2421
endif::[]
2403
2422
----
2404
- <1> Set `PLAYBOOK_FILE` to the relative path of the playbook starting at the
2405
- *_playbooks/_* directory. Playbooks mentioned elsewhere in {product-title}
2406
- documentation assume use of the RPM-based installer, so use this relative path
2407
- instead when using the containerized installer.
2423
+ <1> `-u `id -u`` makes the container run with the same UID as the current
2424
+ user, which allows that user to use the SSH key inside the container (SSH
2425
+ private keys are expected to be readable only by their owner).
2426
+ <2> `-v $HOME/.ssh/id_rsa:/opt/app-root/src/.ssh/id_rsa:Z` mounts your
2427
+ SSH key (`$HOME/.ssh/id_rsa`) under the container user's `$HOME/.ssh`
2428
+ (*_/opt/app-root/src_* is the `$HOME` of the user in the container). If
2429
+ you mount the SSH key into a non-standard location you can add an
2430
+ environment variable with `-e ANSIBLE_PRIVATE_KEY_FILE=/the/mount/point`
2431
+ or set `ansible_ssh_private_key_file=/the/mount/point` as a variable in
2432
+ the inventory to point Ansible at it.
2433
+ +
2434
+ Note that the SSH key is mounted with the `:Z` flag. This is
2435
+ required so that the container can read the SSH key under
2436
+ its restricted SELinux context. This also means that your
2437
+ original SSH key file will be re-labeled to something like
2438
+ `system_u:object_r:container_file_t:s0:c113,c247`. For more details
2439
+ about `:Z` please check the `docker-run(1)` man page. Keep this in mind
2440
+ when providing these volume mount specifications because this might
2441
+ have unexpected consequences: for example, if you mount (and therefore
2442
+ re-label) your whole `$HOME/.ssh` directory it will block the host's
2443
+ *sshd* from accessing your public keys to login. For this reason you
2444
+ may want to use a separate copy of the SSH key (or directory), so that
2445
+ the original file labels remain untouched.
2446
+ <3> `-v $HOME/ansible/hosts:/tmp/inventory:Z` and `-e INVENTORY_FILE=/tmp/inventory`
2447
+ mount a static Ansible inventory file into the container as
2448
+ *_/tmp/inventory_* and set the corresponding environment variable to
2449
+ point at it. As with the SSH key, the inventory file SELinux labels may
2450
+ need to be relabeled by using the `:Z` flag to allow reading in the container,
2451
+ depending on the existing label (for files in a user `$HOME` directory
2452
+ this is likely to be needed). So again you may prefer to copy the
2453
+ inventory to a dedicated location before mounting it.
2454
+ +
2455
+ The inventory file can also be downloaded from a web server if you specify
2456
+ the `INVENTORY_URL` environment variable, or generated dynamically using
2457
+ `DYNAMIC_SCRIPT_URL` to specify an executable script that provides a
2458
+ dynamic inventory.
2459
+ <4> `-e PLAYBOOK_FILE=playbooks/byo/config.yml` specifies the playbook
2460
+ to run (in this example, the BYO installer) as a relative path from the
2461
+ top level directory of *openshift-ansible* content. The full path from the
2462
+ RPM can also be used, as well as the path to any other playbook file in
2463
+ the container.
2464
+ <5> `-e OPTS="-v"` supplies arbitrary command line options (in this case,
2465
+ `-v` to increase verbosity) to the `ansible-playbook` command that runs
2466
+ inside the container.
2408
2467
2409
2468
[[running-the-advanced-installation-individual-components]]
2410
2469
=== Running Individual Component Playbooks
0 commit comments