Joost Try:
python -c 'import yaml,sys;yaml.safe_load(sys.stdin)' < ansible/playbooks/apt/sssdconfig.yml Valid Yaml is not hard but you can add a post commit hook like the above to validate the yaml for you. On Tue, Mar 14, 2017 at 10:35 AM, Joost Ringoot <[email protected]> wrote: > > But Hello, > > I have this playbook,... that used to work in a previous version of ansible, I swear it did: > > cat ansible/playbooks/apt/sssdconfig.yml > --- > - hosts: "{{hosts}}" > # accelerate: true > remote_user: root > tasks: > - name: install auth-client-config > apt: name=auth-client-config state=installed > - name: install sssd client > apt: name=sssd state=installed > - name: install ldap pam module > apt: name=libpam-ldap state=installed > - name: configure authentication > command: /usr/sbin/auth-client-config --enablesssd --enablesssdauth --enablelocauthorize --enablepamaccess --enablemkhomedir --update > - name: make sure the config directory is present ( workaround for a bug in sssd package) > command: /bin/mkdir -p /etc/sssd > - name: use a template sssd.conf > copy: src=/home/florence/ansible/files/sssd.conf dest=/etc/sssd > - name: ensure correct acl for the sssd directory > file: path=/etc/sssd mode=0600 > - name: ensure correct acl for the sssd.conf file > file: path=/etc/sssd/sssd.conf mode=0600 > - name: restart sssd > service: name=sssd enabled=yes state=restarted > > But now this happens: > > ansible-playbook /home/florence/ansible/playbooks/apt/sssdconfig.yml -e cal-30 > ERROR! the field 'hosts' has an invalid value, which appears to include a variable that is undefined. The error was: 'hosts' is undefined > > The error appears to have been in '/home/florence/ansible/playbooks/apt/sssdconfig.yml': line 2, column 3, but may > be elsewhere in the file depending on the exact syntax problem. > > The offending line appears to be: > > --- > - hosts: "{{hosts}}" > ^ here > We could be wrong, but this one looks like it might be an issue with > missing quotes. Always quote template expression brackets when they > start a value. For instance: > > with_items: > - {{ foo }} > > Should be written as: > > with_items: > - "{{ foo }}" > > > This is the version of ansible I use > > ansible-playbook --version > ansible-playbook 2.2.1.0 > config file = /etc/ansible/ansible.cfg > configured module search path = ['/usr/share/ansible,/opt/ansible/lib'] > > This is the version of the server: > > cat /etc/*release > NAME="Red Hat Enterprise Linux Server" > VERSION="7.2 (Maipo)" > ID="rhel" > ID_LIKE="fedora" > VERSION_ID="7.2" > PRETTY_NAME="Red Hat Enterprise Linux Server 7.2 (Maipo)" > ANSI_COLOR="0;31" > CPE_NAME="cpe:/o:redhat:enterprise_linux:7.2:GA:server" > HOME_URL="https://www.redhat.com/" > BUG_REPORT_URL="https://bugzilla.redhat.com/" > > REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7" > REDHAT_BUGZILLA_PRODUCT_VERSION=7.2 > REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" > REDHAT_SUPPORT_PRODUCT_VERSION="7.2" > Red Hat Enterprise Linux Server release 7.2 (Maipo) > Red Hat Enterprise Linux Server release 7.2 (Maipo) > > > Thanks, > > Joost > > -- > You received this message because you are subscribed to the Google Groups "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4c74d755-dedb-434e-a22e-90a645bc2ab1%40googlegroups.com . > For more options, visit https://groups.google.com/d/optout. -- - Andrew "lathama" Latham - -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2Bqj4S-3C9ogcH_Ur8ZP%3DioTczqH8%3Dp5q4ZBO%3DiaXUZ21pRbKg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
