mirror of
https://github.com/roles-ansible/ansible_role_sway.git
synced 2024-08-16 13:49:49 +02:00
Update versionscheck
This commit is contained in:
parent
4f37825225
commit
edea265ca4
2 changed files with 33 additions and 6 deletions
|
@ -2,19 +2,27 @@
|
||||||
- name: Create directory for versionscheck
|
- name: Create directory for versionscheck
|
||||||
become: true
|
become: true
|
||||||
file:
|
file:
|
||||||
path: '/etc/ansible-version'
|
path: '/etc/.ansible-version'
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
|
|
||||||
|
- name: check legacy playbook version
|
||||||
|
become: true
|
||||||
|
slurp:
|
||||||
|
src: "/etc/ansible-version/{{ playbook_version_path }}"
|
||||||
|
register: legacy_playbook_version
|
||||||
|
when: submodules_versioncheck|bool
|
||||||
|
ignore_errors: yes
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
- name: check playbook version
|
- name: check playbook version
|
||||||
become: true
|
become: true
|
||||||
slurp:
|
slurp:
|
||||||
src: "{{ playbook_version_path }}"
|
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
register: playbook_version
|
register: playbook_version
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Print remote role version
|
- name: Print remote role version
|
||||||
debug:
|
debug:
|
||||||
|
@ -31,10 +39,29 @@
|
||||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||||
when:
|
when:
|
||||||
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
||||||
|
- legacy_playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
||||||
|
|
||||||
|
- name: delete legacy version if needed
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: "/etc/ansible-version/{{ playbook_version_path }}"
|
||||||
|
|
||||||
|
- name: check if '/etc/ansible-version/' is empty
|
||||||
|
find:
|
||||||
|
paths: '/etc/ansible-version/'
|
||||||
|
register: filesFound
|
||||||
|
|
||||||
|
- name: delete legacy version folder if needed
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: "/etc/ansible-version"
|
||||||
|
when: filesFound.matched < 0
|
||||||
|
|
||||||
- name: write new version to remote disk
|
- name: write new version to remote disk
|
||||||
become: true
|
become: true
|
||||||
copy:
|
copy:
|
||||||
content: "{{ playbook_version_number }}"
|
content: "{{ playbook_version_number }}"
|
||||||
dest: "{{ playbook_version_path }}"
|
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
|
|
|
@ -33,5 +33,5 @@ __i3_workspaces:
|
||||||
|
|
||||||
user: "{{ i3wm_user }}"
|
user: "{{ i3wm_user }}"
|
||||||
|
|
||||||
playbook_version_number: 9010 # should be over ninethousand
|
playbook_version_number: 9012 # should be over ninethousand
|
||||||
playbook_version_path: '/etc/ansible-version/role-i3wm_chaos-bodensee_github.com.version'
|
playbook_version_path: 'role-i3wm_chaos-bodensee_github.com.version'
|
||||||
|
|
Loading…
Reference in a new issue