From f2cd627f3056843a2a4ad7bbcc60702908a5a80e Mon Sep 17 00:00:00 2001 From: Asara Date: Thu, 20 Aug 2020 00:02:35 -0400 Subject: [PATCH] first pass --- ansible/ansible.cfg | 29 +++++++++++++++ ansible/group_vars/all/main.yml | 7 ++++ ansible/inventory/hosts | 4 +++ ansible/playbooks/site.yml | 13 +++++++ ansible/roles/common/tasks/Debian.yml | 35 +++++++++++++++++++ ansible/roles/common/tasks/FreeBSD.yml | 15 ++++++++ ansible/roles/common/tasks/main.yml | 3 ++ ansible/roles/consul_server/tasks/Debian.yml | 6 ++++ ansible/roles/consul_server/tasks/FreeBSD.yml | 4 +++ ansible/roles/consul_server/tasks/main.yml | 3 ++ 10 files changed, 119 insertions(+) create mode 100644 ansible/ansible.cfg create mode 100644 ansible/group_vars/all/main.yml create mode 100644 ansible/inventory/hosts create mode 100644 ansible/playbooks/site.yml create mode 100644 ansible/roles/common/tasks/Debian.yml create mode 100644 ansible/roles/common/tasks/FreeBSD.yml create mode 100644 ansible/roles/common/tasks/main.yml create mode 100644 ansible/roles/consul_server/tasks/Debian.yml create mode 100644 ansible/roles/consul_server/tasks/FreeBSD.yml create mode 100644 ansible/roles/consul_server/tasks/main.yml diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..3907441 --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,29 @@ +# config file for ansible -- Asara +# =============================================== +[defaults] + +inventory = inventory/hosts +remote_tmp = ~/.ansible/tmp +local_tmp = ~/.ansible/tmp +forks = 5 +poll_interval = 15 +transport = smart +remote_port = 22 +gathering = smart +roles_path = ./roles +stdout_callback = skippy +callback_whitelist = timer +timeout = 10 +remote_user = cfgmgmt +private_key_file = ~/personal/keys/cfgmgmt +ansible_managed = "# Ansible managed | May be overwritten | Asara" +display_skipped_hosts = True +retry_files_enabled = False + +[privilege_escalation] +become = True +become_method = sudo +become_user = root + +[diff] +always = yes diff --git a/ansible/group_vars/all/main.yml b/ansible/group_vars/all/main.yml new file mode 100644 index 0000000..8f86de3 --- /dev/null +++ b/ansible/group_vars/all/main.yml @@ -0,0 +1,7 @@ +--- +# general +site_domain: minhas.io + +# consul +consul_version: 1.8.3 +... diff --git a/ansible/inventory/hosts b/ansible/inventory/hosts new file mode 100644 index 0000000..abc3672 --- /dev/null +++ b/ansible/inventory/hosts @@ -0,0 +1,4 @@ +[consul_server] +ivyking.minhas.io +fatman.minhas.io +sedan.minhas.io diff --git a/ansible/playbooks/site.yml b/ansible/playbooks/site.yml new file mode 100644 index 0000000..7237d26 --- /dev/null +++ b/ansible/playbooks/site.yml @@ -0,0 +1,13 @@ +--- +- hosts: all + roles: + - role: common + +- hosts: consul_server + roles: + - role: consul_server + +- hosts: all:!consul_server + roles: + - role: consul +... diff --git a/ansible/roles/common/tasks/Debian.yml b/ansible/roles/common/tasks/Debian.yml new file mode 100644 index 0000000..c1b82d7 --- /dev/null +++ b/ansible/roles/common/tasks/Debian.yml @@ -0,0 +1,35 @@ +--- +- name: apt update + apt: + update_cache: true + +- name: apt upgrade + apt: + upgrade: yes + +- name: apt dist-upgrade + apt: + upgrade: dist + +- name: install default packages + apt: + name: + - dbus + - git + - htop + - inxi + - ncdu + - ntp + - rxvt-unicode-256color + - screen + - strace + - sysstat + - tmux + - tree + - vim + state: installed + +- name: apt autoremove + apt: + autoremove: true +... diff --git a/ansible/roles/common/tasks/FreeBSD.yml b/ansible/roles/common/tasks/FreeBSD.yml new file mode 100644 index 0000000..e619cb4 --- /dev/null +++ b/ansible/roles/common/tasks/FreeBSD.yml @@ -0,0 +1,15 @@ +--- +- name: Install default packages + pkgng: + name: "{{ packages }}" + vars: + packages: + - htop + - git + - ncdu + - ntp + - screen + - tmux + - tree + - vim +... diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml new file mode 100644 index 0000000..4c4765f --- /dev/null +++ b/ansible/roles/common/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: "{{ ansible_os_family }}" +... diff --git a/ansible/roles/consul_server/tasks/Debian.yml b/ansible/roles/consul_server/tasks/Debian.yml new file mode 100644 index 0000000..ebbac49 --- /dev/null +++ b/ansible/roles/consul_server/tasks/Debian.yml @@ -0,0 +1,6 @@ +--- +- name: get consul + unarchive: + src: "https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_linux_amd64.zip" + dest: /usr/local/bin/ + remote_src: yes diff --git a/ansible/roles/consul_server/tasks/FreeBSD.yml b/ansible/roles/consul_server/tasks/FreeBSD.yml new file mode 100644 index 0000000..cf9966b --- /dev/null +++ b/ansible/roles/consul_server/tasks/FreeBSD.yml @@ -0,0 +1,4 @@ +--- +- name: get consul + unarchive: + src: "https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_linux_amd64.zip" diff --git a/ansible/roles/consul_server/tasks/main.yml b/ansible/roles/consul_server/tasks/main.yml new file mode 100644 index 0000000..4c4765f --- /dev/null +++ b/ansible/roles/consul_server/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: "{{ ansible_os_family }}" +...