forked from MT2017055/Ansible-tower-examples
-
Notifications
You must be signed in to change notification settings - Fork 2
/
simple.yml
44 lines (42 loc) · 1020 Bytes
/
simple.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
- hosts: FRONT_NIC_IP BACK_NIC_IP
remote_user: root
tasks:
- name: Stop apt-daily.* systemd services
service:
name: "{{ item }}"
state: stopped
with_items:
- unattended-upgrades
- apt-daily
- apt-daily.timer
- apt-daily-upgrade
- apt-daily-upgrade.timer
- name: Wait for automatic system updates
become: true
shell: while sudo fuser /var/lib/dpkg/{{ item }} >/dev/null 2>&1; do sleep 1; done;
with_items:
- lock
# - lock-frontend
- name: update apt cache manual
shell: apt update
args:
executable: /bin/bash
- name: update apt cache
apt:
update_cache: yes
- name: ensure nginx is at the latest version
apt:
name: nginx
state: latest
notify:
- restart nginx
- name: execute init.bash
script: ./init.bash
- name: upload execute uploaded.sh
script: ../shared/uploaded.sh
handlers:
- name: restart nginx
service:
name: nginx
state: restarted