- Deploy Cloudstack Management Server Using Ansible – Part I (MariaDB)
- Deploy Cloudstack Management Server Using Ansible – Part II (Management Server)
- Deploy Cloudstack Management Server Using Ansible – Part III (KVM Setup)
- Deploy Cloudstack Management Server Using Ansible – Part IV (Playbook)
Introduction
In this section, we’ll continue setting up cloudstack Management server role using ansible
If you haven’t done so yet, kindly consider having look at the previous section before proceeding.
Defaults
Let’s switch to the defaults folder under management role and update the main.yml as below;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
--- cs_ports_tcp: - 111 - 2020 - 2049 - 32789 - 32803 - 8080 - 54302 - 20048 - 875 - 46666 - 42955 - 80 - 892 - 662 cs_ports_udp: - 111 - 892 - 875 - 662 cs_manager_01_ip: 10.31.46.61 cs_hostname: cs-manager-01.sysadminonline.net kvm_hostname: compute-01.sysadminonline.net cs_mariadb_01_ip: 10.31.46.63 sec_nfs_ip: 10.31.46.64 sec_nfs_path: /mnt/nfs/secondary tmp_nfs_path: /mnt/nfs/secondary pri_nfs_path: /mnt/nfs/primary mysql_root_username: "root" mysql_cloud_user: "cloud" mysql_cloud_password: "pass1234" mysql_root_password: "pass1234" mysql_remote_password: "pass1234" system_vm_url: http://197.232.56.250/systemvm64template-4.10-4.10.0.0-kvm.qcow2.bz2 |
Here we are preparing the default variables we’ll be using in this role. This includes variables such as passwords, NFS mount points, MySQL usernames e.t.c
Templates
Switch to the Templates Directory of the Management Role and create a file called cloudstack.repo.j2. Add the following content to the file
1 2 3 4 5 |
[cloudstack] name=cloudstack baseurl=http://cloudstack.apt-get.eu/rhel/7/4.10/ enabled=1 gpgcheck=0 |
We’ll be using this template file in the next step to upload cloudstack repo. We could also use the file module to simply upload the file. In my case, I chose to use a template.
Tasks
Next, we’ll look at the tasks under the management server role. Switch to management directory and update the main.yml file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
--- - name: Uploading Apache Cloudstack Repo file to /etc/yum.repos.d/cloudstack.repo template: src=cloudstack.repo.j2 dest=/etc/yum.repos.d/cloudstack.repo - name: Installing CloudStack packages yum: name=cloudstack-management state=present update_cache=yes - name: Allow TCP Ports through the firewall firewalld: zone: public port: "{{ item }}/tcp" permanent: true state: enabled with_items: "{{ cs_ports_tcp }}" - name: Allow UDP Ports through the firewall firewalld: zone: public port: "{{ item }}/udp" permanent: true state: enabled with_items: "{{ cs_ports_udp }}" notify: restart firewalld - name: Downloading vdhutil Package get_url: url=http://download.cloud.com.s3.amazonaws.com/tools/vhd-util dest=/usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver/vhd-util mode=0755 - name: Create NFS Server Directories file: path: "{{ item }}" mode: 777 owner: root group: root state: directory with_items: - "{{tmp_nfs_path}}" - name: Add nfs service to the firewall firewalld: zone: public service: nfs permanent: true state: enabled immediate: true - name: Ensure secondary storage mount exists file: path: {{tmp_nfs_path}} state: directory - name: Ensure NFS storage is mounted mount: fstype: nfs name: {{tmp_nfs_path}} opts: nolock src: {{sec_nfs_ip}}:{{sec_nfs_path}} state: mounted - name: cloudstack-setup-databases command: /usr/bin/cloudstack-setup-databases -i {{ cs_manager_01_ip }} cloud:"{{ mysql_cloud_password }}"@{{ cs_mariadb_01_ip }} --deploy-as=root:{{ mysql_cloud_password }} - name: CloudStack Setup Management command: cloudstack-setup-management --tomcat7 - name: Seed secondary storage command: /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m {{ tmp_nfs_path }} -u http://197.232.56.250/systemvm64template-4.10-4.10.0.0-kvm.qcow2.bz2 -h kvm -F - name: Enable and start cloudstack Service sudo: yes service: enabled: yes name: cloudstack-management state: started |
Handlers
Switch to the handlers directory under the management role and update the main.yml with the following;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
--- #Handlers file - name: restart cloudstack service: name: cloudstack-management state: restarted - name: start nfs server systemd: name: nfs-server state: started enabled: true - name: restart firewalld systemd: name: firewalld state: restarted |
This is the end of Part II. Next we’ll look at Deploying KVM
harun
Latest posts by harun (see all)
- Linux Input/Output Redirection - May 28, 2020
- Reset Linux Root Password Using Rescue CD - September 21, 2018
- Extending Linux Root Partition using LVM - June 14, 2018