Skip to main content

Ansible Bootstraping

Comments

14 comments

  • tsiedsma
    I'm also working on Ansible for cPanel, haven't gotten much done yet, still focused on the OS part of things first. I'd love to see what you've come up with if you're still willing to share. Do you have it on github or something? Feel free to email me, - Removed - I'll see if I run into the same issues and help you figure it out. I think you should create a github repo so others can make pull requests. I know a cPanel playbook would be useful for many.
    0
  • JonTheWong
    Hello tsiedsma, We don't currently have the project up on Github, We do plan to eventually release our files to the general public but as it stands the project is an Internal Beta. Right now the biggest issue we've faced is pre-provisioning the base SSL but i might have recently found a solution, I'm currently on vacation but i've been secretly taking some notes on my off time ;) PM me if you'd like to discuss any issues you have with Ansible. So far we have a playbook that can pre-configure the OS (Networking, Hostnames, ACL, YUM); Install cPanel + Plugins, configure EasyApache load up customizations for ERROR DOCS / SKEL / EXIM / FTP and loading of shared drives. So far everything is setting up perfectly; just need to finalize a few things and it should be ready for production. We also have a DNSonly Version running; a lot less configuration! The next step is to provision and automatically add hosts to Ansible using Openstack and Dynamic Inventories. Eventually having it resize instances that are using ~80% of resources. Just remember if you're building a playbook for cPanel the order of the plays matters; and reboots during the play are essential.
    0
  • tsiedsma
    I'm just getting started, currently focusing on regular management of cPanel servers via Ansible. CentOS, CloudLinux, CSF, CXS, rfxn.com apps and cPanel. If you're willing to share, I'd love to see what you're doing for deployment, that might make some of my research a little easier. I intend to clean up what I've got and make it public for others to use. It's amazing that there isn't anything related to cPanel and Ansible anywhere.
    0
  • JonTheWong
    I'm astonished also that nothing comes up for cPanel + Ansible, figured a lot more people would be posting about it, but i have the sneaking suspicion other admins don't want to lose their edge. As for CXS do you have any success? We use Maldet instead. I'll post up some of my scripts on Github in the coming days. here is the Temp repo for now. github.com/ZenithMediaCanada/cPanelnAnsible I have a migration to complete; so i won't be updating till the beginning of next week.
    0
  • tsiedsma
    Works for me, thank you so much. Knowledge share between hosts should be encouraged more. We all have a lot to learn from each other.
    0
  • cPanelMichael
    Hello :) I am happy to see the information sharing was helpful. Thank you for updating us with the outcome.
    0
  • JonTheWong
    Thank you cPanelMichael, I've updated the git with our DNSOnly script; i did not include our customizations. Hope this helps tsiedsma :)
    0
  • gryzli
    I'm not sure what exact you are using, but combining Ansible with cPanel Api parser script is very powerfull (by my opinion). If you have something like cpanel_api.[php|pl|....] you could set almost everything through the WHM/cPanel api and automate this inside Ansible (or whatever you use). It's pretty handy the use of /root/.accesshash for automating api calls :)
    0
  • JonTheWong
    Hello gryzli; Thanks for the info. I've been meaning to brush up on my API skills and get my head around cPanel and various other APIs we currently have access to. Do you have any examples you'd be willing to share? All our ansible configurations are based on manual commands and templates. Having them set via API would be ideal in the long term.
    0
  • gryzli
    Hi JonTheWong, I have written some "really ugly" perl script as an api parser, which could be used for both calling WHM API/Cpanel Api/ Uapi calls, with some error handling. In order to use it, you need to know few things: - What api you are going to use (cPanel, WHM, Uapi) - Which module/function - Provide the HASH with necessary parameters - Have working /root/.accesshash Keep in mind, that you will need to write/rewrite it in order to use it for your demands and cases. If this brings some interest in you, I could polish it a little bit and post it here.
    0
  • JonTheWong
    I've been playing with Ansible URI module to perform PUT/POST/GET on another API but have been slowly reading Guide to WHM API 1 - Software Development Kit - cPanel Documentation I'm looking at the JSON formats and it seems pretty forward. My only issue is that if i'm building a box from scratch using ansible, why would i really need to configure WHM via API. Would be useful for management when the box is online; or maybe after ansible finishes the base install of cPanel then send all my configurations via API assuming all of them are supported. But feel free to share what you have; and no judgement on the code. I'm definitely not a programer!
    0
  • tsiedsma
    I've updated the git with our DNSOnly script; i did not include our customizations. Hope this helps tsiedsma :)

    Looks like a good start. I've been pretty busy myself and haven't had time to really look into it. I've been working on my ongoing cPanel server management via ansible and will then work on the server deployment playbook next. Once I have things polished up a little, I intended to release it on github.
    0
  • tsiedsma
    Hey JonTheWong, did you have any luck with your challenges? Are you deploying your certificates with success? I've created a bootstrapping playbook and made it public. I'd like to encourage more of this sharing among other hosts and professionals. Here's what I have: github.com/LithiumHosting/ansible-cpanel-bootstrap My current challenges: [LIST]
  • Deploying wildcard SSL certificate for cPanel services.
  • If during the cPanel installation, ansible loses its connection or fails to connect, I need to be able to check if the install is active when re-running the playbook so it doesn't fail. I'd love some feedback and contributions. I intend to start my own thread regarding cPanel + Ansible.
  • 0
  • tsiedsma
    Hey JonTheWong, did you have any luck with your challenges? Are you deploying your certificates with success? I've created a bootstrapping playbook and made it public. I'd like to encourage more of this sharing among other hosts and professionals. Here's what I have: github.com/LithiumHosting/ansible-cpanel-bootstrap My current challenges: [LIST]
  • Deploying wildcard SSL certificate for cPanel services.
  • If during the cPanel installation, ansible loses its connection or fails to connect, I need to be able to check if the install is active when re-running the playbook so it doesn't fail. I'd love some feedback and contributions. I intend to start my own thread regarding cPanel + Ansible.

  • I figured out the SSL certificate issue, now the deployment installs SSL for all cPanel services. After more testing, I'll add it to my public Git repo. Have you given more thought to sharing more of your Playbook JonTheWong?
    0

Please sign in to leave a comment.