SOLVED Ansible play for updating FreeNAS

Tekz

Dabbler
Joined
May 28, 2016
Messages
12
This thread was initially a different question. I am updating it and the post below to show the Ansible play I've built to manage FreeNAS updates.
 
Last edited:

Tekz

Dabbler
Joined
May 28, 2016
Messages
12
Edit: Here's the latest version of my Ansible playbook to update FreeNAS using 'freenas-update'

Code:
---
- hosts: freenas
  remote_user: root
  vars:
	ansible_python_interpreter: /usr/local/bin/python

  tasks:
  - name: check packages for updates
	shell: freenas-update -v check
	register: updates
	failed_when: "updates.rc != 1"
	changed_when: false
	ignore_errors: yes

  - when: "updates.stdout != 'No updates available'"
	block:
	  - name: update server
		shell: freenas-update --reboot update

	  - name: wait for server to update and reboot
		wait_for_connection:
		  timeout: 600
		  delay: 120
		register: reboot_result

	  - name: reboot time
		debug:
		  msg: "The system updated and rebooted in {{ reboot_result.elapsed }} seconds."


 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
If there are any other Ansible plays that you have for FreeNAS, and you are willing to share, I am sure there are folks on the forum that would be happy to know more.
 
Top