[Semibug] Ansible question

Mike Wayne semibug15 at wayne47.com
Wed Jan 18 15:10:41 EST 2017


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.



More information about the Semibug mailing list