Hi, all!
There is result of execute my playbook:
ansible-playbook test.yml
PLAY [ldap] ********************************************************************
…
TASK [freeipa-ds389d : Check if FreeIPA is configured] *************************
skipping: [ds389.example.com]
ok: [freeipa.example.com]
TASK [freeipa-ds389d : Setup FreeIPA Server] ***********************************
fatal: [freeipa.example.com]: FAILED! => {“failed”: true, “msg”: “The conditional check ‘freeipa_ipaconf.state.exist == False and inventory_hostname == freeipa’ failed. The error was: error while evaluating conditional (freeipa_ipaconf.state.exist == False and inventory_hostname == freeipa): ‘dict object’ has no attribute ‘state’\n\nThe error appears to have been in ‘/root/new/freeipa-ds389d/tasks/main.yml’: line 41, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Setup FreeIPA Server\n ^ here\n”}
fatal: [ds389.example.com]: FAILED! => {“failed”: true, “msg”: “The conditional check ‘freeipa_ipaconf.state.exist == False and inventory_hostname == freeipa’ failed. The error was: error while evaluating conditional (freeipa_ipaconf.state.exist == False and inventory_hostname == freeipa): ‘dict object’ has no attribute ‘state’\n\nThe error appears to have been in ‘/root/new/freeipa-ds389d/tasks/main.yml’: line 41, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Setup FreeIPA Server\n ^ here\n”}
NO MORE HOSTS LEFT *************************************************************
[WARNING]: Could not create retry file ‘test.retry’. [Errno 2] No such file or directory: ‘’
PLAY RECAP *********************************************************************
ds389.example.com : ok=3 changed=0 unreachable=0 failed=1
freeipa.example.com : ok=5 changed=0 unreachable=0 failed=1
And there is a ansible script:
-
name: Check if FreeIPA is configured
tags: -
setup
-
freeipa
register: freeipa_ipaconf
always_run: true
stat:
path: /etc/ipa/default.conf
when: inventory_hostname == freeipa -
name: Setup FreeIPA Server
tags: -
setup
-
freeipa
become: true
when: freeipa_ipaconf.state.exist == False and inventory_hostname == freeipa
command: >
{{ freeipa_install_command }}
{{ freeipa_setup_options }}
Can you help me resolve this issue?