debian ansible playbook #2

This commit is contained in:
CaptainArk 2016-01-31 15:29:10 +01:00
parent f979d04171
commit 189b9b311d

View File

@ -1,4 +1,4 @@
Title: Update Debian with Ansible
Title: Debian updates with Ansible
Date: 2016-01-31
Category: Ansible Playbook
@ -8,7 +8,7 @@ I've recently bought a [HP Proliant Microserver Gen8](http://www8.hp.com/us/en/p
From the 4 Debian machines I had to keep up-to-date, I now have 7, so it became quite time-consumming to manually SSH to each of them whenever an update became available.
I ended up looking at [Ansible](http://www.ansible.com/) to speed up the process and, within an hour, I had a working playbook that updates the debian packages, pip packages and git repos on all of my servers with a single command.
I ended up looking at [Ansible](http://www.ansible.com/) to speed up the process and, within an hour, I had a working playbook that updates the debian packages, pip packages and git repos installed on all of my servers with a single command.
I figured I'd share the playbook I use to update the Debian packages !
@ -16,7 +16,7 @@ I figured I'd share the playbook I use to update the Debian packages !
I modified [this gist](https://gist.github.com/maethor/380676f6b1cec8cc7439) to only use apt-get instead of both apt-get and aptitude.
```yaml
```yml
- hosts: all
remote_user: admin
become: yes
@ -33,6 +33,7 @@ I modified [this gist](https://gist.github.com/maethor/380676f6b1cec8cc7439) to
when: (updates.stdout_lines)
- name: upgrade packages
apt: upgrade=dist
when: (updates.stdout_lines)
- name: check what the new version is
shell: lsb_release -r | awk '{print $2}'
changed_when: False