An Ansible collection designed for setting up remote web-dev workstations.
At present, the collection demonstrates one scenario: configuring a remote development server based on my current day-to-day development needs, configured as follows:
- Docksal as a development LAMP environment,
- mosh for stable roaming ssh connection,
- vim: for editing code directly on the remote server,
- clamav: for automated antivirus scanning,
- iptables: for firewalling the server,
- glances: for a nice, command-line system monitor.
The default server configuration is fully firewalled execpt for ports for:
http
,https
,mosh
,ntp
,ssh
.
When run, the scenario's playbook will create a connection script that starts
one of ssh
or mosh
with the right credentials and connection information.
- Install the collection.
Note: installing the collection via
ansible-galaxy
hasn't been tested, and I can't guarantee yet that it works. If it doesn't, the collection will have to be installed manually. - Create a new Ansible project including an inventory file,
- Copy the playbook for the scenario that most closely matches your use case
from the collection's
playbooks/
directory into your project, - Copy the
playbooks/group_vars/
files for the scenario matching the playbook into your projects'group_vars/all/
directory, - Customize the tasks in the playbook to suit your use case,
- Customize the variables files in
group_vars/all/
to suit your use case, - Run the playbooks to provision your server,
- Connect to your newly-provisioned server with the auto-generated connection script.
This will look approximately like this:
ansible-galaxy collection install ctorgalson.remote_dev --pre
mkdir ~/myproject
cd ~/myproject
touch hosts.yml
# (Customize hosts.yml inventory file)
copy -R ~/.ansible/collections/ansible_collections/ctorgalson/remote_dev/playbooks/demo__docksal_mosh_vim_public.yml provision.yml .
mkdir -p group_vars/all
cp -R ~/.ansible/collections/ansible_collections/ctorgalson/remote_dev/playbooks/group_vars/docksal_mosh_vim_public/* ./group_vars/all/
# (Customize playbook)
# (Customize group_vars/all/*.yml)
ansible-playbook -i inventory.yml provision.yml
./redev.sh
The collection uses numerous roles as submodules. Where possible, I've used my own, but most of them are widely-used roles published in the Ansible community. In alphabetical order by namespace/role-name, the collection's roles are:
anarcher.volume
(ansible-volume
)ctorgalson.apt
(ansible-role-apt
)ctorgalson.docksal
(ansible-role-docksal
)ctorgalson.dotfiles
(ansible-role-dotfiles
)ctorgalson.files
(ansible-role-files
)ctorgalson.nvm
(ansible-role-nvm
)ctorgalson.oh-my-zsh
(ansible-role-oh-my-zsh
)ctorgalson.nerdfonts
(ansible-role-nerdfonts
)ctorgalson.platform
(ansible-role-platform
)ctorgalson.ssh-keys
(ansible-role-ssh-keys
)ctorgalson.vim
(ansible-role-vim
)geerlingguy.clamav
(ansible-role-clamav
)geerlingguy.composer
(ansible-role-composer
)geerlingguy.docker
(ansible-role-docker
)geerlingguy.firewall
(ansible-role-firewall
)geerlingguy.nodejs
(ansible-role-nodejs
)geerlingguy.php
(ansible-role-php
)geerlingguy.pip
(ansible-role-pip
)geerlingguy.security
(ansible-role-security
)jnv.unattended-upgrades
(ansible-role-unattended-upgrades
)oefenweb.yarn
(ansible-yarn
)weareinteractive.environment
(ansible-environment
)weareinteractive.users
(ansible-users
)yatesr.timezone
(ansible-timezone
)