Tendrl / tendrl-ansible

Ansible playbook for Tendrl!
GNU Lesser General Public License v2.1
1 stars 15 forks source link

compatibility with ansible 2.7 #124

Closed mbukatov closed 6 years ago

mbukatov commented 6 years ago

Since ansible 2.7, it's no longer possible to use list of strings as a value for msg option of assert task.

See eg. what we are using in prechecks playbook:

    - name: Abort the playbook if python dns is not installed
      assert:
        that:
          - python2_c_import_dns.rc == 0
        msg:
          - "This playbook uses dig lookup module[1], which requires python"
          - "dns module[2] installed[3] on ansible control machine (the"
          - "machine where you run this ansible playbook from)."
          - "[1] https://docs.ansible.com/ansible/latest/playbooks_lookups.html#the-dns-lookup-dig"
          - "[2] http://www.dnspython.org/"
          - "[3] Fedora package: python2-dns, RHEL 7 package: python-dns"

When run with ansible 2.7, it fails on:

TASK [Abort the playbook if python dns is not installed] ***************************************************************
fatal: [localhost]: FAILED! => {"msg": "Incorrect type for fail_msg or msg, expected string and got <type 'list'>"}

Additional Details

Ansible 2.7 was released on Oct 4 2018, and it still waits to reach Fedora or EPEL (at the time of reporting this issue).

mbukatov commented 6 years ago

This is related to assert tasks only, eg. debug module can still handle list of strings as a value for msg option with ansible 2.7:

- hosts: localhost
  connection: local
  tasks:

    - debug:
        msg:
          - "Using as etcd fqdn in tendrl config files."
          - "Using as etcd ip address in etcd config file."
          - "Using as graphite fqdn in tendrl config files."
ok: [localhost] => {
    "msg": [
        "Using as etcd fqdn in tendrl config files.", 
        "Using as etcd ip address in etcd config file.", 
        "Using as graphite fqdn in tendrl config files."
    ]
}
mbukatov commented 6 years ago

fixed by https://github.com/Tendrl/tendrl-ansible/pull/125