Commit 0e471d42 authored by Alain Takoudjou's avatar Alain Takoudjou

playbook: fix some warning messages

parent a55deca6
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: ensure ntp is runing - name: ensure ntp is runing
service: name=ntp state=running enabled=yes service: name=ntp state=started enabled=yes
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: ensure ntp is runing (RedHat) - name: ensure ntp is runing (RedHat)
service: name=ntpd state=running enabled=yes service: name=ntpd state=started enabled=yes
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
...@@ -37,7 +37,12 @@ ...@@ -37,7 +37,12 @@
when: hostname_file.stat.exists == True when: hostname_file.stat.exists == True
- name: setting cluster - name: setting cluster
shell: wget --no-check-certificate "{{ lookup('file', '/etc/opt/cluster.hash') }}/hosts" -O /tmp/hosts uri:
url: "{{ lookup('file', '/etc/opt/cluster.hash') }}/hosts"
validate_certs: no
dest: /tmp/hosts
follow_redirects: safe
status_code: 200, 304
when: cluster_hash.stat.exists == True when: cluster_hash.stat.exists == True
- name: stat /tmp/hosts - name: stat /tmp/hosts
......
...@@ -33,18 +33,10 @@ ...@@ -33,18 +33,10 @@
register: cluster_hash register: cluster_hash
- name: get upgrade file if exists - name: get upgrade file if exists
shell: wget --no-check-certificate "{{ lookup('file', '/etc/opt/cluster.hash') }}/data" -O /etc/opt/upgrade.after uri: url="{{ lookup('file', '/etc/opt/cluster.hash') }}/data" validate_certs=no status_code=200,304 return_content=yes
when: cluster_hash.stat.exists == True when: cluster_hash.stat.exists == True
ignore_errors: True ignore_errors: True
register: upgrade_needed
- name: stat file upgrade.after
stat: path=/etc/opt/upgrade.after
register: upgrade_set
- name: check if the plabook should be upgraded
shell: cat /etc/opt/upgrade.after
register: upgrade_time
when: upgrade_set.stat.exists == True
- include: network.yml - include: network.yml
- include: hostname.yml - include: hostname.yml
...@@ -61,5 +53,5 @@ ...@@ -61,5 +53,5 @@
- shell: echo 1 > /opt/upgrader/last-upgrade - shell: echo 1 > /opt/upgrader/last-upgrade
when: last_upgrade.stat.exists == False when: last_upgrade.stat.exists == False
- include: upgrader.yml upgrade_after={{ upgrade_time.stdout }} - include: upgrader.yml upgrade_after={{ upgrade_needed.content }}
when: upgrade_set.stat.exists == True and (upgrade_time.stdout|int > lookup('file', '/opt/upgrader/last-upgrade')|int) when: upgrade_needed.status in [200, 304] and (upgrade_needed.content|int > lookup('file', '/opt/upgrader/last-upgrade')|int)
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
- file: path=/opt/upgrader/ state=directory mode=0755 - file: path=/opt/upgrader/ state=directory mode=0755
- shell: rm -rf /opt/upgrader/playbook/ - file: path=/opt/upgrader/playbook/ state=absent
- shell: rm -rf /opt/upgrader/archive.tar.gz - file: path=/opt/upgrader/archive.tar.gz state=absent
- shell: mkdir -p /opt/upgrader/playbook - file: path=/opt/upgrader/playbook state=directory mode=0755
- name: Download the latest playbook - name: Download the latest playbook
shell: slapcache-download --destination=/opt/upgrader/archive.tar.gz shell: slapcache-download --destination=/opt/upgrader/archive.tar.gz
...@@ -30,10 +30,8 @@ ...@@ -30,10 +30,8 @@
when: current_upgrade_signature.stat.exists == False when: current_upgrade_signature.stat.exists == False
- name: Copy slapos.playbook - name: Copy slapos.playbook
shell: tar -xzvf /opt/upgrader/archive.tar.gz unarchive: src=/opt/upgrader/archive.tar.gz dest=/opt/slapos.playbook
when: (upgrade_after|int > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature')) when: (upgrade_after|int > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
args:
chdir: /opt/slapos.playbook
- name: Upgrade Current Upgrade Signature - name: Upgrade Current Upgrade Signature
shell: echo /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature && echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade shell: echo /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature && echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment