Inital Commit: Default buildout for fresh VM
Install pip, docker, and a few other baseline packages. Ensure zware user is setup and has a fresh SSH key. Some of this is duplicating efforts of the install_dotfiles.sh, but ideal this will replace or at least supplement that script.
This commit is contained in:
38
README.md
Normal file
38
README.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||||
6
defaults/main.yml
Normal file
6
defaults/main.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# defaults file for ./default-buildout
|
||||||
|
pip_install_packages:
|
||||||
|
- name: docker
|
||||||
|
docker_users:
|
||||||
|
- zware
|
||||||
2
handlers/main.yml
Normal file
2
handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for ./default-buildout
|
||||||
35
tasks/main.yml
Normal file
35
tasks/main.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
- name: Include external roles
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: "{{ item }}"
|
||||||
|
loop:
|
||||||
|
- geerlingguy.pip
|
||||||
|
- geerlingguy.docker
|
||||||
|
|
||||||
|
- name: install packages
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop:
|
||||||
|
- curl
|
||||||
|
- git
|
||||||
|
- jq
|
||||||
|
- ncdu
|
||||||
|
- nfs-common
|
||||||
|
- python3
|
||||||
|
- python3-pip
|
||||||
|
- python3-venv
|
||||||
|
- tree
|
||||||
|
- tmux
|
||||||
|
- zsh
|
||||||
|
|
||||||
|
- name: Add User
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: zware
|
||||||
|
append: true
|
||||||
|
groups:
|
||||||
|
- sudo
|
||||||
|
generate_ssh_key: true
|
||||||
|
ssh_key_type: ed25519
|
||||||
|
create_home: true
|
||||||
|
state: present
|
||||||
48
tasks/server-build.yaml.bak
Normal file
48
tasks/server-build.yaml.bak
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
- name: Playbook Template
|
||||||
|
hosts: "{{ servers | default('not_defined') }}" # define servers on cli: --extra-vars="servers=all"
|
||||||
|
become_user: root
|
||||||
|
become: true
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
pip_install_packages:
|
||||||
|
- name: docker
|
||||||
|
roles:
|
||||||
|
- geerlingguy.pip
|
||||||
|
- geerlingguy.docker
|
||||||
|
tasks:
|
||||||
|
- name: install packages
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop:
|
||||||
|
- curl
|
||||||
|
- git
|
||||||
|
- jq
|
||||||
|
- ncdu
|
||||||
|
- nfs-common
|
||||||
|
- python3
|
||||||
|
- python3-pip
|
||||||
|
- python3-venv
|
||||||
|
- tree
|
||||||
|
- tmux
|
||||||
|
- zsh
|
||||||
|
|
||||||
|
- name: Add User
|
||||||
|
|
||||||
|
- name: Import Docker Install role
|
||||||
|
#import_role: docker
|
||||||
|
# Rocky 9 - Docker Install steps - https://docs.rockylinux.org/gemstones/docker/
|
||||||
|
#sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
||||||
|
#sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||||
|
#sudo systemctl --now enable docker
|
||||||
|
|
||||||
|
- name: Add user to groups
|
||||||
|
ansible.builtin.group:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop:
|
||||||
|
- docker
|
||||||
|
- sudo
|
||||||
|
|
||||||
|
|
||||||
2
tests/inventory
Normal file
2
tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
tests/inventory.yaml
Normal file
5
tests/inventory.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
all:
|
||||||
|
hosts:
|
||||||
|
ubuntu-template:
|
||||||
|
#ansible_user: root
|
||||||
10
tests/test.yml
Normal file
10
tests/test.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Playbook Template
|
||||||
|
hosts: all
|
||||||
|
become_user: root
|
||||||
|
become: true
|
||||||
|
# gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: include role
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: ../../default-buildout
|
||||||
2
vars/main.yml
Normal file
2
vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for ./default-buildout
|
||||||
Reference in New Issue
Block a user