Feat: rename roles by adding [role_name]

This commit is contained in:
Bertrand Benjamin 2020-03-17 05:36:23 +01:00
parent 5761abff80
commit 571472acea
7 changed files with 46 additions and 46 deletions

View File

@ -1,10 +1,10 @@
---
- name: Create ansible conf directory
- name: [ansible] Create ansible conf directory
file:
path: /etc/ansible
state: directory
- name: Copy ansible.cfg
- name: [ansible] Copy ansible.cfg
copy:
src: files/ansible.cfg
dest: /etc/ansible/ansible.cfg

View File

@ -1,10 +1,10 @@
---
- name: Update and upgrade all packages
- name: [deb_CLI_packages] Update and upgrade all packages
apt:
update_cache: yes
upgrade: full
- name: Install base CLI packages
- name: [deb_CLI_packages] Install base CLI packages
apt:
name:
- sudo
@ -26,7 +26,7 @@
- rxvt-unicode-256color
state: present
- name: Install extra CLI packages
- name: [deb_CLI_packages] Install extra CLI packages
apt:
name: "{{ item }}"
state: present

View File

@ -1,5 +1,5 @@
---
- name: Remove depot docker version
- name: [deb_docker] Remove depot docker version
apt:
name:
- docker
@ -7,7 +7,7 @@
- docker.io
state: absent
- name: Install tool to use apt with https and gpg
- name: [deb_docker] Install tool to use apt with https and gpg
apt:
name:
- apt-transport-https
@ -15,48 +15,48 @@
- gpg
state: present
- name: Add Docker apt key.
- name: [deb_docker] Add Docker apt key.
apt_key:
url: https://download.docker.com/linux/debian/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
register: add_repository_key
- name: Ensure curl is present (on older systems without SNI).
- name: [deb_docker] Ensure curl is present (on older systems without SNI).
apt:
name: curl
state: present
when: add_repository_key is failed
- name: Add Docker apt key (alternative for older systems without SNI).
- name: [deb_docker] Add Docker apt key (alternative for older systems without SNI).
shell: "curl -sSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -"
args:
warn: no
when: add_repository_key is failed
- name: Add Docker repository.
- name: [deb_docker] Add Docker repository.
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable
state: present
update_cache: yes
- name: Install docker-ce
- name: [deb_docker] Install docker-ce
apt:
name: docker-ce
state: present
- name: Install docker-compose
- name: [deb_docker] Install docker-compose
get_url:
url: https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
mode: 751
- name: Create docker group
- name: [deb_docker] Create docker group
group:
name: docker
state: present
- name: Add deploy user to docker group
- name: [deb_docker] Add deploy user to docker group
user:
name: "{{ item.username }}"
groups: docker

View File

