I was working on Ansible Task from Level 4:Ansible facts gathering,i wrote the playbook,executed it,verifies if it worked out and it did,however when i click on the “checking” button,it fails,don’t know why.
I’ll share my work with you guys and your help will be appreciated.
- name: Do some nasty things on all my target servers
become: true
hosts: all
tasks:-
name: Create an empty file for now on all sservers
file:
path: /root/facts.txt
state: touch -
name: Add some contect to the new created file using blockinfile module
blockinfile:
path: /root/facts.txt
block: |
Ansible managed node architecture is ‘{{ansible_facts[‘architecture’]}}’ -
name: Install httpd server on all servers
yum:
name: httpd
state: latest -
name: Make sure that httpd sever is up and running
service:
name: httpd
state: started
enabled: yes -
name: Copy the created facts file into
copy:
src: /root/facts.txt
dest: /var/www/html/index.html
remote_src: true
-