Commit 285e185f authored by nimrod's avatar nimrod
Browse files

Correct inline code block markup.

parent 193b95f2
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ Sharing Ansible modules
With Ansible you're expected to share roles with the Ansible Galaxy tool (either
through the `Ansible Galaxy hub <https://galaxy.ansible.com/>`_ or just using
straight git repositories). This works well enough (and personally I am using
``ansible-galaxy init`` to start each new role, even those that I'm not going to
:code:`ansible-galaxy init` to start each new role, even those that I'm not going to
share with the community). However, for sharing modules there is no such easy
solution, or is it?

@@ -23,9 +23,9 @@ that Ansible provides and that Python is my personal preference.
The whole stroy is really quite simple, create a seperate git repository with
the modules in it. You can put them in subdirectories and as a far as I know,
there's no restriction on the hierarchy depth. In your playbook directory create
a ``library`` directory (the Ansible default, so you can change this in
``ansible.cfg``) and create an empty ``__init__.py`` file inside that directory.
Add a git submodule inside that directory and you're done. Let's see an
a :code:`library` directory (the Ansible default, so you can change this in
:code:`ansible.cfg`) and create an empty :code:`__init__.py` file inside that
directory. Add a git submodule inside that directory and you're done. Let's see an
example

.. code:: shell
@@ -44,8 +44,8 @@ example
    git push

Really, not that complicated. The only magic (undocumented) bit is creating a
``__init__.py`` file inside the ``library`` directory, which is a shame that the
Ansible documentation doesn't cover that. If you want to see a real-life
example, checkout my `ansible-playbooks
:code:`__init__.py` file inside the :code:`library` directory, which is a 
shame that the Ansible documentation doesn't cover that. If you want to see a
real-life example, checkout my `ansible-playbooks
<https://www.shore.co.il/cgit/ansible-playbooks>`_ and `ansible-modules
<https://www.shore.co.il/cgit/ansible-modules>`_ git repos.
+5 −5
Original line number Diff line number Diff line
@@ -19,11 +19,11 @@ obvious solution was to use a nested loop, something like this:
        - all_hosts
        - '{{ item.ansible_all_ipv4_addresses }}'

However, this syntax is invalid (and other variations I tried). Using 'include'
with 'with_items' is deprecated and I didn't manage to get it to work with
registering variables as well. What I had left was programaticaly generating
a playbook, but investigating further I found that Ansible can be imported as
a Python module.
However, this syntax is invalid (and other variations I tried). Using
:code:`include` with :code:`with_items` is deprecated and I didn't manage
to get it to work with registering variables as well. What I had left was
programaticaly generating a playbook, but investigating further I found that
Ansible can be imported as a Python module.

Incorperating Ansible in Python
-------------------------------
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ and set the theme to that by adding the following to pelicanconf.py: ::

    THEME = "./pelican-mockingbird"

I've also edited base.html and article.html inside of pelican-mockingbird/templates to suite my liking. Next, let us add a new entry.
I've also edited :code:`base.html` and :code:`article.html` inside of :code:`pelican-mockingbird/templates` to suite my liking. Next, let us add a new entry.

Adding an entry
---------------
+3 −3
Original line number Diff line number Diff line
@@ -8,9 +8,9 @@ I'm doing something mildly interesting and I say to myself 'This is mildly
interesting, maybe someone else will find this mildly interesting.'. But
9 out of 10 times, what ever I'm doing has some code (when I say code I usually
mean an Ansible playbook, a shell script or something similar) accompanying.
Instead of a lengthy blog post, I publish a git repo. The repo has a README
file, the code is documented, there's a Makefile or fabfile, you can clone and
fork the repo. It's almost always better than a blog post.
Instead of a lengthy blog post, I publish a git repo. The repo has a :code:`README`
file, the code is documented, there's a :code:`Makefile` or :code:`fabfile`,
you can clone and fork the repo. It's almost always better than a blog post.

But now I have many repositories and just a few blog posts. What I'm going to do
from now on is I'll publish the git repo, but add a short post announcing the