[Semibug] Ansible question

Mark Moellering markmoellering at psyberation.com
Wed Jan 18 15:22:44 EST 2017


I imagine the syntax comes from Python (as opposed, say, what column
of the punchcard you are on).
It is an interesting idea, force proper indenting and other formatting
by having the formatting take the place of certain END statements.

On Wed, Jan 18, 2017 at 3:10 PM, Mike Wayne <semibug15 at wayne47.com> wrote:
> Found the answer on IRC.
>
>
> Every single example file on the web SHOULD have a comment as the
> first line:
>
> # Spaces, columns and alignment are significant in this file! (shades of 1975)
>
> The snarky comment is optional but it's been about 40 years since
> I've had to deal with a language that paid any attention to columns,
> so that never occurred to me and I want a constant reminder.
>
> Second, the example code on the site I references is invalid, you
> can not have a leading - in front of COPY (but, of course, just
> like COBOL, the error was not shown on the "-", it was on the copy,
> just to be misleading).
>
> Third, apparently, overrides for things like ansible_python_interpreter
> have to be on the SAME LINE as the server name, there is no block scope:
>
> ================================================================================
> So, in the hosts file:
>
> # This will work but don't try to line up machine names with tabs!
> [jailservers]
>    j6.domain.com ansible_python_interpreter=/usr/local/bin/python ansible_perl_interpreter=/usr/local/bin/perl
>
>
> # This will fail
> [jailservers]
>    ansible_python_interpreter=/usr/local/bin/python
>    ansible_perl_interpreter=/usr/local/bin/perl
>    j6.domain.com
>
> ================================================================================
> The final playlist that does worK:
>
> # Spaces, columns and alignment are significant in this file! (shades of 1975)
> ---
> - hosts: jailservers
>   tasks:
>     - name: Install /etc/resolv.conf and set permissions
>       copy:
>         src: <fullpath or relative path works>/Files/resolv.conf
>         dest: /etc/resolv.conf
>         owner: root
>         group: wheel
>         mode: "u=r,g=r,o=r"
>
> ================================================================================
>
> This CRIES for a preprocessor that takes readable code and lines
> everything up.
>
> _______________________________________________
> Semibug mailing list
> Semibug at lists.nycbug.org
> http://lists.nycbug.org/mailman/listinfo/semibug



More information about the Semibug mailing list