1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_dotfiles.git synced 2024-08-16 16:09:49 +02:00
ansible_role_dotfiles/tasks/main.yml

157 lines
3.5 KiB
YAML
Raw Normal View History

2018-11-15 10:26:52 +01:00
---
2019-05-22 10:58:27 +02:00
- include_tasks: versioncheck.yml
2019-05-17 15:10:50 +02:00
when: submodules_versioncheck|bool
2019-01-19 00:15:14 +01:00
2018-11-15 10:26:52 +01:00
- name: install the latest libselinux-python package
2019-02-18 22:13:07 +01:00
become: yes
2018-11-15 10:26:52 +01:00
dnf:
name: libselinux-python
state: latest
2019-05-17 15:55:28 +02:00
when:
2019-03-08 11:33:28 +01:00
- ansible_distribution == "Fedora"
2018-11-15 10:26:52 +01:00
2019-03-06 11:15:16 +01:00
- name: install keychain to support ssh agent
2019-03-06 10:15:21 +01:00
become: yes
2019-05-17 15:55:28 +02:00
package:
2019-03-06 10:15:21 +01:00
name: keychain
state: latest
2019-05-17 15:55:28 +02:00
when:
2019-03-06 11:31:51 +01:00
- ansible_os_family != 'RedHat'
2019-05-17 15:10:50 +02:00
- install_keychain|bool
2019-03-06 11:15:16 +01:00
- name: install keychain on centos
become: yes
yum:
2019-03-06 11:43:45 +01:00
name:
2019-05-17 15:55:28 +02:00
- http://packages.psychotic.ninja/7/base/x86_64/RPMS//keychain-2.8.0-3.el7.psychotic.noarch.rpm
2019-03-06 11:31:51 +01:00
- libselinux-python
2019-03-06 11:15:16 +01:00
state: present
2019-03-08 11:33:28 +01:00
when:
- ansible_os_family == 'RedHat'
2019-05-17 15:10:50 +02:00
- install_keychain|bool
2019-03-06 10:15:21 +01:00
2018-11-15 10:26:52 +01:00
- name: Create a global bashrc configuration
2019-02-18 22:13:07 +01:00
become: yes
2019-01-13 20:06:29 +01:00
template:
2019-01-10 13:32:49 +01:00
src: 'templates/bash.bashrc'
2018-11-15 10:26:52 +01:00
dest: '/etc/bash.bashrc'
owner: root
group: root
mode: 'u=rw,g=r,o=r'
- name: Copy bashrc configuration to admin users
2019-02-18 22:13:07 +01:00
become: yes
2018-11-15 15:04:18 +01:00
template:
2019-01-10 13:32:49 +01:00
src: 'templates/bashrc'
2018-11-15 10:26:52 +01:00
dest: '/home/{{ item }}/.bashrc'
owner: '{{ item }}'
2019-01-13 17:30:59 +01:00
group: '{{ item }}'
2018-11-15 10:26:52 +01:00
mode: 'u=rw,g=r,o='
with_items: '{{ admins }}'
2019-02-01 14:59:07 +01:00
when: admins is defined
2018-11-15 10:26:52 +01:00
2019-07-01 14:52:09 +02:00
- name: Copy bashrc configuration to root
become: yes
template:
src: 'templates/bashrc'
dest: '/root/.bashrc'
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o='
2019-07-01 14:59:52 +02:00
when: allow_own_root_bashrc | bool
2019-07-01 14:52:09 +02:00
2019-03-03 23:09:48 +01:00
- 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='
2019-05-14 11:18:24 +02:00
with_items: '{{ accounts }}'
2019-06-11 13:41:22 +02:00
when:
- accounts is defined
- accounts != ['root']
- accounts != 'root'
2019-03-03 23:09:48 +01:00
2018-11-15 10:26:52 +01:00
- name: Copy vimrc configuration to root
2019-02-18 22:13:07 +01:00
become: yes
2018-11-15 10:26:52 +01:00
copy:
2019-01-10 13:32:49 +01:00
src: 'templates/vimrc'
2018-11-15 10:26:52 +01:00
dest: '/root/.vimrc'
owner: root
group: root
mode: 'u=rw,g=r,o='
2019-03-03 23:09:48 +01:00
- 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='
2019-05-14 11:18:24 +02:00
with_items: "{{ accounts }}"
2019-06-11 13:41:22 +02:00
when:
- accounts is defined
- accounts != ['root']
- accounts != 'root'
2019-03-03 23:09:48 +01:00
2018-11-15 10:26:52 +01:00
- name: Copy vimrc configuration to admin users
2019-02-18 22:13:07 +01:00
become: yes
2018-11-15 10:26:52 +01:00
copy:
2019-01-10 13:32:49 +01:00
src: 'templates/vimrc'
2018-11-15 10:26:52 +01:00
dest: '/home/{{ item }}/.vimrc'
owner: '{{ item }}'
2019-01-13 17:30:59 +01:00
group: '{{ item }}'
2018-11-15 10:26:52 +01:00
mode: 'u=rw,g=r,o='
with_items: "{{ admins }}"
2019-02-01 14:59:07 +01:00
when: admins is defined
2018-11-15 10:26:52 +01:00
2019-04-30 09:42:37 +02:00
- name: delete root .bashrc
2019-05-19 19:17:07 +02:00
become: yes
2019-04-30 09:42:37 +02:00
file:
state: absent
path: "/root/.bashrc"
2019-06-07 17:21:23 +02:00
when: not allow_own_root_bashrc | bool
- name: create .config/ranger/ directory
become: true
file:
path: "/home/{{ item }}/.config/ranger"
state: directory
recurse: yes
owner: "{{ item }}"
group: "{{ item }}"
with_items: "{{ accounts }}"
2019-06-11 13:41:22 +02:00
when:
- ranger_hidden_files | bool
- accounts is defined
- accounts != ['root']
- accounts != 'root'
2019-06-07 17:21:23 +02:00
- name: create .config/ranger/rc.conf file
become: true
template:
src: templates/ranger_rc.conf.j2
dest: "/home/{{ item }}/.config/ranger/rc.conf"
owner: "{{ item }}"
group: "{{ item }}"
with_items: "{{ accounts }}"
2019-06-11 13:53:10 +02:00
when:
- ranger_hidden_files | bool
- accounts is defined
- accounts != ['root']
- accounts != 'root'
2019-09-26 15:17:01 +02:00
- name: Install vim and gedit
become: true
package:
name:
- vim
- gedit
state: present
2019-11-12 17:33:14 +01:00
when:
- install_editor | bool
- ansible_distribution_version != '7' and ansible_distribution_release != 'wheezy' and ansible_machine != 'armv6l'