Getting started with Ansible2?

dreamcompute

#1

Still a noob with DreamCompute, after manually setting up a couple instances, I know that moving forward I’d rather script them. @smaffulli said he uses the popular Ansible tool, so that’s where I’m heading. Before I get started, is there a “getting started with Ansible on DreamCompute” doc?

I will go through tutorials and read whatever I can find but so far I’m not finding “meaty” information on using Ansible. I’m hoping someone can refer me to a resource (books, forums, videos, blogs, etc) for self-education with Ansible, that increases in complexity to explain how to approach more complex tasks.

I’ll be setting up and configuring WordPress with plugins and a number of database-side details. Installing PHP and Apache2 and related modules. … common LAMP stuff. I’ll also install Minecraft, and have other things I’d like to do - so my goal is to really understand the tools so that I can use them effectively.

Thanks!


#2

I would suggest to start from Getting Started with Ansible:

Once you get the basic principles, head to the Ansible-related articles on the Knowledge Base. In particular, this one.

For Minecraft, there is a quick tutorial on how to deploy the server on DreamCompute on the blog:

Don’t forget to publish your Ansible playbook as #howto :slight_smile: . If you have more questions please don’t hesitate to ask.


#3

Thanks bud. I had Minecraft fully running and accessible in the instance I recently locked myself out of. No loss, was a copy of another environment.

I aspire to getting to the point where I can publish Ansible HowTo’s. Getting there.
(BTW, I haven’t forgotten my other DC Intro article. Wanted to do some hands-on research before publishing, and here we are…)

Related to Ansible, I thought I could add some shell lines in the configuration section of the new launch definition. I was puzzled that it didn’t work as expected at all. For example, I started with the following lines to eliminate some startup errors:

sudo echo "127.0.0.1 test04" > /tmp/temp_hosts
sudo cp /etc/hosts >> /tmp/temp_hosts
sudo cp /tmp/temp_hosts > /etc/hosts

And that resulted in this erorr during startup:

init.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: ‘b’sudo echo "127.0.0.1 tes’…’

This led to “hey, I should try Ansible”. :wink:

What am I missing about that configuration section with a new instance?

(I wrote the above days ago but somehow the response was held in a Discuss buffer, weird. Continuing…)

I’ve spent the last several days entrenched in Ansible. You’ve created a monster. There are thousands of modules and custom roles and playbooks. I believe the appropriate course of action is to build a server manually, noting every required command, then find the Ansible equivalent. After going through the required pain to manually create my own playbook to get everything just right (with a new LAMP server or Minecraft as examples), I’m sure I’ll find some playbook that someone’s already published, making my manual effort somewhat obsolete. Is that the pattern or am I missing something about using these tools more effectively?:slight_smile:

Thanks.


#4

I was confused like you at first :slight_smile:… you need to follow the cloudinit syntax, which is documented on RTD. There is an example on how to write arbitrary files.

What you’re doing sounds quite right: learn how to do things ‘manually’ then automate them. Happy hacking! :slight_smile:


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.