@ -1,5 +1,5 @@
---
- name: Copy tmux.conf
- name: [dotfiles] Copy tmux.conf
template:
src: files/dotfiles/tmux.conf
dest: /home/{{ item.username }}/.tmux.conf
@ -8,24 +8,24 @@
with_items: "{{ me }}"
# Zsh config
- name: Download antibody
- name: [dotfiles] Download antibody
get_url:
url: https://raw.githubusercontent.com/getantibody/installer/master/install
dest: /tmp/antibody.sh
mode: 0770
when: prompt == "zsh"
- name: Execute the antibody.sh
- name: [dotfiles] Execute the antibody.sh
shell: /tmp/antibody.sh
become: yes
ignore_errors: yes
when: prompt == "zsh"
- name: Remove the antibody.sh
- name: [dotfiles] Remove the antibody.sh
file: path=/tmp/antibody.sh state=absent
when: prompt == "zsh"
- name: Copy local zshrc
- name: [dotfiles] Copy local zshrc
template:
src: files/dotfiles/zshrc
dest: /home/{{ item.username }}/.zshrc
@ -34,7 +34,7 @@
with_items: "{{ me }}"
when: prompt == 'zsh'
- name: Copy local zshrc.local
- name: [dotfiles] Copy local zshrc.local
template:
src: files/dotfiles/zshrc.local
dest: /home/{{ item.username }}/.zshrc.local
@ -43,7 +43,7 @@
with_items: "{{ me }}"
when: prompt == 'zsh'
- name: Copy local zsh_plugins.txt
- name: [dotfiles] Copy local zsh_plugins.txt
template:
src: files/dotfiles/zsh_plugins.txt
dest: /home/{{ item.username }}/.zsh_plugins.txt
@ -53,14 +53,14 @@
when: prompt == 'zsh'
# Fish config
- name: Create fish config directory
- name: [dotfiles] Create fish config directory
file:
dest: /home/{{ item.username }}/.config/fish/
state: directory
with_items: "{{ me }}"
when: prompt == 'fish'
- name: Copy config.fish
- name: [dotfiles] Copy config.fish
template:
src: files/dotfiles/config.fish
dest: /home/{{ item.username }}/.config/fish/
@ -70,7 +70,7 @@
when: prompt == 'fish'
register: fishconfig
- name: Copy fisher plugin list
- name: [dotfiles] Copy fisher plugin list
template:
src: files/dotfiles/fishfile
dest: /home/{{ item.username }}/.config/fish/
@ -81,7 +81,7 @@
register: fishplugin
# Vim config
- name: Copy .vim/
- name: [dotfiles] Copy .vim/
copy:
src: files/dotfiles/vim/
dest: /home/{{ item.username }}/.vim/
@ -89,13 +89,13 @@
group: "{{ item.group }}"
with_items: "{{ me }}"
- name: Creates .vim/autoload/
- name: [dotfiles] Creates .vim/autoload/
file:
path: /home/{{ item.username }}/.vim/autoload/
state: directory
with_items: "{{ me }}"
- name: Download plug.vim
- name: [dotfiles] Download plug.vim
get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: /home/{{ item.username }}/.vim/autoload/plug.vim
@ -103,7 +103,7 @@
group: "{{ item.group }}"
with_items: "{{ me }}"
- name: Copy vimrc
- name: [dotfiles] Copy vimrc
template:
src: files/dotfiles/vimrc
dest: /home/{{ item.username }}/.vimrc
@ -112,7 +112,7 @@
with_items: "{{ me }}"
# Ssh config
- name: Creates .ssh
- name: [dotfiles] Creates .ssh
file:
path: /home/{{ item.username }}/.ssh/
state: directory
@ -121,7 +121,7 @@
with_items: "{{ me }}"
when: not server
- name: Copy ssh user config
- name: [dotfiles] Copy ssh user config
template:
src: files/dotfiles/sshconfig
dest: /home/{{ item.username }}/.ssh/config
@ -130,7 +130,7 @@
with_items: "{{ deploy_users }}"
when: not server
- name: Copy ssh user config
- name: [dotfiles] Copy ssh user config
template:
src: files/dotfiles/sshconfig
dest: /home/{{ item.username }}/.ssh/config
@ -140,7 +140,7 @@
when: not server
# Git config
- name: Copy gitconfig
- name: [dotfiles] Copy gitconfig
template:
src: files/dotfiles/gitconfig
dest: /home/{{ item.username }}/.gitconfig

View File

@ -1,10 +1,10 @@
---
# - name: Copy sshd_config
# - name: [ssh] Copy sshd_config
# template:
# src: files/sshd_config
# dest: /etc/ssh/sshd_config
- name: Disable empty password login
- name: [ssh] Disable empty password login
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^#?PermitEmptyPasswords"
@ -13,7 +13,7 @@
tags:
- first_deployement
- name: Disable remote root login
- name: [ssh] Disable remote root login
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^#?PermitRootLogin"
@ -22,7 +22,7 @@
tags:
- first_deployement
- name: Add public key for deploy user
- name: [ssh] Add public key for deploy user
authorized_key:
user: "{{ item.username }}"
key: "{{ lookup('file', 'sshpubs/' + deploy_public_key) }}"
@ -32,7 +32,7 @@
tags:
- first_deployement
- name: Disable password login
- name: [ssh] Disable password login
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^#?PasswordAuthentication"
@ -43,7 +43,7 @@
tags:
- first_deployement
- name: Enable SSH daemon (not Debian)
- name: [ssh] Enable SSH daemon (not Debian)
service:
name: sshd
state: started
@ -52,7 +52,7 @@
- first_deployement
when: ansible_distribution != 'Debian'
- name: Enable SSH daemon (Debian)
- name: [ssh] Enable SSH daemon (Debian)
service:
name: ssh
state: started

View File

@ -1,5 +1,5 @@
---
- name: Configure sudoers
- name: [sudo] Configure sudoers
template:
src: files/sudoers
dest: /etc/sudoers
@ -7,9 +7,9 @@
tags:
- first_deployement
- name: Create sudo group
- name: [sudo] Create sudo group
group:
name: sudo
name: [sudo] sudo
state: present
tags:
- first_deployement

View File

@ -1,10 +1,10 @@
---
- name: Ensure wheel group exists
- name: [users] Ensure wheel group exists
group:
name: wheel
state: present
- name: Add deploy users
- name: [users] Add deploy users
user:
name: "{{ item.username }}"
password: "{{ item.password | password_hash('sha512')}}"
@ -16,7 +16,7 @@
with_items: "{{ deploy_users }}"
when: create_user
- name: Add me
- name: [users] Add me
user:
name: "{{ item.username }}"
password: "{{ item.password | password_hash('sha512')}}"