Compare commits
No commits in common. "d30e4f067c5d5b854d478a2f507ca0e64e048a78" and "4d21ed4febe1003849ad11b50b960525dd454c28" have entirely different histories.
d30e4f067c
...
4d21ed4feb
11 changed files with 19 additions and 113 deletions
|
|
@ -1 +0,0 @@
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
|
||||||
|
|
@ -8,7 +8,6 @@ all:
|
||||||
ansible_user: truenas_admin
|
ansible_user: truenas_admin
|
||||||
network:
|
network:
|
||||||
ansible_host: 192.168.1.253
|
ansible_host: 192.168.1.253
|
||||||
ansible_port: 9
|
|
||||||
ansible_user: root
|
ansible_user: root
|
||||||
mailcow:
|
mailcow:
|
||||||
ansible_host: 192.168.1.200
|
ansible_host: 192.168.1.200
|
||||||
|
|
@ -19,9 +18,6 @@ all:
|
||||||
compute-1:
|
compute-1:
|
||||||
ansible_host: 192.168.2.3
|
ansible_host: 192.168.2.3
|
||||||
ansible_user: root
|
ansible_user: root
|
||||||
cloud:
|
|
||||||
ansible_host: 192.168.2.7
|
|
||||||
ansible_user: root
|
|
||||||
|
|
||||||
children:
|
children:
|
||||||
fedora:
|
fedora:
|
||||||
|
|
@ -31,15 +27,13 @@ all:
|
||||||
compute-1:
|
compute-1:
|
||||||
debian:
|
debian:
|
||||||
hosts:
|
hosts:
|
||||||
|
pve-R730-3GDWF82:
|
||||||
|
truenas:
|
||||||
mailcow:
|
mailcow:
|
||||||
cloud:
|
|
||||||
docker:
|
docker:
|
||||||
hosts:
|
hosts:
|
||||||
compute-0:
|
compute-0:
|
||||||
compute-1:
|
compute-1:
|
||||||
pve:
|
pve:
|
||||||
hosts:
|
hosts:
|
||||||
pve-R730-3GDWF82:
|
pve-R730-3GDWF82:
|
||||||
nas:
|
|
||||||
hosts:
|
|
||||||
truenas:
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# Required packages
|
|
||||||
### Fedora
|
|
||||||
|
|
||||||
- python3-libdnf5
|
|
||||||
```shell
|
|
||||||
dnf install python3-libdnf5
|
|
||||||
```
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
- name: update APT packages
|
|
||||||
apt:
|
|
||||||
upgrade: yes
|
|
||||||
update_cache: yes
|
|
||||||
cache_valid_time: 86400
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
- name: Upgrade all packages
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name: "*"
|
|
||||||
state: latest
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: fedora
|
|
||||||
tasks:
|
|
||||||
- name: Update fedora hosts
|
|
||||||
include_tasks: update-fedora-hosts.yaml
|
|
||||||
|
|
||||||
- hosts: debian
|
|
||||||
tasks:
|
|
||||||
- name: Update debian hosts
|
|
||||||
include_tasks: update-debian-hosts.yaml
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# Git
|
|
||||||
https://github.com/fanuelsen/ansible/tree/master/ansible-truenas-api
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
- name: Checks if there is an update available from update server.
|
|
||||||
uri:
|
|
||||||
method: POST
|
|
||||||
url: https://{{ item.ip }}/api/v2.0/update/check_available
|
|
||||||
return_content: true
|
|
||||||
validate_certs: '{{ item.validate_certs }}'
|
|
||||||
headers:
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: 'Bearer {{ item.token }}'
|
|
||||||
register: truenas_pending_updates
|
|
||||||
|
|
||||||
- name: Downloads (if not already in cache) and apply an update.
|
|
||||||
uri:
|
|
||||||
method: POST
|
|
||||||
url: https://{{ item.ip }}/api/v2.0/update/update
|
|
||||||
return_content: true
|
|
||||||
validate_certs: '{{ item.validate_certs }}'
|
|
||||||
headers:
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: 'Bearer {{ item.token }}'
|
|
||||||
when: "truenas_pending_updates.json.status == 'AVAILABLE'"
|
|
||||||
|
|
||||||
- name: Wait for update to finish.
|
|
||||||
uri:
|
|
||||||
method: POST
|
|
||||||
url: https://{{ item.ip }}/api/v2.0/update/check_available
|
|
||||||
return_content: true
|
|
||||||
validate_certs: '{{ item.validate_certs }}'
|
|
||||||
headers:
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: 'Bearer {{ item.token }}'
|
|
||||||
register: truenas_reboot_required
|
|
||||||
when: "truenas_pending_updates.json.status == 'AVAILABLE' or truenas_pending_updates.json.status == 'REBOOT_REQUIRED'"
|
|
||||||
until: "(truenas_reboot_required.json|default(dict(status=WAITING))).status == 'REBOOT_REQUIRED'"
|
|
||||||
retries: 20
|
|
||||||
delay: 30
|
|
||||||
|
|
||||||
- name: Reboot host
|
|
||||||
uri:
|
|
||||||
method: POST
|
|
||||||
url: https://{{ item.ip }}/api/v2.0/system/reboot
|
|
||||||
return_content: true
|
|
||||||
validate_certs: '{{ item.validate_certs }}'
|
|
||||||
headers:
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: 'Bearer {{ item.token }}'
|
|
||||||
when: truenas_reboot_required.json.status | default (false) == 'REBOOT_REQUIRED'
|
|
||||||
|
|
||||||
- name: Returns whether the system completed boot and is ready to use.
|
|
||||||
uri:
|
|
||||||
method: GET
|
|
||||||
url: https://{{ item.ip }}/api/v2.0/system/state
|
|
||||||
return_content: true
|
|
||||||
validate_certs: '{{ item.validate_certs }}'
|
|
||||||
headers:
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: 'Bearer {{ item.token }}'
|
|
||||||
register: truenas_system_ready
|
|
||||||
until: truenas_system_ready.content == '"READY"'
|
|
||||||
retries: 20
|
|
||||||
delay: 30
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: truenas
|
|
||||||
gather_facts: false
|
|
||||||
|
|
||||||
vars:
|
|
||||||
sites:
|
|
||||||
- ip: 192.168.3.1
|
|
||||||
token: 1-gAIQbRICSPPqM1JCsfofc8gJgLvV8SglXV2xemYzBr2rzdZvQd5J0pMYeG45Jiqx
|
|
||||||
validate_certs: false
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: update-truenas-api
|
|
||||||
include_tasks: update-truenas-tasks.yaml
|
|
||||||
loop: '{{ sites }}'
|
|
||||||
8
Playbooks/update-apt.yaml
Normal file
8
Playbooks/update-apt.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- hosts: debian
|
||||||
|
tasks:
|
||||||
|
- name: update APT packages
|
||||||
|
apt:
|
||||||
|
upgrade: yes
|
||||||
|
update_cache: yes
|
||||||
8
Playbooks/update-dnf.yaml
Normal file
8
Playbooks/update-dnf.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- hosts: fedora
|
||||||
|
tasks:
|
||||||
|
- name: Upgrade all packages
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: "*"
|
||||||
|
state: latest
|
||||||
Loading…
Add table
Add a link
Reference in a new issue