Use open source tools (Ansible & Terraform in this case) and some scripts to call Dell EMC hardware resources (e.g. PowerEdge 14G Server) and hypervisor platforms (e.g. vSphere) for operation system initialization and application deployment.
Ansible is an open-source software
- Configure systems
- Deploy software
- Orchestrate advanced IT tasks like
- Continuous deployments
- Zero downtime rolling updates
192.168.50.40
in this case
-
Download ESXi disc image
VMware-VMvisor-Installer-6.7.0.update01-10764712.x86_64-DellEMC_Customized-A03.iso
-
Edit
/ansible/os_images/esxi/KS_CUST.CFG
, change password and IP address settings compatible your environment -
Use
UltraISO
to open ESXi disc image file, copyBOOT.CFG
KS_CUST.CFG
to ISO file root folder and replace the same name files. -
Use
UltraISO
save as new fileCust_v1_VMware-VMvisor-Installer-6.7.0.update01-DellEMC_Customized-A03
- Install Ansible
ansible 2.7.10
in this case
- Install Python
python 2.7.6
- Install Dell EMC OpenManage Python SDK
omsdk 1.2.345
- Install Dell EMC OpenManage Ansible Modules
v2.0
https://github.com/dell/dellemc-openmanage-ansible-modules
- Verify your installation
$ ansible-playbook --verion
ansible-playbook 2.7.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.6 (default, Nov 13 2018, 12:45:42) [GCC 4.8.4]
- (Optional) Using Pre-configured Docker Container
Need you already have some knowledge of Docker.
$ docker run --rm -ti nunchuk/ansible:openmanage-2.0
ansible-playbook 2.7.10
- Copy your customized ESXi disc image file to NFS shared folder
192.168.130.74
is the NFS server IP
- Verify your NFS server
$ mount 192.168.130.74:/ /mnt
$ ls /mnt
Cust_v1_VMware-VMvisor-Installer-6.7.0.update01-DellEMC_Customized-A03.iso
- Add a host group into Ansible
$ { echo '[poweredge]'; echo '192.168.50.40'; } >> /etc/ansible/hosts && cat /etc/ansible/hosts
localhost
[poweredge]
192.168.50.40
- Check the PowerEdge LifeCycle status
$ ansible-playbook dellemc_get_lcstatus.yml -v
Using /etc/ansible/ansible.cfg as config file
/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected
PLAY [Check LC Ready Status] *****************************************************************************************
TASK [Check LC Ready Status] *****************************************************************************************
ok: [192.168.50.40] => {"changed": false, "msg": {"LCReady": true, "LCStatus": "Ready"}}
PLAY RECAP ***********************************************************************************************************
192.168.50.40 : ok=1 changed=0 unreachable=0 failed=0
- Deploy ESXi by Ansible
$ ansible-playbook dellemc_deploy_os.yml -v
Using /etc/ansible/ansible.cfg as config file
/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected
PLAY [Booting to Network Operating System image] *********************************************************************
TASK [Deploy Operating System From A Remote Network Share] ***********************************************************
changed: [192.168.50.40] => {"changed": true, "msg": {"DeleteOnCompletion": "false", "InstanceID": "DCIM_OSDConcreteJob:1", "JobName": "BootToNetworkISO", "JobStatus": "Success", "Key": "<null_index>", "Message": "The command was successful.", "MessageID": "OSD1", "Name": "BootToNetworkISO", "Status": "Success", "file": "192.168.130.74://Cust_v1_VMware-VMvisor-Installer-6.7.0.update01-DellEMC_Customized-A03.iso", "retval": true}}
PLAY RECAP ***********************************************************************************************************
192.168.50.40 : ok=1 changed=1 unreachable=0 failed=0
You can monitoring the process from iDRAC web console, the Ansible will doing a installation and reboot automatically via calling Redfish API, no manual action required.
Terraform is an open-source tool
- Build, change, version infrastructure through a common config file
- One command to create, update infrastructure
- Supports many providers
- AWS, Azure, GCP, Digital Ocean
- VMware vSphere, vCloud Director
- Prerequisite:
- Ubuntu Server 14.04/16.04
- OpenSSH service with root account
- Network DHCP
- Login vCenter
v6.7
, convert preconfigured virtual machine to template. Template namedUbuntu_1604_noDocke
in this case.
- Install Terraform
Terraform v0.11.13
https://learn.hashicorp.com/terraform/getting-started/install.html
- Verify your installation
$ terraform -version
Terraform v0.11.13
- (Optional) Using Pre-configured Docker Container
Need you already have some knowledge of Docker.
$ docker run --rm -ti nunchuk/terraform:0.11.13 terraform -version
Terraform v0.11.13
- Change the parameters in
vars.tf
to your own username and password - Change the parameters in
instance.tf
to compatible with your vsphere resources
$ cd infra-as-code/terraform/ubuntu
$ terraform init
$ terraform plan \
-var 'vmcount=3'
$ terraform apply \
-var 'vmcount=3'
At this point, the vCenter will clone 3 VMs automatically.
Getting a IP address from one of the three VMs you just created. 192.168.130.69
in this case.
$ cd infra-as-code/terraform/wordpress
$ terraform init
$ terraform apply \
-var 'host=192.168.130.69'
$ terraform destroy \
-var 'host=192.168.130.69'
At this point, the Terraform will Install Docker and download the docker images then bring-up via SSH.
Open a browser to access http://192.168.130.69
For application lifecycle management, we need to maintain the consistency of the environment, the best way is to recreate the environment every time the version is updated.
$ cd infra-as-code/terraform/wordpress
$ terraform destroy \
-var 'host=192.168.130.69'
$ cd infra-as-code/terraform/ubuntu
$ terraform destroy \
-var 'vmcount=3'
- LC status is always
IN USE
after the Installation