Ansible dev environment
The Creative Commons team is committed to fostering a welcoming community. This project and all other Creative Commons open source projects are governed by our Code of Conduct. Please report unacceptable behavior to conduct@creativecommons.org per our reporting guidelines.
See CONTRIBUTING.md
.
The aim of the project is to establish a robust and localized development environment utilizing Ansible and Docker. This environment will mirror a professional work setting, incorporating a dedicated security server (Bastion), automation through Ansible, a web server, and a data storage server. This configuration will simplify and secure development processes and serve as a blueprint for future projects at CC.
The docker-compose.yml
file defines the following
containers:
- bastion-dev - Bastion (SSH jump server)
- ansible-dev - Ansible
- web-dev - Web server (Apache2/WordPress)
- db-dev - Database server (MariaDB)
See Create Local Ansible Dev Environment Using Docker for more details.
-
Create the
.env
file:cp .env.example .env
-
Execute the
generate_ssh_keys
script:./generate_ssh_keys.sh
-
Build and start Docker:
docker-compose up
-
Wait for the build and initialization to complete
The SSH setup has been established and is currently in use for the Ansible container. Follow the steps below to generate and use the SSH keys for the sysadmin user:
-
Execute the generate-ssh-keys.sh script to generate the keys used by the sysadmin user:
./generate-ssh-keys.sh
-
Bring down the existing Docker containers and start them again:
docker-compose down docker-compose up -d
-
Ensure the Docker containers are running:
docker ps
-
Execute the following command to confirm that SSH is working fine:
ssh -i ./sysadmin-ssh-keys/rsa_sysadmin -p 22001 sysadmin@localhost
SSH connection information: example local/laptop ~/.ssh/config
configugration
Host bastion-dev
HostName localhost
User sysadmin
Port 22222
IdentityFile /home/sysadmin/.ssh/id_rsa
Host ansible-dev
HostName ansible-dev
User sysadmin
Port 22
IdentityFile /home/sysadmin/.ssh/id_rsa
Host web-dev
HostName web-dev
User sysadmin
Port 22
IdentityFile /home/sysadmin/.ssh/id_rsa
- Assume remote username
sysadmin
. Replace these values in your own local/laptop configuration. - ProxyJump allow you to use
ssh bastion
to connect to the bastion-dev host, andssh ansible-dev
orssh web-dev
, and SSH will automatically connect through the bastion jump host.
- Ansible Documentation
- FrontPage - Debian Wiki
- Docker Docs
- creativecommons/sre-salt-prime: Site Reliability Engineering / DevOps SaltStack configuration files
- creativecommons/index-dev-env: Local development environment for CreativeCommons.org (reference for docker project)