Commit 7967a7c3 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

CLEANUP: cleanup a bit the playbook and let it work with --check option

parent 50da7401
- name: Install packages using apt
- name: Install {{ package_name }} using apt
apt: name={{ package_name }} state={{ package_state }} update_cache=yes cache_valid_time=3600
when: ansible_os_family == "Debian" or ansible_os_family == "Linuxmint"
- name: Install re6stnet on CentOS
- name: Install {{ package_name }} using yum
yum: name={{ package_name }} state={{ package_state }} update_cache=yes
when: ansible_os_family == "RedHat"
---
- name: Check if configuration exists already
- name: Check if configuration already exists
stat: path=/etc/re6stnet/re6stnet.conf
register: re6stnet_conf
......@@ -25,7 +25,7 @@
shell: "re6st-conf --registry {{ re6st_registry_url }} --token {{ re6sttoken }} -r title {{ re6sttoken }} -d /etc/re6stnet"
when: re6st_annon == False and re6stnet_conf.stat.exists == False and "{{ re6sttoken }}" != "notoken" and "{{ re6st_fingerprint }}" == "nofingerprint"
- name: Check if configuration exists already
- name: Recheck if configuration already exists (after running re6st-conf)
stat: path=/etc/re6stnet/re6stnet.conf
register: recheck_re6stnet_conf
......
- name: Install packages using apt
- name: Install slapos.node using apt
apt: name=slapos-node state={{ package_state }} update_cache=yes cache_valid_time=3600
when: ansible_os_family == "Debian"
- name: Install re6stnet on CentOS
- name: Install slapos.node using yum
yum: name=slapos.node state={{ package_state }} update_cache=yes
when: ansible_os_family == "RedHat"
......
......@@ -43,6 +43,7 @@
- name: Update playbook md5
shell: echo {{ archive.stat.md5 }} > /opt/upgrader/next-upgrade-signature
when: not ansible_check_mode
- name: Stat Current Upgrade Signature
file: path=/opt/upgrader/current-upgrade-signature state=touch mode="0666"
......@@ -59,7 +60,7 @@
- name: Do upgrade
shell: ansible-playbook {{ upgrader_playbook }} -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log
when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
when: not ansible_check_mode and (upgrade_after > 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/upgrader/playbook-tmp/
......@@ -72,9 +73,9 @@
- name: Upgrade Current Upgrade Signature
shell: cat /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature
when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
when: not ansible_check_mode and (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
- shell: echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int )
when: not ansible_check_mode and (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int )
- include: remove-legacy.yml
......@@ -48,6 +48,7 @@
- name: Get systemd version
shell: systemd --version | head -n 1 | cut -d " " -f 2
register: systemd_version
check_mode: no
- file: state=directory path="/etc/systemd/system/cron.service.d/"
when: systemd_version.stdout | int > 228
......
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