├── LICENSE ├── README.md ├── ansible.cfg ├── arguments.j2 ├── changelog ├── group_vars └── all.yml ├── grub.cfg-multi.j2 ├── grub.cfg-single.j2 ├── inventory-multinic.yml ├── inventory.yml ├── isolinux.cfg-multi.j2 ├── isolinux.cfg-single.j2 ├── playbook-multi.yml └── playbook-single.yml /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## WARNING! WARNING! WARNING! 2 | It has been brought to my attention that use of coreos-iso-maker may geerate images that may NOT be supported 3 | if you plan to install your cluster in FIPS mode. A customer was having issues with a FIPS based cluster that 4 | they couldn't update which may or may not be related to their use of this repo. You have been warned! 5 | 6 | Also note that in upcoming version of OpenShift, there will be the supported ability customize the ISO installer. 7 | See [here](https://coreos.github.io/coreos-installer/cmd/iso/#coreos-installer-iso-customize) for more details 8 | 9 | # coreos-iso-maker V2.10 10 | Update this version: This version supports the new OCP 4.6 ISO. There was a name change as well as a change 11 | in the underlying directory structure of the ISO which broke everything so this is no longer backwards compatible. 12 | Versions should be tagged as either OCP4.5 (which works with earlier versions as well) or OCP4.6. Make sure you 13 | use the correct one or you will like have issues. 14 | 15 | My thanks to Steve Ovens for pointing out how broken this became. 16 | 17 | A *HUGE* thanks to ITS4U (https://github.com/its4u) for a number of pull requests that were to fix a lot 18 | of the issues with the 4.6 liveCD due to all the changes in the ISO as well as my lack of understanding with some of 19 | the variables in use. 20 | 21 | As part of ITS4U's work, there is a new parameter for the inventory that defines whether DHCP should be used. 22 | Normally, of course, this will be set to false as that is the entire point of this project. But if you have 23 | other NICs that make use of it, it can be turned on for those. 24 | 25 | # Problem definition 26 | Some customers would like to use static IPs for their OCP nodes but don't have a 27 | working DHCP server for various reasons. This can be done using the ISO for CoreOS 28 | and messing with the boot parameters. However, this is involves lots of error prone 29 | typing. This project is designed to work around that and originally created individualized ISOs 30 | for each node. In v2.1, it can be used to create a single ISO with a menu item for each node being 31 | built. Due to screen space limitations, it is NOT recommend that you use this to create 32 | more than 7 nodes at a time (1 bootstrap, 3 master control planes, and 3 worker nodes). 33 | It _might_ work, but you might have problems with the display on boot. Caveat user. 34 | If you would prefer to have multiple ISOs, there is a separate playbook for that. 35 | 36 | # Variables to define 37 | 38 | In the `group_vars/all.yml` file, define the following variables: 39 | 40 | * `gateway` - default router IP 41 | * `netmask` - default netmask 42 | * `interface` - NIC device name. Defaults to `ens192` which is default for VMWare 43 | * `dns` - dns server. This can be done as a list. Don't add more than 3. 44 | * `webserver_url` - webserver that holds the Ignition file 45 | * `webserver_port` - webserver port for the webserver above 46 | * `webserver_ignition_path` - Ignition subpath in http server 47 | * `install_drive` - drive to install RHCOS on 48 | * `ocp_version` - Full OCP version you are going for. 4.4.3 49 | * `iso_checksum` - sha256 checksum of the ISO. Currently correct as of 2020-01-23 and OCP 4.3 50 | * `iso_name` - Name of the ISO to download. Makes certain assumptions that should be verified 51 | * `rhcos_bios` - Name of the BIOS image to boot from. This is how the file is named on your webserver. Make certain assumptions that should be verified. 52 | * `arch` - CPU Architecture type. Must be one of `x86_64` (default) or `ppc64le` Can be defined on the commandline with `-e` 53 | 54 | In `inventory.yml` you will need to define your hosts: 55 | 56 | * `bootstrap` - bootstrap node and its `ipv4` address 57 | * `masters` - You will need to define `3` master nodes and their `ipv4` address 58 | * `workers` - However many worker nodes you want and their corresponding `ipv4` addresses. Recommend no more than 3 at a go. 59 | 60 | There is a second example file called `inventory-multinic.yml` for an example of how to setup multiple NIC machines. 61 | 62 | You will need to use create individual ignition files and load them to your webserver. 63 | This project does **NOT** currently do that. 64 | 65 | # Running the Playbook 66 | 67 | Once the inventory is created, you can run either of the following commands: 68 | 69 | For a single ISO: 70 | `ansible-playbook playbook-single.yml -K` 71 | 72 | For multiple ISOs: 73 | `ansible-playbook playbook-multi.yml -K` 74 | 75 | The included `ansible.cfg` file assumes the name of the inventory file is `inventory.yml` Change it 76 | in there if you want to use a different one or include the `-i ` option to change it 77 | on the command line. 78 | 79 | The ISO(s) will be created in the `/tmp` directory. The `-K` is to request for the BECOME password which is 80 | required to mount an ISO (assuming you don't have passwordless `sudo`). 81 | 82 | # Acknowlegements 83 | Special thanks to Shanna Chan for trailblazing these issues (detail 84 | here: https://shanna-chan.blog/2019/07/26/openshift4-vsphere-static-ip/) and inspiring its creation. 85 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = inventory.yml 3 | 4 | [privilege_escalation] 5 | become = false 6 | become_user = root 7 | become_method = sudo 8 | become_ask_pass = false 9 | -------------------------------------------------------------------------------- /arguments.j2: -------------------------------------------------------------------------------- 1 | random.trust_cpu=on {# -#} 2 | rd.luks.options=discard {# -#} 3 | coreos.liveiso=RHCOS-CustomIso {# -#} 4 | ignition.firstboot {# -#} 5 | ignition.platform.id=metal {# -#} 6 | coreos.inst.install_dev=/dev/{{ install_drive | default(sda) }} {# -#} 7 | coreos.inst.ignition_url={{ webserver_ignition_fullpath }}{{ hostvars[server].group_names[0] }}.ign {# -#} 8 | {%- if hostvars[server].interfaces is defined -%} 9 | {%- for intf_name, intf in hostvars[server].interfaces.items() -%} 10 | ip={{ intf.ipv4 -}} 11 | ::{{ intf.gtwy -}} 12 | :{{ intf.mask -}} 13 | :{{ server -}} 14 | :{{ intf_name -}} 15 | :none {# -#} 16 | {%- endfor -%} 17 | {%- else -%} 18 | {%- if hostvars[server].ipv4 is defined -%} 19 | ip={{ hostvars[server].ipv4 -}} 20 | ::{{ hostvars[server].gateway -}} 21 | :{{ hostvars[server].netmask -}} 22 | :{{ server -}} 23 | :{{ hostvars[server].interface -}} 24 | :none {# -#} 25 | {%- else -%} 26 | ip=dhcp {# -#} 27 | {%- endif -%} 28 | {%- endif -%} 29 | {%- for myns in dns -%} 30 | nameserver={{ myns }} {# -#} 31 | {%- endfor -%} -------------------------------------------------------------------------------- /changelog: -------------------------------------------------------------------------------- 1 | # coreos-iso-maker V2.8 2 | Update this version: PPC64 support! This requires a new variable detailed below 3 | 4 | Updates this version: My thanks to Loic Mulder (https://github.com/lmulder) for the following tweaks and additions: 5 | * ISO won't be redownloaded if it is already present on the system. 6 | * inventory file now uses group single group names. This aligns with the ignition file generated by the openshift-installer 7 | 8 | # coreos-iso-maker V2.6 9 | 10 | Many thanks to Stephen Nimmo (https://github.com/snimmo-redhat) for a Pull Request that now adds support 11 | for FULL X.Y.Z releases. This feature should allow you to specify whatever version of the CoreOS image 12 | you want (EXCEPT 4.2 due to some weird naming changes but that is about to go EOL anyway.) 13 | 14 | # coreos-iso-maker V2.5 15 | New feature! coreos-iso-maker now supports 2 NIC installs. More should be possible but you are on your own for 16 | adding that. :-) Just follow the examples. *N.B.* The _may_ be an issue with the hostname being the same for 17 | both network interfaces. If anyone notices an issue, please speak up! 18 | 19 | New in V2.4.3 20 | Thanks to https://github.com/christianh814 for a PR that now includes an `install_drive` parameter to deal with 21 | cases where the default install drive is something other than `sda` (like `vda` found in libvirt). Also note 22 | that coreos-iso-maker has support for tags if you need older versions. Current tags are v4.2 and v4.3. Support 23 | for v4.4 and later is on the horizon once I get some cycles. This version also ensures `rsync` is installed for 24 | the minimalists out there. 25 | 26 | New in V2.4.2 27 | New feature: The MULTI ISO maker now has a 10 second timeout before it autoboots the installer. This feature 28 | does NOT work on the SINGLE ISO version because of the risks associated with having it IP clashes. Thanks to 29 | Victor Sira for nudging me to add this 30 | 31 | New in V2.4.1 32 | Bug fixes and updated output to call the ignition files named based on the group. E.g. The `[masters]` group creates 33 | a `masters.ign` file to boot from, `[bootstrap]` uses the `bootstrap.ign` file. 34 | 35 | New in coreos-iso-maker V2.4 36 | This version: The `dns` variable in `group_vars/all.yml` is now a list. Because of the way DNS works 37 | do NOT specify more than 3 servers for this. Thanks to Scott Worthington (https://github.com/worsco) for pointers 38 | on how to do this. 39 | 40 | New in Version 2.3 41 | This version incorporates the ability to generate either a single ISO for OCP 4.x 42 | installations or multiple ISOs depending on needs. These ISOs are created for 43 | when you need statis IPs. 44 | 45 | New from version 2.2: Make sure that genisoimage package is installed. 46 | Special thanks to Scott Worthington (https://github.com/worsco) 47 | for this Pull Request. 48 | 49 | New in version 2.3: Enable UEFI booting by also adjusting the grub.cfg. This 50 | also fixed a long standing and unnoticed bug in previous version. Special thanks 51 | to ahmbas (https://github.com/ahmbas) for helping me find this bug and making me learn 52 | more about ISOLINUX vs. UEFI booting. 53 | 54 | -------------------------------------------------------------------------------- /group_vars/all.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # If only one network interface 3 | gateway: 192.168.1.250 4 | netmask: 255.255.255.0 5 | # VMWare default ens192 6 | # KVM default ens3 7 | # Libvirt default enp1s0 8 | # Intel NUC default eno1 9 | interface: ens192 10 | 11 | dns: 12 | - 192.168.1.20 13 | - 192.168.2.20 14 | 15 | webserver_url: 192.168.1.20 16 | webserver_port: 8080 17 | # Ignition subpath in http server (optionnal, defaults to nothing) 18 | webserver_ignition_path: /ignition 19 | # Path to download master ignition file will be 20 | # http://192.168.1.20:8080/ignition/master.ign 21 | 22 | # Drive to install RHCOS 23 | # Libvirt - can be vda 24 | install_drive: sda 25 | 26 | # Timeout for selection menu during first boot 27 | # '-1' for infinite timeout. Default '10' 28 | boot_timeout: 10 29 | 30 | # Chose the binary architecture 31 | # x86_64 or ppc64le 32 | arch: "x86_64" 33 | 34 | ocp_version: 4.6.1 35 | iso_checksum: d15bd7ae942573eece34ba9c59e110e360f15608f36e9b83ab9f2372d235bef2 36 | iso_checksum_ppc64: ff3ef20a0c4c29022f52ad932278b9040739dc48f4062411b5a3255af863c95e 37 | iso_name: rhcos-{{ ocp_version }}-x86_64-live.x86_64.iso 38 | iso_name_ppc64: rhcos-{{ ocp_version }}-ppc64le-installer.ppc64le.iso 39 | rhcos_bios: rhcos-{{ ocp_version }}-x86_64-metal.x86_64.raw.gz 40 | ... -------------------------------------------------------------------------------- /grub.cfg-multi.j2: -------------------------------------------------------------------------------- 1 | # This file is copied from 2 | # https://github.com/coreos/fedora-coreos-config 3 | 4 | function load_video { 5 | insmod efi_gop 6 | insmod efi_uga 7 | insmod video_bochs 8 | insmod video_cirrus 9 | insmod all_video 10 | } 11 | 12 | load_video 13 | set gfxpayload=keep 14 | insmod gzio 15 | insmod part_gpt 16 | insmod ext2 17 | 18 | set timeout={{ boot_timeout }} 19 | set default=0 20 | ### END /etc/grub.d/00_header ### 21 | {% set server = inventory_hostname -%} 22 | 23 | ### BEGIN /etc/grub.d/10_linux ### 24 | menuentry 'Install RHEL CoreOS {{ server }}' --class fedora --class gnu-linux --class gnu --class os { 25 | linux /images/pxeboot/vmlinuz {% include 'arguments.j2' %} 26 | initrd /images/pxeboot/initrd.img /images/ignition.img 27 | } 28 | -------------------------------------------------------------------------------- /grub.cfg-single.j2: -------------------------------------------------------------------------------- 1 | # This file is copied from 2 | # https://github.com/coreos/fedora-coreos-config 3 | 4 | function load_video { 5 | insmod efi_gop 6 | insmod efi_uga 7 | insmod video_bochs 8 | insmod video_cirrus 9 | insmod all_video 10 | } 11 | 12 | load_video 13 | set gfxpayload=keep 14 | insmod gzio 15 | insmod part_gpt 16 | insmod ext2 17 | 18 | set timeout={{ boot_timeout }} 19 | set default=0 20 | ### END /etc/grub.d/00_header ### 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | 24 | # Menu list items start here 25 | {% for server in ansible_play_hosts_all|sort %} 26 | menuentry 'Install RHEL CoreOS {{ server }}' --class fedora --class gun-lunux --class gnu --class os { 27 | linux /images/pxeboot/vmlinuz {% include 'arguments.j2' %} 28 | initrd /images/pxeboot/initrd.img /images/ignition.img 29 | } 30 | {% endfor %} 31 | -------------------------------------------------------------------------------- /inventory-multinic.yml: -------------------------------------------------------------------------------- 1 | --- 2 | all: 3 | children: 4 | bootstrap: 5 | hosts: 6 | bootstrap.example.com: 7 | ipv4: 192.168.1.1 8 | 9 | master: 10 | hosts: 11 | master1.example.com: 12 | ipv4: 192.168.1.2 13 | 14 | master2.example.com: 15 | ipv4: 192.168.1.3 16 | 17 | master3.example.com: 18 | ipv4: 192.168.1.4 19 | 20 | worker: 21 | hosts: 22 | worker1.example.com: 23 | interfaces: 24 | ens192: 25 | ipv4: 192.168.2.10 26 | mask: 255.255.255.0 27 | gtwy: 192.168.2.254 28 | ens224: 29 | ipv4: 192.168.3.10 30 | mask: 255.255.255.0 31 | gtwy: 192.168.3.254 32 | 33 | worker2.example.com: 34 | interfaces: 35 | ens192: 36 | ipv4: 192.168.2.11 37 | mask: 255.255.255.0 38 | gtwy: 192.168.2.254 39 | ens224: 40 | ipv4: 192.168.3.11 41 | mask: 255.255.255.0 42 | gtwy: 192.168.3.254 43 | ens256: 44 | ipv4: 192.168.4.11 45 | mask: 255.255.255.0 46 | gtwy: 192.168.4.254 47 | ens161: 48 | ipv4: 192.168.5.11 49 | mask: 255.255.255.0 50 | gtwy: 192.168.5.254 51 | 52 | worker3.example.com: 53 | interfaces: 54 | ens192: 55 | ipv4: 192.168.2.12 56 | mask: 255.255.255.0 57 | gtwy: 192.168.2.254 58 | ens224: 59 | ipv4: 192.168.3.12 60 | mask: 255.255.255.0 61 | gtwy: 192.168.3.254 62 | ... 63 | -------------------------------------------------------------------------------- /inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | all: 3 | children: 4 | bootstrap: 5 | hosts: 6 | bootstrap.example.com: 7 | ipv4: 192.168.1.1 8 | 9 | master: 10 | hosts: 11 | master1.example.com: 12 | ipv4: 192.168.1.2 13 | 14 | master2.example.com: 15 | ipv4: 192.168.1.3 16 | 17 | master3.example.com: 18 | ipv4: 192.168.1.4 19 | 20 | worker: 21 | hosts: 22 | worker1.example.com: 23 | ipv4: 192.168.1.10 24 | 25 | worker2.example.com: 26 | #dhcp 27 | 28 | worker3.example.com: 29 | ... 30 | -------------------------------------------------------------------------------- /isolinux.cfg-multi.j2: -------------------------------------------------------------------------------- 1 | # Note this file mostly matches the isolinux.cfg file from the Fedora 2 | # Server DVD iso. Diff this file with that file in the future to pick up 3 | # changes. 4 | serial 0 5 | default vesamenu.c32 6 | timeout {{ boot_timeout }} 7 | 8 | display boot.msg 9 | 10 | # Clear the screen when exiting the menu, instead of leaving the menu displayed. 11 | # For vesamenu, this means the graphical background is still displayed without 12 | # the menu itself for as long as the screen remains in graphics mode. 13 | menu clear 14 | menu background splash.png 15 | menu title RHEL CoreOS Installer 16 | menu vshift 8 17 | menu rows 18 18 | menu margin 8 19 | #menu hidden 20 | menu helpmsgrow 15 21 | menu tabmsgrow 13 22 | 23 | # Border Area 24 | menu color border * #00000000 #00000000 none 25 | 26 | # Selected item 27 | menu color sel 0 #ffffffff #00000000 none 28 | 29 | # Title bar 30 | menu color title 0 #ff7ba3d0 #00000000 none 31 | 32 | # Press [Tab] message 33 | menu color tabmsg 0 #ff3a6496 #00000000 none 34 | 35 | # Unselected menu item 36 | menu color unsel 0 #84b8ffff #00000000 none 37 | 38 | # Selected hotkey 39 | menu color hotsel 0 #84b8ffff #00000000 none 40 | 41 | # Unselected hotkey 42 | menu color hotkey 0 #ffffffff #00000000 none 43 | 44 | # Help text 45 | menu color help 0 #ffffffff #00000000 none 46 | 47 | # A scrollbar of some type? Not sure. 48 | menu color scrollbar 0 #ffffffff #ff355594 none 49 | 50 | # Timeout msg 51 | menu color timeout 0 #ffffffff #00000000 none 52 | menu color timeout_msg 0 #ffffffff #00000000 none 53 | 54 | # Command prompt text 55 | menu color cmdmark 0 #84b8ffff #00000000 none 56 | menu color cmdline 0 #ffffffff #00000000 none 57 | 58 | # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. 59 | 60 | menu tabmsg Press Tab for full configuration options on menu items. 61 | 62 | menu separator # insert an empty line 63 | menu separator # insert an empty line 64 | 65 | {% set server = inventory_hostname -%} 66 | 67 | label linux 68 | menu label ^Install RHEL CoreOS {{ server }} 69 | menu default 70 | kernel /images/pxeboot/vmlinuz 71 | append initrd=/images/pxeboot/initrd.img,/images/ignition.img {% include 'arguments.j2' %} 72 | 73 | menu separator # insert an empty line 74 | 75 | menu end 76 | -------------------------------------------------------------------------------- /isolinux.cfg-single.j2: -------------------------------------------------------------------------------- 1 | # Note this file mostly matches the isolinux.cfg file from the Fedora 2 | # Server DVD iso. Diff this file with that file in the future to pick up 3 | # changes. 4 | serial 0 5 | default vesamenu.c32 6 | timeout {{ boot_timeout }} 7 | 8 | display boot.msg 9 | 10 | # Clear the screen when exiting the menu, instead of leaving the menu displayed. 11 | # For vesamenu, this means the graphical background is still displayed without 12 | # the menu itself for as long as the screen remains in graphics mode. 13 | menu clear 14 | menu background splash.png 15 | menu title RHEL CoreOS Installer 16 | menu vshift 8 17 | #menu rows 18 18 | menu rows 25 19 | menu margin 8 20 | #menu hidden 21 | #menu helpmsgrow 15 22 | menu helpmsgrow -1 23 | menu tabmsgrow 13 24 | 25 | # Border Area 26 | menu color border * #00000000 #00000000 none 27 | 28 | # Selected item 29 | menu color sel 0 #ffffffff #00000000 none 30 | 31 | # Title bar 32 | menu color title 0 #ff7ba3d0 #00000000 none 33 | 34 | # Press [Tab] message 35 | menu color tabmsg 0 #ff3a6496 #00000000 none 36 | 37 | # Unselected menu item 38 | menu color unsel 0 #84b8ffff #00000000 none 39 | 40 | # Selected hotkey 41 | menu color hotsel 0 #84b8ffff #00000000 none 42 | 43 | # Unselected hotkey 44 | menu color hotkey 0 #ffffffff #00000000 none 45 | 46 | # Help text 47 | menu color help 0 #ffffffff #00000000 none 48 | 49 | # A scrollbar of some type? Not sure. 50 | menu color scrollbar 0 #ffffffff #ff355594 none 51 | 52 | # Timeout msg 53 | menu color timeout 0 #ffffffff #00000000 none 54 | menu color timeout_msg 0 #ffffffff #00000000 none 55 | 56 | # Command prompt text 57 | menu color cmdmark 0 #84b8ffff #00000000 none 58 | menu color cmdline 0 #ffffffff #00000000 none 59 | 60 | # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. 61 | 62 | menu tabmsg Press Tab for full configuration options on menu items. 63 | 64 | menu separator # insert an empty line 65 | menu separator # insert an empty line 66 | 67 | # Menu list items start here 68 | {% for server in ansible_play_hosts_all|sort %} 69 | label Linux 70 | menu label ^Install on {{ server }} 71 | kernel /images/pxeboot/vmlinuz 72 | append initrd=/images/pxeboot/initrd.img,/images/ignition.img {% include 'arguments.j2' %} 73 | {% endfor %} 74 | menu end 75 | -------------------------------------------------------------------------------- /playbook-multi.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########## 3 | - name: Check installation 4 | hosts: localhost 5 | become: true 6 | gather_facts: true 7 | 8 | tasks: 9 | - name: Ensure mkisofs and rsync is installed (Centos / RHEL) 10 | yum: 11 | name: "{{ packages }}" 12 | become: true 13 | delegate_to: localhost 14 | vars: 15 | packages: 16 | - rsync 17 | - genisoimage 18 | when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' 19 | 20 | - name: Ensure mkisofs and rsync is installed (Ubuntu / Debian) 21 | apt: 22 | name: "{{ packages }}" 23 | become: true 24 | delegate_to: localhost 25 | vars: 26 | packages: 27 | - rsync 28 | - genisoimage 29 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' 30 | 31 | ########## 32 | - name: Check the original RHCOS ISO 33 | hosts: localhost 34 | gather_facts: false 35 | 36 | tasks: 37 | - block: 38 | - name: Create the download url (ppc64le) 39 | set_fact: 40 | dl_url: 'https://mirror.openshift.com/pub/openshift-v{{ ocp_version.split(".")[0] }}/ppc64le/dependencies/rhcos/{{ ocp_version.split(".")[0] }}.{{ ocp_version.split(".")[1] }}/{{ ocp_version }}/{{ iso_name_ppc64 }}' 41 | my_iso: "{{ iso_name_ppc64 }}" 42 | my_cksum: "{{ iso_checksum_ppc64 }}" 43 | when: arch == 'ppc64le' 44 | 45 | - name: Create the download url (x86_64) 46 | set_fact: 47 | dl_url: 'https://mirror.openshift.com/pub/openshift-v{{ ocp_version.split(".")[0] }}/dependencies/rhcos/{{ ocp_version.split(".")[0] }}.{{ ocp_version.split(".")[1] }}/{{ ocp_version }}/{{ iso_name }}' 48 | my_iso: "{{ iso_name }}" 49 | my_cksum: "{{ iso_checksum }}" 50 | when: arch == 'x86_64' 51 | 52 | - name: Check if ISO is already available 53 | stat: 54 | path: /tmp/{{ my_iso }} 55 | checksum_algorithm: sha256 56 | get_checksum: yes 57 | register: iso_file 58 | 59 | - name: Get the original ISO 60 | get_url: 61 | url: "{{ dl_url }}" 62 | dest: /tmp 63 | checksum: sha256:{{ my_cksum }} 64 | when: not iso_file.stat.exists or iso_file.stat.checksum != my_cksum 65 | 66 | - name: Mount ISO 67 | mount: 68 | src: /tmp/{{ my_iso }} 69 | path: /mnt/iso 70 | fstype: iso9660 71 | opts: ro,noauto 72 | state: mounted 73 | become: true 74 | 75 | - name: Copy contents of iso 76 | synchronize: 77 | src: /mnt/iso/ 78 | dest: /tmp/rhcos-iso/ 79 | 80 | ########## 81 | - name: Create the custom iso 82 | hosts: all 83 | order: sorted 84 | serial: 1 85 | gather_facts: false 86 | 87 | tasks: 88 | - name: Generate the webserver full path 89 | set_fact: 90 | webserver_ignition_fullpath: "http://{{ webserver_url }}:{{ webserver_port }}{{ webserver_ignition_path | default('') }}/" 91 | 92 | # ppc64 93 | - block: 94 | - name: Relace the grub.cfg file (ppc64le) 95 | template: 96 | src: "grub.cfg-multi.j2" 97 | dest: /tmp/rhcos-iso/boot/grub/grub.cfg 98 | 99 | - name: Create new ISO image (ppc64le) 100 | command: > 101 | /usr/bin/mkisofs -U -A 'RHCOS-CustomIso' -V 'RHCOS-CustomIso' -volset 'RHCOS-CustomIso' -J -joliet-long -r -v -T 102 | -x ./lost+found -o /tmp/rhcos-install-{{ inventory_hostname_short }}.iso -chrp-boot . 103 | args: 104 | chdir: /tmp/rhcos-iso/ 105 | become: true 106 | delegate_to: localhost 107 | when: arch == 'ppc64le' 108 | 109 | # x86_64 110 | - block: 111 | - name: Relace the isolinux.cfg file (x86_64) 112 | template: 113 | src: "isolinux.cfg-multi.j2" 114 | dest: /tmp/rhcos-iso/isolinux/isolinux.cfg 115 | 116 | - name: Relace the grub.cfg file (x86_64) 117 | template: 118 | src: "grub.cfg-multi.j2" 119 | dest: /tmp/rhcos-iso/EFI/redhat/grub.cfg 120 | 121 | - name: Create new ISO image (x86_64) 122 | command: > 123 | /usr/bin/mkisofs -U -A 'RHCOS-CustomIso' -V 'RHCOS-CustomIso' -volset 'RHCOS-CustomIso' -J -joliet-long -r -v -T 124 | -x ./lost+found -o /tmp/rhcos-install-{{ inventory_hostname_short }}.iso -b isolinux/isolinux.bin 125 | -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img 126 | -no-emul-boot . 127 | args: 128 | chdir: /tmp/rhcos-iso/ 129 | become: true 130 | delegate_to: localhost 131 | when: arch == 'x86_64' 132 | 133 | ########## 134 | - name: Cleanup tasks 135 | hosts: localhost 136 | gather_facts: false 137 | 138 | tasks: 139 | - block: 140 | - name: Unmount ISO 141 | mount: 142 | path: /mnt/iso 143 | state: absent 144 | 145 | - name: Remove ISO copy 146 | file: 147 | path: /tmp/rhcos-iso 148 | state: absent 149 | become: true 150 | ... 151 | -------------------------------------------------------------------------------- /playbook-single.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########## 3 | - name: Check installation 4 | hosts: localhost 5 | become: true 6 | gather_facts: true 7 | 8 | tasks: 9 | - name: Ensure mkisofs and rsync is installed (Centos / RHEL) 10 | yum: 11 | name: "{{ packages }}" 12 | become: true 13 | delegate_to: localhost 14 | vars: 15 | packages: 16 | - rsync 17 | - genisoimage 18 | when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' 19 | 20 | - name: Ensure mkisofs and rsync is installed (Ubuntu / Debian) 21 | apt: 22 | name: "{{ packages }}" 23 | become: true 24 | delegate_to: localhost 25 | vars: 26 | packages: 27 | - rsync 28 | - genisoimage 29 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' 30 | 31 | ########## 32 | - name: Check the original RHCOS ISO 33 | hosts: localhost 34 | gather_facts: false 35 | 36 | tasks: 37 | - block: 38 | - name: Create the download url (ppc64le) 39 | set_fact: 40 | dl_url: 'https://mirror.openshift.com/pub/openshift-v{{ ocp_version.split(".")[0] }}/ppc64le/dependencies/rhcos/{{ ocp_version.split(".")[0] }}.{{ ocp_version.split(".")[1] }}/{{ ocp_version }}/{{ iso_name_ppc64 }}' 41 | my_iso: "{{ iso_name_ppc64 }}" 42 | my_cksum: "{{ iso_checksum_ppc64 }}" 43 | when: arch == 'ppc64le' 44 | 45 | - name: Create the download url (x86_64) 46 | set_fact: 47 | dl_url: 'https://mirror.openshift.com/pub/openshift-v{{ ocp_version.split(".")[0] }}/dependencies/rhcos/{{ ocp_version.split(".")[0] }}.{{ ocp_version.split(".")[1] }}/{{ ocp_version }}/{{ iso_name }}' 48 | my_iso: "{{ iso_name }}" 49 | my_cksum: "{{ iso_checksum }}" 50 | when: arch == 'x86_64' 51 | 52 | - name: Check if ISO is already available 53 | stat: 54 | path: /tmp/{{ my_iso }} 55 | checksum_algorithm: sha256 56 | get_checksum: yes 57 | register: iso_file 58 | 59 | - name: Get the original ISO 60 | get_url: 61 | url: "{{ dl_url }}" 62 | dest: /tmp 63 | checksum: sha256:{{ my_cksum }} 64 | when: not iso_file.stat.exists or iso_file.stat.checksum != my_cksum 65 | 66 | - name: Mount ISO 67 | mount: 68 | src: /tmp/{{ my_iso }} 69 | path: /mnt/iso 70 | fstype: iso9660 71 | opts: ro,noauto 72 | state: mounted 73 | become: true 74 | 75 | - name: Copy contents of iso 76 | synchronize: 77 | src: /mnt/iso/ 78 | dest: /tmp/rhcos-iso/ 79 | 80 | ########## 81 | - name: Create the custom iso 82 | hosts: all 83 | order: sorted 84 | gather_facts: false 85 | 86 | tasks: 87 | - name: Generate the webserver full path 88 | set_fact: 89 | webserver_ignition_fullpath: "http://{{ webserver_url }}:{{ webserver_port }}{{ webserver_ignition_path | default('') }}/" 90 | 91 | # ppc64 92 | - block: 93 | - name: Relace the grub.cfg file (ppc64le) 94 | template: 95 | src: "grub.cfg-single.j2" 96 | dest: /tmp/rhcos-iso/boot/grub/grub.cfg 97 | 98 | - name: Create new ISO image (ppc64le) 99 | command: > 100 | /usr/bin/mkisofs -U -A 'RHCOS-CustomIso' -V 'RHCOS-CustomIso' -volset 'RHCOS-CustomIso' -J -joliet-long -r -v -T 101 | -x ./lost+found -o /tmp/rhcos-install-cluster.iso -chrp-boot . 102 | args: 103 | chdir: /tmp/rhcos-iso/ 104 | become: true 105 | delegate_to: localhost 106 | when: arch == 'ppc64le' 107 | 108 | # x86_64 109 | - block: 110 | - name: Relace the isolinux.cfg file (x86_64) 111 | template: 112 | src: "isolinux.cfg-single.j2" 113 | dest: /tmp/rhcos-iso/isolinux/isolinux.cfg 114 | 115 | - name: Relace the grub.cfg file (x86_64) 116 | template: 117 | src: "grub.cfg-single.j2" 118 | dest: /tmp/rhcos-iso/EFI/redhat/grub.cfg 119 | 120 | - name: Create new ISO image (x86_64) 121 | command: > 122 | /usr/bin/mkisofs -U -A 'RHCOS-CustomIso' -V 'RHCOS-CustomIso' -volset 'RHCOS-CustomIso' -J -joliet-long -r -v -T 123 | -x ./lost+found -o /tmp/rhcos-install-cluster.iso -b isolinux/isolinux.bin 124 | -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img 125 | -no-emul-boot . 126 | args: 127 | chdir: /tmp/rhcos-iso/ 128 | become: true 129 | delegate_to: localhost 130 | when: arch == 'x86_64' 131 | 132 | ########## 133 | - name: Cleanup tasks 134 | hosts: localhost 135 | gather_facts: false 136 | 137 | tasks: 138 | - block: 139 | - name: Unmount ISO 140 | mount: 141 | path: /mnt/iso 142 | state: absent 143 | 144 | - name: Remove ISO copy 145 | file: 146 | path: /tmp/rhcos-iso 147 | state: absent 148 | become: true 149 | ... 150 | --------------------------------------------------------------------------------