Table of Contents generated with DocToc
This repository contains a set of interactive documents for learning ansible.
These are neatly packaged, self-contained HTML files bearing the .hta file extension, which elevates the documents to full-blown applications on the Windows platform.
As such, these documents are meant to be executed from a Windows host, but you can simply rename the document(s) to .html for viewing content on non-Windows operating systems.
Of course, you can use whatever file extension of your choosing when rebuilding the document(s).
Added Bonus: With the files renamed/built as .html you can drop these on a web server and leverage the same level of access granted to the .hta's so long as you are accessing them via Internet Explorer (with ActiveX enabled).
In Lab 1, you will make use of Vagrant for setting up a localized lab for a hands-on ansible learning experience.
Here's what's covered:
- What is ansible?
- How to install Ansible on Windows/Linux/MacOS
- What is Vagrant?
- How to prepare a test environment for Ansible using Vagrant
For your convenience, I've generated Lab 1 as both a .hta and a .html.
Simply right click either of the below links, choose Save link as and launch:
If you want to make changes to the content and rebuild the documents, you'll need to install some requirements:
- optional:
- python 2.7+ (only if you plan on installing pandoc python module, i.e.
pip install pandoc
) - cmder(full version is best, as it ships with git-bash)
- python 2.7+ (only if you plan on installing pandoc python module, i.e.
- mandatory:
Again, to build the document, you'll need to grab a copy of bert.docs, as this project utilizes objects from that codebase.
The build.sh/build.bat pandoc/pp wrapper scripts output a single .hta file as per specification.
Supposing you downloaded/cloned bert.docs to a folder named git under your HOME folder (e.g. C:\Users\MyUserName), invoking the build script can be done as follows:
- From a cmd or powershell terminal
&$HOME\git\bert.docs\build.bat -s lab1\ansible-lab1.markdown -o lab1\ansible-lab1.hta -r $HOME\git\bert.docs -t lab1\templates\ansible-lab1.html -c $HOME\git\bert.docs\_common\templates\default.css -H $HOME\git\bert.docs\_common\templates\header.html -p provisioners_rb_url='https:\\github.com\berttejeda\vagrant-venv\blob\master\lib\provision.rb' -p git_url=https:\\github.com\berttejeda\vagrant-venv.git -p vagrant_lab=$HOME\git\github\bert.docs.ansible\lab1\includes\vagrant.lab.md -p vagrant_machine=web01.contoso.com -p vagrant_group=web-servers -p VERSION_STRING=YY.MM.DD.NN -V VERSION_STRING=YY.MM.DD.NN
- To issue a dry run, simply include the
--dry
flag when you call the build script- Invoking the commands above with the
--dry
flag will display something similar to:
&C:\ProgramData\chocolatey\bin\pp.exe -D provisioners_rb_url=https:\\github.com\berttejeda\vagrant-venv\blob\master\lib\provision.rb -D git_url=https:\\github.com\berttejeda\vagrant-venv.git -D vagrant_lab=C:\Users\MyUserName\git\bert.docs.ansible\lab1\includes\vagrant.lab.md -D vagrant_machine=web01.contoso.com -D vagrant_group=web-servers -D VERSION_STRING=YY.MM.DD.NN lab1\ansible-lab1.markdown | C:\ProgramData\chocolatey\bin\pandoc.exe -o 'lab1\ansible-lab1.hta' -c 'C:\Users\MyUserName\git\self\bert.docs\_common\templates\default.css' -H 'C:\Users\MyUserName\git\self\bert.docs\_common\templates\header.html' --template lab1\templates\ansible-lab1.html -V docroot=C:\Users\MyUserName\git\self\bert.docs -V VERSION_STRING=YY.MM.DD.NN --self-contained --standalone
- Invoking the commands above with the
- From git-bash/cmder/cygwin, etc
~/git/bert.docs/build.sh -s lab1/ansible-lab1.markdown -o lab1/ansible-lab1.hta -r ~/git/bert.docs -t lab1/templates/ansible-lab1.html -c ~/git/bert.docs/_common/templates/default.css - H ~/git/bert.docs/_common/templates/header.html -p provisioners_rb_url='https://github.com/berttejeda/vagrant-venv/blob/master/lib/provision.rb' -p git_url=https://github.com/berttejeda/vagrant-venv.git -p vagrant_lab=~/git/github/bert.docs.ansible/lab1/includes/vagrant.lab.md -p vagrant_machine=web01.contoso.com -p vagrant_group=web-servers -p VERSION_STRING=YY.MM.DD.NN -V VERSION_STRING=YY.MM.DD.NN
- Invoking the commands above with the
--dry
flag will display something similar to:
pp -D provisioners_rb_url=https://github.com/berttejeda/vagrant-venv/blob/master/lib/provision.rb -D git_url=https://github.com/berttejeda/vagrant-venv.git -D vagrant_lab=/c/Users/MyUserName/git/github/bert.docs.ansible/lab1/includes/vagrant.lab.md -D vagrant_machine=web01.contoso.com -D vagrant_group=web-servers -D VERSION_STRING=YY.MM.DD.NN lab1/ansible-lab1.markdown | pandoc -o 'lab1/ansible-lab1.hta' -c '/c/Users/MyUserName/git/self/bert.docs/_common/templates/default.css' -H '/c/Users/MyUserName/git/self/bert.docs/_common/templates/header.html' --template lab1/templates/ansible-lab1.html -V docroot=/c/Users/MyUserName/git/self/bert.docs -V VERSION_STRING=YY.MM.DD.NN --self-contained --standalone
- Lastly, the bash-based build script includes a poor man's filewatcher which utilizes the
find
command to monitor file changes and trigger a rebuild based on specified parameters, e.g.
~/git/bert.docs/build.sh -s lab1/ansible-lab1.markdown -o lab1/ansible-lab1.hta -r ~/git/bert.docs -t lab1/templates/ansible-lab1.html -c ~/git/bert.docs/_common/templates/default.css - H ~/git/bert.docs/_common/templates/header.html -p provisioners_rb_url='https://github.com/berttejeda/vagrant-venv/blob/master/lib/provision.rb' -p git_url=https://github.com/berttejeda/vagrant-venv.git -p vagrant_lab=~/git/github/bert.docs.ansible/lab1/includes/vagrant.lab.md -p vagrant_machine=web01.contoso.com -p vagrant_group=web-servers -p VERSION_STRING=YY.MM.DD.NN -V VERSION_STRING=YY.MM.DD.NN -w *.md,*.js,*.css,*.html -i 5
- The above command will watch for relevant file changes at 5-second intervals
- Invoking the commands above with the