mirror of
https://github.com/roles-ansible/ansible_role_dotfiles.git
synced 2024-08-16 16:09:49 +02:00
131 lines
3.4 KiB
YAML
131 lines
3.4 KiB
YAML
---
|
|
- name: Create directory for versionscheck
|
|
become: true
|
|
file:
|
|
path: '/etc/ansible-version'
|
|
state: directory
|
|
mode: 0755
|
|
when: submodules_versioncheck|bool
|
|
|
|
- name: check playbook version
|
|
become: true
|
|
slurp:
|
|
src: "{{ playbook_version_path }}"
|
|
register: playbook_version
|
|
when: submodules_versioncheck|bool
|
|
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|bool
|
|
|
|
- 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|bool
|
|
|
|
- name: write new version to remote disk
|
|
become: true
|
|
copy:
|
|
content: "{{ playbook_version_number }}"
|
|
dest: "{{ playbook_version_path }}"
|
|
when: submodules_versioncheck|bool
|
|
|
|
- name: install the latest libselinux-python package
|
|
become: yes
|
|
dnf:
|
|
name: libselinux-python
|
|
state: latest
|
|
when:
|
|
- ansible_distribution == "Fedora"
|
|
|
|
- name: install keychain to support ssh agent
|
|
become: yes
|
|
package:
|
|
name: keychain
|
|
state: latest
|
|
when:
|
|
- ansible_os_family != 'RedHat'
|
|
- install_keychain|bool
|
|
|
|
- name: install keychain on centos
|
|
become: yes
|
|
yum:
|
|
name:
|
|
- http://packages.psychotic.ninja/7/base/x86_64/RPMS//keychain-2.8.0-3.el7.psychotic.noarch.rpm
|
|
- libselinux-python
|
|
state: present
|
|
when:
|
|
- ansible_os_family == 'RedHat'
|
|
- install_keychain|bool
|
|
|
|
- name: Create a global bashrc configuration
|
|
become: yes
|
|
template:
|
|
src: 'templates/bash.bashrc'
|
|
dest: '/etc/bash.bashrc'
|
|
owner: root
|
|
group: root
|
|
mode: 'u=rw,g=r,o=r'
|
|
|
|
- name: Copy bashrc configuration to admin users
|
|
become: yes
|
|
template:
|
|
src: 'templates/bashrc'
|
|
dest: '/home/{{ item }}/.bashrc'
|
|
owner: '{{ item }}'
|
|
group: '{{ item }}'
|
|
mode: 'u=rw,g=r,o='
|
|
with_items: '{{ admins }}'
|
|
when: admins is defined
|
|
|
|
- name: Copy bashrc configuration to non admin users
|
|
become: yes
|
|
template:
|
|
src: 'templates/bashrc'
|
|
dest: '/home/{{ item }}/.bashrc'
|
|
owner: '{{ item }}'
|
|
group: '{{ item }}'
|
|
mode: 'u=rw,g=r,o='
|
|
with_items: '{{ accounts }}'
|
|
when: accounts is defined
|
|
|
|
- name: Copy vimrc configuration to root
|
|
become: yes
|
|
copy:
|
|
src: 'templates/vimrc'
|
|
dest: '/root/.vimrc'
|
|
owner: root
|
|
group: root
|
|
mode: 'u=rw,g=r,o='
|
|
|
|
- name: Copy vimrc configuration to non admin users
|
|
become: yes
|
|
copy:
|
|
src: 'templates/vimrc'
|
|
dest: '/home/{{ item }}/.vimrc'
|
|
owner: '{{ item }}'
|
|
group: '{{ item }}'
|
|
mode: 'u=rw,g=r,o='
|
|
with_items: "{{ accounts }}"
|
|
when: accounts is defined
|
|
|
|
- name: Copy vimrc configuration to admin users
|
|
become: yes
|
|
copy:
|
|
src: 'templates/vimrc'
|
|
dest: '/home/{{ item }}/.vimrc'
|
|
owner: '{{ item }}'
|
|
group: '{{ item }}'
|
|
mode: 'u=rw,g=r,o='
|
|
with_items: "{{ admins }}"
|
|
when: admins is defined
|
|
|
|
- name: delete root .bashrc
|
|
become: true
|
|
file:
|
|
state: absent
|
|
path: "/root/.bashrc"
|
|
when: allow_own_root_bashrc == False
|