Init repo
This commit is contained in:
19
ansible/add-ssh.yml
Executable file
19
ansible/add-ssh.yml
Executable file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
- hosts: all
|
||||
gather_facts: true
|
||||
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
tasks:
|
||||
|
||||
- name: Show keys to add
|
||||
debug:
|
||||
msg: "{{ item }}"
|
||||
loop: "{{ lookup('fileglob', '../ssh/*.pub', wantlist=True) }}"
|
||||
|
||||
- name: Set authorized key took from file
|
||||
authorized_key:
|
||||
user: root
|
||||
state: present
|
||||
key: "{{ lookup('pipe','cat ../ssh/*.pub') }}"
|
||||
|
||||
51
ansible/install-docker.yml
Executable file
51
ansible/install-docker.yml
Executable file
@@ -0,0 +1,51 @@
|
||||
- hosts: all
|
||||
remote_user: deploy
|
||||
become: yes
|
||||
become_user: root
|
||||
become_method: sudo
|
||||
|
||||
tasks:
|
||||
- name: Update all packages to the latest version
|
||||
apt:
|
||||
upgrade: dist
|
||||
autoremove: true
|
||||
become: true
|
||||
|
||||
- name: Ensure old versions of Docker are not installed.
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- docker
|
||||
- docker-engine
|
||||
- docker.io
|
||||
- containerd
|
||||
- runc
|
||||
state: absent
|
||||
- name: Ensure dependencies are installed.
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
- lsb-release
|
||||
state: present
|
||||
|
||||
- name: Add Docker apt key.
|
||||
ansible.builtin.apt_key:
|
||||
url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
|
||||
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||
state: present
|
||||
|
||||
- name: Add Docker repository.
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Install docker
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
state: present
|
||||
149
ansible/install-tools.yml
Executable file
149
ansible/install-tools.yml
Executable file
@@ -0,0 +1,149 @@
|
||||
---
|
||||
- hosts: all
|
||||
gather_facts: true
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
|
||||
tasks:
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
state: present
|
||||
name:
|
||||
- vim
|
||||
- exa
|
||||
- grc
|
||||
- most
|
||||
- highlight
|
||||
- source-highlight
|
||||
- python3-pygments
|
||||
- gawk
|
||||
- python3-apt
|
||||
- tmux
|
||||
- htop
|
||||
- fdisk
|
||||
|
||||
- name: configure .vimrc
|
||||
copy:
|
||||
content: 'set mouse=r'
|
||||
dest: "/root/.vimrc"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: config /etc/vim/vimrc syntax on
|
||||
lineinfile:
|
||||
path: /etc/vim/vimrc
|
||||
regexp: '^"syntax on'
|
||||
line: syntax on
|
||||
|
||||
- name: config /etc/vim/vimrc set background=dark
|
||||
lineinfile:
|
||||
path: /etc/vim/vimrc
|
||||
regexp: '^"set background=dark'
|
||||
line: set background=dark
|
||||
|
||||
- name: config .bashrc add cat color alias
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: 'alias cat="highlight -O ansi --force --syntax=bash"'
|
||||
create: no
|
||||
|
||||
- name: config .bashrc set alias ll
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^# alias ll(.*)'
|
||||
line: 'alias ll\1'
|
||||
backrefs: yes
|
||||
|
||||
- name: config .bashrc set alias ls
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^# alias ls(.*)'
|
||||
line: 'alias ls\1'
|
||||
backrefs: yes
|
||||
|
||||
- name: config .bashrc set alias l
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^# alias l(.*)'
|
||||
line: 'alias l\1'
|
||||
backrefs: yes
|
||||
|
||||
- name: config .bashrc set export LSOPTIONS
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^# export LS_OPTIONS(.*)'
|
||||
line: 'export LS_OPTIONS\1'
|
||||
backrefs: yes
|
||||
|
||||
- name: config .bashrc set eval OPTIONS
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: '^# eval(.*)'
|
||||
line: '# eval\1'
|
||||
backrefs: yes
|
||||
|
||||
|
||||
- name: config .bashrc add vim alias
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: "alias vi='vim'"
|
||||
create: no
|
||||
|
||||
- name: config .bashrc add export LESS Color1
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: 'export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"'
|
||||
create: no
|
||||
|
||||
- name: config .bashrc add export LESS Color2
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: "export LESS=' -R'"
|
||||
create: no
|
||||
|
||||
- name: config .bashrc add export pager
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: 'export PAGER="most"'
|
||||
create: no
|
||||
|
||||
- name: config .bashrc alias grep color
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: "alias grep='grep --color=auto'"
|
||||
create: no
|
||||
|
||||
- name: configure yaml color syntax
|
||||
copy:
|
||||
dest: "/usr/share/source-highlight/yaml.lang"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
content: |
|
||||
include "script_comment.lang"
|
||||
include "number.lang"
|
||||
keyword = "true|false|null"
|
||||
section start '^---'
|
||||
(symbol,name,symbol) = `(^[[:blank:]-]*)([[:alnum:]_]+)(:)`
|
||||
symbol = '^[[:blank:]]*-'
|
||||
string delim "\"" "\"" escape "\\"
|
||||
string delim "'" "'" escape "\\"
|
||||
|
||||
- name: config lang.map yaml
|
||||
lineinfile:
|
||||
path: /usr/share/source-highlight/lang.map
|
||||
line: 'yaml = yaml.lang'
|
||||
create: no
|
||||
|
||||
- name: config lang.map yaml
|
||||
lineinfile:
|
||||
path: /usr/share/source-highlight/lang.map
|
||||
line: 'yml = yaml.lang'
|
||||
create: no
|
||||
|
||||
- name: config .bashrc set Prompt
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
line: "export PS1='\\[\\033[1;31m\\]\\u\\[\\033[0;37m\\]@\\[\\033[1;32m\\]\\h\\[\\033[00m\\]:\\[\\033[1;34m\\]\\w\\[\\033[00m\\] (\\d - \\t)\\n\\$ '"
|
||||
create: no
|
||||
5
ansible/provisioning.yml
Executable file
5
ansible/provisioning.yml
Executable file
@@ -0,0 +1,5 @@
|
||||
- import_playbook: install-tools.yml
|
||||
# - import_playbook: add-ssh.yml
|
||||
- import_playbook: postinstall-vm.yml
|
||||
- import_playbook: install-docker.yml
|
||||
|
||||
Reference in New Issue
Block a user