Skip to content

Commit

Permalink
Add name space
Browse files Browse the repository at this point in the history
  • Loading branch information
ahelal committed Mar 9, 2017
1 parent 54f52aa commit f16e2db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Ansible YUM

Simple role to patch a Redhat/Centos system and install default packages.
Simple role to patch a RHEL/Centos system and install default packages.

## Variables
```yaml
# default packages tp install comma seperated
# default packages yum install comma separated
yum_default_packages : ""

# Force update (use probably from CLI)
upgrade_now_force : False
yum_upgrade_now_force : False

# Reboot after system update
reboot_if_needed : True
upgrade_now_pause_after_reboot : 5
yum_reboot_if_needed : True
yum_upgrade_now_pause_after_reboot : 5

# SSH port to wait for instance to come back after a reboot
upgrade_now_ssh_port : "{{ ansible_port | default(22) }}"
yum_upgrade_now_ssh_port : "{{ ansible_port | default(22) }}"
```
Expand Down
8 changes: 4 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
yum_default_packages : ""

# Force update (use probably from CLI)
upgrade_now_force : False
yum_upgrade_now_force : False

# Reboot after system update
reboot_if_needed : True
upgrade_now_pause_after_reboot : 5
yum_reboot_if_needed : True
yum_upgrade_now_pause_after_reboot : 5

# SSH port to wait for instance to come back after a reboot
upgrade_now_ssh_port : "{{ ansible_port | default(22) }}"
yum_upgrade_now_ssh_port : "{{ ansible_port | default(22) }}"
8 changes: 4 additions & 4 deletions tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
- name: update | Check if first boot file exists
stat:
path="{{ upgrade_now_first_boot_file }}"
register: first_boot_stat
register: yum_first_boot_stat

- name: update | Update yum if first time or force
yum:
name: "*"
state: latest
register: yum_updated
when: not first_boot_stat.stat.exists or upgrade_now_force
when: not yum_first_boot_stat.stat.exists or yum_upgrade_now_force

- name: update | Reboot now
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
async: 1
poll: 0
when: yum_updated | changed and reboot_if_needed
when: yum_updated | changed and yum_reboot_if_needed

- name: update | Check and set if ansible_ssh_host is set
set_fact:
Expand All @@ -41,7 +41,7 @@

- name: update | pause a little to ensure everything is running
pause:
seconds="{{ upgrade_now_pause_after_reboot }}"
seconds="{{ yum_upgrade_now_pause_after_reboot }}"
when: yum_updated | changed

- name: update | Touch file guard
Expand Down

0 comments on commit f16e2db

Please sign in to comment.