2021年4月11日星期日

How to gather facts after installing Python in one Ansible playbook?

I need to gather facts when executing my playbook. But the hosts have not installed Python yet.

If I gather facts first, the playbook will raise error because of lacking Python. If I install Python first, I have to set gather_facts to no.

How to gather facts after installing Python in one Ansible playbook?

Here is my playbook:

---  - hosts: all    gather_facts: yes      pre_tasks:      - name: Install Python 2.x        raw: test -e /usr/bin/python || (apt update && apt install -y python-simplejson)      tasks:      ...  
https://stackoverflow.com/questions/67052100/how-to-gather-facts-after-installing-python-in-one-ansible-playbook April 12, 2021 at 10:53AM

没有评论:

发表评论