mirror of
https://github.com/furyhawk/cloudy.git
synced 2026-05-24 17:06:00 +00:00
Refactor ansible hosts.yml: Remove unused ansible_become_method for hosts
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: Update APT package list and upgrade packages
|
||||||
|
# hosts: "dc00,dc01,dc02,dc03,dc04,dc05,dc09"
|
||||||
|
hosts: prod
|
||||||
|
become: true
|
||||||
|
become_method: su
|
||||||
|
|
||||||
|
vars:
|
||||||
|
ansible_user: user
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Update APT package list
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
upgrade: dist
|
||||||
|
|
||||||
|
- name: Check if a reboot is required.
|
||||||
|
stat:
|
||||||
|
path: /var/run/reboot-required
|
||||||
|
register: reboot_required_file
|
||||||
|
|
||||||
|
- name: Reboot the server (if required).
|
||||||
|
debug:
|
||||||
|
msg: "Ansible Version: {{ reboot_required_file.stdout }}"
|
||||||
|
when: reboot_required_file.stat.exists == true
|
||||||
|
|
||||||
|
- name: Remove dependencies that are no longer required.
|
||||||
|
apt:
|
||||||
|
autoremove: yes
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
backend:
|
||||||
|
hosts:
|
||||||
|
nfs:
|
||||||
|
ansible_host: 192.168.50.225
|
||||||
|
ansible_user: root
|
||||||
|
ansible_become_method: su
|
||||||
|
swarm:
|
||||||
|
ansible_host: 192.168.50.220
|
||||||
|
ansible_user: user
|
||||||
|
ansible_become_method: sudo
|
||||||
|
firewall:
|
||||||
|
ansible_host: 192.168.50.170
|
||||||
|
ansible_user: root
|
||||||
|
ansible_become_method: su
|
||||||
|
|
||||||
|
dev:
|
||||||
|
hosts:
|
||||||
|
dev302:
|
||||||
|
ansible_host: 192.168.1.10
|
||||||
+1
-1
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
## Update all packages
|
## Update all packages
|
||||||
```bash
|
```bash
|
||||||
ansible-playbook -i hosts.yml playbook.yml -K
|
ansible-playbook -i inventory playbooks/update/update-noreboot.yml -l '!dc08' -K
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user