Add apt upgrade w/ reboot
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c2601b10f1
commit
51b708a5cd
@ -3,5 +3,6 @@
|
||||
remote_user: root
|
||||
gather_facts: false
|
||||
roles:
|
||||
- common
|
||||
- dockerhost
|
||||
- mediaserver
|
||||
|
20
roles/common/tasks/main.yml
Normal file
20
roles/common/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
- name: Upgrade all packages
|
||||
ansible.builtin.apt:
|
||||
name: "*"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
|
||||
- name: Check if a reboot is needed
|
||||
ansible.builtin.stat:
|
||||
path: /var/run/reboot-required
|
||||
get_checksum: no
|
||||
register: rebootrequired
|
||||
|
||||
- name: Trigger reboot
|
||||
ansible.builtin.reboot:
|
||||
msg: "Reboot initiated by Ansible due to kernel updates"
|
||||
reboot_timeout: 300
|
||||
pre_reboot_delay: 0
|
||||
post_reboot_delay: 30
|
||||
test_command: uptime
|
||||
when: rebootrequired.stat.exists
|
@ -1,5 +1,5 @@
|
||||
- name: Remove undesired packages
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- containerd
|
||||
- docker
|
||||
@ -12,7 +12,7 @@
|
||||
purge: yes
|
||||
|
||||
- name: Install prereqs for custom apt repository over https
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
name:
|
||||
- apt-transport-https
|
||||
@ -23,17 +23,17 @@
|
||||
state: present
|
||||
|
||||
- name: Add Docker repo key
|
||||
apt_key:
|
||||
ansible.builtin.apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||
state: present
|
||||
|
||||
- name: Determine Ubuntu distribution name
|
||||
command: lsb_release -cs
|
||||
ansible.builtin.command: lsb_release -cs
|
||||
register: releasename
|
||||
|
||||
- name: Add Docker apt repository
|
||||
apt_repository:
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ releasename.stdout }} stable
|
||||
state: present
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
# Pin-Priority: 1001
|
||||
|
||||
- name: Install Docker engine
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
allow_unauthenticated: yes
|
||||
name:
|
||||
@ -70,12 +70,12 @@
|
||||
state: latest
|
||||
|
||||
- name: Install Docker Compose
|
||||
get_url:
|
||||
ansible.builtin.get_url:
|
||||
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
|
||||
dest: /usr/local/bin/docker-compose
|
||||
mode: '0755'
|
||||
|
||||
- name: Add Docker Compose to path
|
||||
command: ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||
ansible.builtin.command: ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||
args:
|
||||
creates: /usr/bin/docker-compose
|
||||
|
Loading…
Reference in New Issue
Block a user