Commit 34e7d4b2 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Revert "vm-boostrap playbook: skip some tasks when playbook is well configured"

This reverts commit 910d2148.

Actually, we will simply stop executing the playbook totally after it is
well configured.
parent 8d96b744
...@@ -6,12 +6,8 @@ ...@@ -6,12 +6,8 @@
- name: Get mounted disk list - name: Get mounted disk list
script: roles/vm-bootstrap/files/mounted_disk script: roles/vm-bootstrap/files/mounted_disk
register: vd_list register: vd_list
- name: resgister completed variable
stat: path=/etc/opt/vm-bootstrap-completed
register: ansible_completed
vars: vars:
is_playbook_ok: "{{ ansible_completed.stat.exists }}"
logrotate_args: logrotate_args:
- name: vm-bootstrap - name: vm-bootstrap
path: /var/log/vm-bootstrap.log path: /var/log/vm-bootstrap.log
...@@ -38,10 +34,4 @@ ...@@ -38,10 +34,4 @@
- { role: vm-disks, vd_disk: k, data_n: 10, when: vd_list.stdout.find("vdk") != -1 } - { role: vm-disks, vd_disk: k, data_n: 10, when: vd_list.stdout.find("vdk") != -1 }
- role: logrotate - role: logrotate
logrotate_scripts: "{{ logrotate_args }}" logrotate_scripts: "{{ logrotate_args }}"
when: ansible_completed.stat.exists == False
tasks:
- name: Set tasks complete
file: path=/etc/opt/vm-bootstrap-completed state=touch
when: ansible_completed.stat.exists == False
changed_when: false
- include: uploadlog.yml - include: uploadlog.yml
when: is_playbook_ok in [False, "False"]
- include: rerun.yml - include: rerun.yml
when: is_playbook_ok in [False, "False"]
- name: Create /etc/opt dir - name: Create /etc/opt dir
file: dest=/etc/opt mode=775 state=directory file: dest=/etc/opt mode=775 state=directory
......
...@@ -9,4 +9,3 @@ ...@@ -9,4 +9,3 @@
- name: Delete nameserver 8.8.8.8 - name: Delete nameserver 8.8.8.8
lineinfile: dest=/etc/resolv.conf line="nameserver 8.8.8.8" state=absent lineinfile: dest=/etc/resolv.conf line="nameserver 8.8.8.8" state=absent
when: is_playbook_ok in [False, "False"]
...@@ -50,12 +50,11 @@ ...@@ -50,12 +50,11 @@
register: permitrootlogin register: permitrootlogin
ignore_errors: True ignore_errors: True
changed_when: False changed_when: False
when: is_playbook_ok in [False, "False"]
- name: update /etc/ssh/sshd_config - name: update /etc/ssh/sshd_config
lineinfile: dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (.*)" line="PermitRootLogin no" state=present lineinfile: dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (.*)" line="PermitRootLogin no" state=present
notify: notify:
- restart ssh - restart ssh
- restart sshd - restart sshd
when: is_playbook_ok in [False, "False"] and permitrootlogin.rc != 0 when: permitrootlogin.rc != 0
--- ---
- name: Remove playbook completed file
file: path=/etc/opt/vm-bootstrap-completed state=absent
- file: path=/opt/upgrader state=directory mode=0755 - file: path=/opt/upgrader state=directory mode=0755
- stat: path=/opt/upgrader/current-upgrade-signature - stat: path=/opt/upgrader/current-upgrade-signature
......
...@@ -27,4 +27,3 @@ ...@@ -27,4 +27,3 @@
with_items: with_items:
- slapos - slapos
- nexedi - nexedi
when: is_playbook_ok in [False, "False"]
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