robertdebock / ansible-role-bootstrap

Prepare your system to be managed by Ansible.
https://robertdebock.nl/
Apache License 2.0
200 stars 57 forks source link

running bootstrap against centos8 fails with "The conditional check 'bootstrap_wait_for_host is boolean' failed" #44

Closed osmanburucu-ibm closed 3 years ago

osmanburucu-ibm commented 3 years ago

Describe the bug

Have used this role for a long time (last update was 6+ months before), did update today to latest version robertdebock.bootstrap, 4.3.6

Playbook

my used playbook is simple: YOUR PLAYBOOK HERE

---
- name: bootstrap all hosts
  hosts: all
  become: yes
  gather_facts: yes

  roles:
    - role: robertdebock.bootstrap
      bootstrap_user: root
---

Output

TASK [robertdebock.bootstrap : include assert.yml] ******************************************************************
included: /home/lnxadm/.ansible/roles/robertdebock.bootstrap/tasks/assert.yml for cos8e.local.net

TASK [robertdebock.bootstrap : test if bootstrap_user is set correctly] *********************************************
ok: [cos8e.local.net]

TASK [robertdebock.bootstrap : test if bootstrap_wait_for_host is set correctly] ************************************
fatal: [cos8e.local.net]: FAILED! => {"msg": "The conditional check 'bootstrap_wait_for_host is boolean' failed. The error was: template error while templating string: no test named 'boolean'. String: {% if bootstrap_wait_for_host is boolean %} True {% else %} False {% endif %}"}

Then i removed the offending lines from assert and main files:

--- assert.yml
- name: test if bootstrap_wait_for_host is set correctly
  assert:
    that:
      - bootstrap_wait_for_host is defined
 #     - bootstrap_wait_for_host is boolean
    quiet: yes
---- mail.yml   
#- name: wait for host
#  wait_for:
#    port: "{{ ansible_port | default('22') }}"
#    host: "{{ (ansible_ssh_host | default(ansible_host) | default(inventory_hostname)) }}"
#  connection: local
#  become: no
#  when:
#    - ansible_connection is defined
#    - ansible_connection not in [ "docker", "container" ]
#    - bootstrap_wait_for_host | bool

it worked then...

Environment

Please consider sponsoring me. NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8"

robertdebock commented 3 years ago

It seems is boolean requires a more up to date version of Jinja2. See #43.

Is it an option for you to update Jinja2? (Likely update Ansible and get Jinja2 update if you use pip.)

osmanburucu-ibm commented 3 years ago

Great Thank You!

It solved my problem. Was not aware of old jinja version