My earlier post automate-building-your-own-atomic-host describes how to Automate building Atomic Host with Ansible. But it is not capable of customizing packages for OSTree and build Atomic host based on it.
This post includes Ansible Automation for customizing packages of OSTree and build Atomic Host. Below are the improvements on this updated post :
- Add packages to OSTree (It is suggested not to delete any pre-existing packages from the OSTree, that might break your Atomic host).
- No need to create VM from the QCOW2 image will shell script anymore, It will be now all-in-one playbook.
If you do not know about Atomic host, please refer to http://www.projectatomic.io.
- Make sure Ansible is installed on your system. If you are using Fedora workstation/any other platform, do not forget to install python2-dnf as well.
- Download Atomic QCOW2 image: Fedora-Atomic.
$ git clone https://github.com/trishnaguha/build-atomic-host.git $ cd build-atomic-host/
The following will install requirements on your system, initializes OSTree and starts HTTP server as daemon service. The OSTree is made available via web server at TCP port 35000. After running the playbook you may use
ip addr to check the IP Address of your HTTP server.
$ ansible-playbook setup.yml --ask-sudo-pass
I am going to use variables applicable for Fedora. If you are using CentOS please modify the variables based on it.
- Primary Variables.
--- # Variables for Atomic host atomicname: my-atomic # OSTree name basehost: fedora-atomic/25/x86_64/docker-host # Basehost httpserver: 192.168.122.1 # IP Address of HTTP Server
- Additional packages you would like to have in your OSTree.
# Variables for OSTree packages repo: https://pagure.io/fedora-atomic.git branch: f25 repodir: fedora-atomic abs_path: /workspace # The absolute path to the git repo. custommanifest: customized-atomic-docker-host.json # The manifest that goes into the custom host(ostree) content that we are going to build. sourcemanifest: fedora-atomic-docker-host.json # The manifest that goes into the actual Base Fedora host(ostree) content. packages: '"vim-enhanced", "git"' # Packages you want to have in your Atomic host.
Add packages like above separate by comma.
- Variables for the VM
# Variables for Creating VM domain: atomic-node # Domain name image: Fedora-Atomic-25-20170228.0.x86_64 # Image name cpu: 1 mem: 1536 os: variant: fedora23 path: /tmp # Path to QCOW2 Image
Run the main Playbook which will create VM from QCOW2 image, compose OSTree and perform SSH-Setup and Rebase on OSTree:
$ ansible-playbook main.yml --ask-sudo-pass
To Check the IP Address of the VM running:
$ sudo virsh domifaddr atomic-node
Now SSH to the Atomic host and perform Reboot so that it will reboot in to custom OSTree.
$ ssh atomic-user@IP-ADDRESS-OF-VM $ sudo systemctl reboot
SSH again and You will have your own OSTRee.
[atomic-user@atomic-node ~]$ sudo rpm-ostree status State: idle Deployments: ● my-atomic:fedora-atomic/25/x86_64/docker-host Version: 25.1 (2017-02-07 05:34:46) Commit: 15b70198b8ec7fd54271f9672578544ff03d1f61df8d7f0fa262ff7519438eb6 OSName: fedora-atomic fedora-atomic:fedora-atomic/25/x86_64/docker-host Version: 25.51 (2017-01-30 20:09:59) Commit: f294635a1dc62d9ae52151a5fa897085cac8eaa601c52e9a4bc376e9ecee11dd OSName: fedora-atomic [atomic-user@atomic-node ~]$ rpm -q git vim-enhanced git-2.9.3-2.fc25.x86_64 vim-enhanced-8.0.386-1.fc25.x86_64
If you find any bug/idea please open up issues here. Thanks.
Source From: fedoraplanet.org.
Original article title: Trishna Guha: Customize Packages for Atomic Host : Ansible Automation.
This full article can be read at: Trishna Guha: Customize Packages for Atomic Host : Ansible Automation.