diff --git a/tasks/main.yml b/tasks/main.yml index aa7c7cd..0a29465 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,37 @@ --- +- name: Create directory for versionscheck + become: true + file: + path: '/etc/ansible-version' + state: directory + mode: 0755 + when: submodules_versioncheck + +- name: check playbook version + become: true + slurp: + src: "{{ playbook_version_path }}" + register: playbook_version + when: submodules_versioncheck + ignore_errors: yes + +- name: Print version + debug: + msg: "Remote playbook version: '{{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}'. Local playbook version: '{{ playbook_version_number|string }}'." + when: submodules_versioncheck + +- name: Check if your version is outdated + fail: + msg: "Your current ansible module has the version '{{ playbook_version_number }}' and is outdated. Please update it at least to version '{{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode }}'!" + when: + - playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck + +- name: write new version to remote disk + become: true + copy: + content: "{{ playbook_version_number }}" + dest: "{{ playbook_version_path }}" + when: submodules_versioncheck - name: install the latest libselinux-python package become: yes @@ -56,8 +89,8 @@ owner: '{{ item }}' group: '{{ item }}' mode: 'u=rw,g=r,o=' - with_items: '{{ user }}' - when: user is defined + with_items: '{{ accounts }}' + when: accounts is defined - name: Copy vimrc configuration to root become: yes @@ -76,8 +109,8 @@ owner: '{{ item }}' group: '{{ item }}' mode: 'u=rw,g=r,o=' - with_items: "{{ user }}" - when: user is defined + with_items: "{{ accounts }}" + when: accounts is defined - name: Copy vimrc configuration to admin users become: yes diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..6dcd60e --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,13 @@ +# some bash variables +bash: + bashrc: '' + keychain: 'eval $(keychain --eval --quiet id_ed25519)' + nextcloud: false + nm: false + pwgen: true + shell: "/bin/bash" + keyboard: '$(if [[ $(id -u) -ne 0 ]];then echo "\[\033[01;33m\]"; else echo "\[\033[01;31m\]"; fi) $(if [[ $? == 0 ]]; then printf "\xE2\x9D\xA4"; fi) \[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\H\[\033[01;34m\] <\A> \[\033[01;35m\] \j \[\033[01;36m\] \w \[\033[01;33m\]\n\[\033[01;33m\] $(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1 /p")$\[\033[01;00m\] ' + + +playbook_version_number: 100 # integer without dots +playbook_version_path: '/etc/ansible-version/role_dotfiles_chaos-bodensee_github.version'