aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2022-12-10 01:04:49 -0800
committerclarkzjw <[email protected]>2022-12-10 01:04:49 -0800
commit027b7bd2633bf57e1c49b29329ad61a039a97869 (patch)
tree4282b6beb76de9898b997138a5531dbaec1e3cff
parentcb5f8087f8c69c920f87fd5c219906f0796d6938 (diff)
downloadjinwei.me-027b7bd2633bf57e1c49b29329ad61a039a97869.tar.gz
ansible: add debian init
-rw-r--r--jinwei.me/config/ansible.cfg14
-rw-r--r--jinwei.me/config/inventory/aws_ec2.yaml7
-rw-r--r--jinwei.me/config/requirements.yaml10
-rw-r--r--jinwei.me/config/role.yaml3
-rw-r--r--jinwei.me/config/roles/debian_init/defaults/main.yaml1
-rw-r--r--jinwei.me/config/roles/debian_init/tasks/main.yaml62
-rw-r--r--jinwei.me/config/site.yaml3
7 files changed, 100 insertions, 0 deletions
diff --git a/jinwei.me/config/ansible.cfg b/jinwei.me/config/ansible.cfg
new file mode 100644
index 0000000..9345045
--- /dev/null
+++ b/jinwei.me/config/ansible.cfg
@@ -0,0 +1,14 @@
1[defaults]
2host_key_checking = False
3transport = ssh
4remote_user = admin
5roles_path = roles
6inventory = inventory
7force_color = True
8interpreter_python = auto_silent
9
10[connection]
11pipelining = True
12
13[privilege_escalation]
14become = True
diff --git a/jinwei.me/config/inventory/aws_ec2.yaml b/jinwei.me/config/inventory/aws_ec2.yaml
new file mode 100644
index 0000000..100d95b
--- /dev/null
+++ b/jinwei.me/config/inventory/aws_ec2.yaml
@@ -0,0 +1,7 @@
1plugin: aws_ec2
2regions:
3 - us-west-2
4hostnames:
5 - tag:Name
6compose:
7 ansible_host: public_ip_address
diff --git a/jinwei.me/config/requirements.yaml b/jinwei.me/config/requirements.yaml
new file mode 100644
index 0000000..5229cc7
--- /dev/null
+++ b/jinwei.me/config/requirements.yaml
@@ -0,0 +1,10 @@
1---
2collections:
3 - name: amazon.aws
4 version: 3.2.0
5 - name: community.general
6 version: 4.7.0
7 - name: ansible.posix
8 version: 1.3.0
9 - name: community.docker
10 version: 3.2.1
diff --git a/jinwei.me/config/role.yaml b/jinwei.me/config/role.yaml
new file mode 100644
index 0000000..ab3fca5
--- /dev/null
+++ b/jinwei.me/config/role.yaml
@@ -0,0 +1,3 @@
1- hosts: "{{ target }}"
2 roles:
3 - role: "{{ role }}"
diff --git a/jinwei.me/config/roles/debian_init/defaults/main.yaml b/jinwei.me/config/roles/debian_init/defaults/main.yaml
new file mode 100644
index 0000000..685f0b6
--- /dev/null
+++ b/jinwei.me/config/roles/debian_init/defaults/main.yaml
@@ -0,0 +1 @@
user_home: /home/clarkzjw
diff --git a/jinwei.me/config/roles/debian_init/tasks/main.yaml b/jinwei.me/config/roles/debian_init/tasks/main.yaml
new file mode 100644
index 0000000..48e8380
--- /dev/null
+++ b/jinwei.me/config/roles/debian_init/tasks/main.yaml
@@ -0,0 +1,62 @@
1- name: Disable unattended-upgrades
2 ansible.builtin.systemd:
3 name: unattended-upgrades
4 state: stopped
5 enabled: false
6
7- name: install packages
8 apt:
9 name:
10 - apt-transport-https
11 - build-essential
12 - ca-certificates
13 - mariadb-client
14 - lsb-release
15 - unzip
16 - gnupg
17 - htop
18 - curl
19 - zip
20 - vim
21 - zsh
22 - git
23 update_cache: true
24
25- name: add user
26 user:
27 name: clarkzjw
28 shell: /usr/bin/zsh
29 home: "{{ user_home }}"
30 system: true
31
32- name: Add Docker GPG apt Key
33 apt_key:
34 url: https://download.docker.com/linux/debian/gpg
35 keyring: /etc/apt/trusted.gpg.d/docker.gpg
36 state: present
37
38- name: Add Docker Repository
39 apt_repository:
40 repo: deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/docker.gpg] https://download.docker.com/linux/debian {{ ansible_distribution_release | lower }} stable
41 state: present
42
43- name: Update apt and install docker-ce
44 apt:
45 name:
46 - docker-ce
47 - docker-ce-cli
48 - containerd.io
49 - docker-compose-plugin
50 state: latest
51 update_cache: true
52
53- name: enable docker service
54 systemd:
55 name: docker
56 enabled: true
57 daemon_reload: true
58
59- name: Clean unneeded packages
60 ansible.builtin.apt:
61 autoremove: true
62 purge: true
diff --git a/jinwei.me/config/site.yaml b/jinwei.me/config/site.yaml
new file mode 100644
index 0000000..3dbcc71
--- /dev/null
+++ b/jinwei.me/config/site.yaml
@@ -0,0 +1,3 @@
1- hosts: jinwei-me
2 roles:
3 - role: debian_init
Powered by cgit v1.2.3 (git 2.41.0)